Recently more microcontrollers and sensors run at 3.3 V, but older logic ICs and many modules still use 5 V. When you connect the two worlds and the voltages do not match, the signal is not recognized, or in the worst case the chip is destroyed. This article covers ways to safely connect 3.3 V and 5 V signals (resistor dividers, conditions for direct connection, level-shifter modules, and the MOSFET approach), where to use each, and common damage cases.
Why it is a problem
- 5 V signal → 3.3 V input: the inputs of many 3.3 V chips cannot tolerate 5 V. Current flows through the input protection diode and damages the pin or chip.
- 3.3 V signal → 5 V input: the question is whether the 5 V chip recognizes 3.3 V as High. If it does not, the signal does not get through.
Checking the input threshold voltage
A digital input has a set minimum voltage it recognizes as High (VIH).
| Part | Minimum voltage read as High at a 5 V supply (approx.) | Can it take a 3.3 V signal |
|---|---|---|
| 74LS (TTL) | 2.0 V | Yes |
| 74HCT | 2.0 V | Yes |
| 74HC | About 3.5 V (70% of supply) | No |
| AVR (Arduino Uno) | About 3.0 V (60% of supply) | Yes, but with little margin |
If you are not sure whether a 3.3 V output reaches a 5 V input, check the VIH in the datasheet (How to Read a Datasheet).
Method 1: Resistor divider (5 V → 3.3 V, one direction)
The simplest method when the signal flows only from the 5 V side to the 3.3 V side. Divide with two resistors (Designing Voltage Dividers and the Loading Effect).
- With R1 (top, signal side) = 1 kΩ and R2 (bottom, GND side) = 2 kΩ, 5 V becomes
5 × 2 / 3 ≈ 3.33V. - Or you can make about 3.0 V with 2.2 kΩ and 3.3 kΩ.
| Pros | Cons |
|---|---|
| Simple with two parts | Only one direction; the waveform dulls on fast signals (RC of the resistors and input capacitance) |
| Almost no cost | Voltage drop where the input impedance is low (voltage divider calculator) |
For example: widely used to connect the 5 V echo signal of an ultrasonic sensor (HC-SR04) to an ESP32 input.
Method 2: Direct connection (3.3 V → 5 V)
If the 5 V part's VIH is lower than 3.3 V (74LS, 74HCT, some microcontrollers), you can connect a 3.3 V output directly to a 5 V input. But since the devices have different supplies, always share ground. Going from a 5 V output to a 3.3 V input cannot be connected directly.
Method 3: Level-shifter modules and ICs
For bidirectional communication (such as I2C) or many signals, using a dedicated part is safer.
| Approach | Characteristics | Use |
|---|---|---|
| N-channel MOSFET bidirectional (such as BSS138) module | Gate to 3.3 V, source to the 3.3 V side, drain to the 5 V side, with pull-ups on both sides. Bidirectional | I2C, general signals |
| Unidirectional buffer IC (such as 74AHCT125) | Lifts 3.3 V to 5 V logic levels | 3.3 V → 5 V signals (LED strips, and so on) |
| Bus transceiver (such as 74LVC245) | Supports supplies on both sides, multichannel | Parallel buses |
| Auto-direction shifter IC (such as TXB0108) | Detects direction automatically. Unsuited to lines with strong pull-ups | General digital signals |
Modular 4-channel level shifters are cheap and widely used by beginners. The connections are usually LV (3.3V), HV (5V), GND, and each channel's LVx and HVx.
Cautions with I2C
I2C is bidirectional open drain, so a resistor divider does not fit. When mixing 3.3 V and 5 V devices, use a MOSFET-type level shifter with pull-up resistors on both sides (I2C Wiring Basics). If a module that already has pull-ups is pulled up to 5 V, a 3.3 V device is at risk, so check the module's circuit.
Matching the supply voltage itself
- Do not supply 5 V directly to a 3.3 V part. To make 3.3 V from 5 V, use an LDO regulator (AMS1117-3.3, AP2112, and so on). Check the current you need and the heat from the input-output voltage difference (the same principle as Making 5V from a 9V Battery).
- If the board has a 3.3 V pin, small 3.3 V parts can take power from that pin (check the current limit).
Common damage cases
| Case | Cause |
|---|---|
| The ESP32 input pin fails | A 5 V signal was connected directly |
| A sensor does not recognize the signal | The 3.3 V High falls short of the 5 V chip's VIH |
| I2C communication fails intermittently | The pull-up supply voltage differs or the pull-up resistor is too large |
| The board is hot and unstable | 5 V was connected to a 3.3 V pin |
| One device resets for no reason | The grounds are not shared |
Selection summary
| Situation | Method |
|---|---|
| One-way output of a 5 V sensor → 3.3 V input | Resistor divider (1 kΩ + 2 kΩ) |
| 3.3 V output → 74LS, 74HCT, or AVR input | Direct connection (share ground) |
| 3.3 V output → 74HC (5 V) input | 74HCT or a level shifter |
| I2C, bidirectional signals | MOSFET level-shifter module |
| Many channels | A shifter IC |
Summary
Never connect 5 V directly to a 3.3 V input; do 5 V → 3.3 V with a resistor divider or shifter, and for 3.3 V → 5 V check the 5 V side's VIH and use a shifter if needed. Bidirectional lines such as I2C need a MOSFET-type shifter. To decide which board to use, Arduino Uno vs. ESP32 vs. Raspberry Pi Pico can help.