Table of contents
  1. Why it is a problem
  2. Checking the input threshold voltage
  3. Method 1: Resistor divider (5 V → 3.3 V, one direction)
  4. Method 2: Direct connection (3.3 V → 5 V)
  5. Method 3: Level-shifter modules and ICs
  6. Cautions with I2C
  7. Matching the supply voltage itself
  8. Common damage cases
  9. Selection summary
  10. Summary

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).

PartMinimum voltage read as High at a 5 V supply (approx.)Can it take a 3.3 V signal
74LS (TTL)2.0 VYes
74HCT2.0 VYes
74HCAbout 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Ω.
ProsCons
Simple with two partsOnly one direction; the waveform dulls on fast signals (RC of the resistors and input capacitance)
Almost no costVoltage 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.

ApproachCharacteristicsUse
N-channel MOSFET bidirectional (such as BSS138) moduleGate to 3.3 V, source to the 3.3 V side, drain to the 5 V side, with pull-ups on both sides. BidirectionalI2C, general signals
Unidirectional buffer IC (such as 74AHCT125)Lifts 3.3 V to 5 V logic levels3.3 V → 5 V signals (LED strips, and so on)
Bus transceiver (such as 74LVC245)Supports supplies on both sides, multichannelParallel buses
Auto-direction shifter IC (such as TXB0108)Detects direction automatically. Unsuited to lines with strong pull-upsGeneral 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

CaseCause
The ESP32 input pin failsA 5 V signal was connected directly
A sensor does not recognize the signalThe 3.3 V High falls short of the 5 V chip's VIH
I2C communication fails intermittentlyThe pull-up supply voltage differs or the pull-up resistor is too large
The board is hot and unstable5 V was connected to a 3.3 V pin
One device resets for no reasonThe grounds are not shared

Selection summary

SituationMethod
One-way output of a 5 V sensor → 3.3 V inputResistor divider (1 kΩ + 2 kΩ)
3.3 V output → 74LS, 74HCT, or AVR inputDirect connection (share ground)
3.3 V output → 74HC (5 V) input74HCT or a level shifter
I2C, bidirectional signalsMOSFET level-shifter module
Many channelsA 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.

This article is general guidance for learning purposes. Specifications and pinouts differ between parts, so check the datasheet of the part you use before real work. For safety-related work, read the cautions for each item first.