Key Engineering Takeaways
- •Digital electronics use Base-2 (Binary) because transistors act most reliably as binary switches (Fully ON = 1, Fully OFF = 0).
- •Each binary digit is a Bit; 4 bits make a Nibble, 8 bits make a Byte (0 to 255), and 16 bits make a Word.
- •Hexadecimal (Base-16: 0-9, A-F) is human shorthand for binary: each hex digit represents exactly 4 binary bits (0xFF = 11111111 = 255).
- •A 3.3V HIGH output can safely trigger a 5V TTL input, but a 5V HIGH output WILL DESTROY an unbuffered 3.3V CMOS input pin.
- •Always use bidirectional MOSFET logic level shifters (BSS138) for I2C and UART buses crossing voltage domains.
- • Basic Voltage and Transistor concepts
- • ESP32 (3.3V)
- • Arduino Uno (5V)
- • BSS138 Logic Level Converter Module
- • Breadboard and Multimeter
Why Electronics Use Binary (0 and 1)
While humans count in decimal (Base-10) using ten fingers (0-9), electronic microprocessors operate exclusively in Binary (Base-2) using two discrete states:
Why Binary?
In an analog circuit, trying to distinguish 10 subtle voltage levels (0.5V, 1.0V, 1.5V dots) is extremely vulnerable to electrical noise, temperature drift, and battery voltage sag.
In binary, an electronic transistor only has to determine whether a voltage is HIGH (Switch Closed / V_CC) or LOW (Switch Open / 0V). This gives digital computers near-infinite noise immunity!
Binary Counting, Place Values & Hexadecimal Conversion
In base-2, each column represents an increasing power of 2 (2^0=1, 2^1=2, 2^2=4, 2^3=8, 2^4=16, 2^5=32, 2^6=64, 2^7=128):
Hexadecimal Shorthand (Base-16):
Writing 32-bit binary registers is tedious. Hexadecimal uses symbols 0-9 and A-F (A=10, B=11, C=12, D=13, E=14, F=15):
- Split 8-bit byte into two 4-bit nibbles:
Voltage Logic Levels: 5V TTL vs 3.3V CMOS Thresholds
What physical voltages represent a digital 0 and 1?
1. 5V TTL Logic Standard:
- Output LOW (V_OL): 0.0V - 0.4V
- Output HIGH (V_OH): 2.4V - 5.0V
- Input LOW Threshold (V_IL): Must be <0.8V to be recognized as
0. - Input HIGH Threshold (V_IH): Must be >2.0V to be recognized as
1.
2. 3.3V LVCMOS Standard (ESP32, Raspberry Pi, STM32):
- Input LOW: <0.8V
- Input HIGH: >2.0V
- Maximum Safe Input Voltage: 3.6V MAXIMUM.
Level Shifting: Interfacing 3.3V and 5V Microcontrollers Safely
To safely communicate between 3.3V and 5V devices:
- 1Unidirectional (5V TX to 3.3V RX): Simple two-resistor voltage divider (1 kΩ + 2 kΩ) drops 5.0V down to 3.3V.
- 2Bidirectional (I2C Bus SDA/SCL): Use a BSS138 N-MOSFET level shifter module. When either side pulls low, the MOSFET conducts and safely pulls the opposite side low without ever exposing the 3.3V chip to 5V!
Frequently Asked Questions
What is the "Indeterminate Zone" in digital logic?
The Indeterminate Zone (typically 0.8V to 2.0V in 5V TTL) is the undefined voltage region between valid LOW and HIGH. Voltages floating in this zone cause chips to draw excessive supply current and trigger random erratic logic transitions.