Compatibility between families, noise margins and how to connect 5 V to 3.3 V
For an output and an input to understand each other it is not enough that they share the same supply: four voltages from their datasheets must be compared.
The noise margins \(NM_H\) and \(NM_L\) are the interference voltage the connection withstands without errors. Between VIL and VIH there is a forbidden zone where the input may read anything. There is also a fifth condition: the output voltage must not exceed the maximum the input accepts, usually its supply plus 0.3 V, unless it is 5 V tolerant.
Typical catalogue values with light load (JEDEC for the families, datasheets for the microcontrollers). With high output currents VOH drops and VOL rises: always check the datasheet of the actual parts.
It is the simplest method for a one-way signal going down in level: two resistors reduce a 5 V logic 1 to a little over 3 V. Its limit is speed, because the input capacitance charges through the equivalent resistance of the divider.
For a reliable signal each half-period should last at least about three times the rise time; the calculator gives the maximum frequency with that rule. Resistors of a few kΩ are fine for UART and slow SPI; for SPI at several MHz the divider falls short and a buffer is better.
| Method | Direction | Speed | Typical use |
|---|---|---|---|
| Resistive divider | Down (5 → 3.3 V), one-way | Low to medium (depends on the resistors) | UART RX, slow signals, sensor inputs |
| Series resistor (1 to 10 kΩ) | Down, one-way | Medium | Only if the datasheet allows current through the protection diodes; not recommended |
| Direct connection | Up (3.3 → 5 V) | High | Works if the receiver has TTL inputs (VIH = 2 V): 74HCT, 74ACT, many modules |
| N-channel MOSFET with two pull-ups (BSS138, 2N7002) | Bidirectional, open-drain outputs | Up to a few hundred kHz | I²C, 1-Wire, SMBus |
| Buffer with 5 V tolerant inputs (74LVC, 74LVC1G) | Down, one-way | Very high (tens of MHz) | SPI, clocks, fast buses |
| 74HCT/74AHCT buffer powered at 5 V | Up, one-way | High | WS2812 LED strips from a 3.3 V microcontroller |
| Dual-supply translator (74LVC245, SN74LVC8T245) | Bidirectional with direction pin | Very high | Parallel and data buses |
| Auto-direction translator (TXB0108, TXS0108E) | Bidirectional without direction pin | High | TXB for push-pull outputs; TXS for open drain and I²C |
This is the circuit on cheap "level shifter" modules. An N-channel MOSFET has its gate at 3.3 V, its source on the 3.3 V side and its drain on the 5 V side, and each side has its own pull-up. It works in both directions:
It needs a MOSFET with a threshold voltage well below the low supply (BSS138: 0.8 to 1.5 V) and is meant for open-drain outputs. It also works with push-pull outputs, but the rising edge depends only on the pull-up, so it is slow.
Related: pull-up resistors and I²C bus, transistor as a switch, optocouplers and Ohm's law.