Connecting 3.3 V and 5 V parts: when you need a level shifter

Never feed a 5 V output into a 3.3 V input pin without a level shifter or divider. The reverse direction is usually fine.

What the message means

ESP32 and Raspberry Pi pins are rated for 3.3 V. Many 5 V modules output 5 V, which can damage the input over time.

Fix it in this order

  1. List each signal and its direction: which side drives it.
  2. For a slow one-way 5 V to 3.3 V signal, a resistor divider such as 1 k and 2 k works.
  3. For I2C use a bidirectional shifter board with MOSFETs, and pull-ups on both sides.
  4. For fast signals such as addressable LEDs or SPI at high speed, use a proper buffer or shifter chip.
  5. Check whether the module has a 3.3 V option or is already 3.3 V tolerant.
  6. A 3.3 V output driving a 5 V input often works, but check the input threshold in the datasheet.

Why it happens

A 3.3 V board and a 5 V device can be damaged or can fail to talk if they are joined without care. The right shifter depends on the signal.

For I2C use a bidirectional MOSFET shifter. For one-way signals from a 3.3 V board to a 5 V input, a buffer such as the 74AHCT125 works. A resistor divider is fine for slow one-way signals going from 5 V down to 3.3 V, such as the HC-SR04 Echo line.

If you see this, do this

You seeDo this
5 V output to ESP32 inputDivider or shifter.
I2C between 3.3 V and 5 VBidirectional shifter.

Pi GPIO levels, MPU6050 logic level, HC-SR04 echo divider.

Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.

Why this happens

A GPIO input compares the pin voltage with thresholds that scale with the chip’s own supply. A 3.3 V chip is built for inputs up to about its supply voltage; the protection diodes on the pin start to conduct when the input goes above that, and the current they pass is limited only by whatever drives the pin. That is why a 5 V output can seem to work for a while and still shorten the life of the input.

The other direction depends on thresholds, not damage. A logic-high input on a 5 V CMOS part is often specified as 0.7 times its supply, which is 3.5 V, so a 3.3 V output falls short. A TTL-style input (the 74HCT family, for example) accepts about 2 V as high, so 3.3 V works. WS2812-type LEDs are a common surprise: at a 5 V supply they expect roughly 3.5 V for a high, so a 3.3 V data pin can be unreliable.

How to confirm the cause

  • Write down each signal, its direction and the supply of the receiving chip. Only the receiver’s supply and its input thresholds matter.
  • Measure the sender’s high level with a multimeter on the actual wire. A pin that should read 3.3 V but reads 2.8 V is loaded or weak.
  • Look up the receiver’s input-high minimum (VIH) in its datasheet and compare it with your measured high. If VIH is above what you measure, you need a shifter or a buffer.
  • For a divider, measure the output with the sender idle high. It must be at or below the 3.3 V limit of the pin.
  • For I2C, look at SDA and SCL with a scope or logic analyser if you have one: slow rising edges mean the pull-ups are wrong, not the shifter.

Worked example

A resistor divider for a slow 5 V to 3.3 V signal, using 1 k on the top and 2 k to ground:

Vout = Vin x R2 / (R1 + R2)
      = 5.0 x 2000 / (1000 + 2000)
      = 3.33 V

Source current when high = 5.0 / 3000 = 1.7 mA
With 10 k and 20 k the current drops to 0.17 mA,
but the edges get slower because the pin capacitance
must charge through the larger resistance.

Common mistakes

  • Using a divider on I2C. I2C lines are bidirectional, so a one-way divider breaks the other direction.
  • Dividing a fast signal such as high-speed SPI or an LED data line with large resistors; the rounded edges cause errors.
  • Powering one side of a shifter board from the wrong rail. The low-voltage pin (often marked LV) goes to 3.3 V and the high-voltage pin (HV) to 5 V.
  • Forgetting that grounds of both boards must be joined.
  • Assuming 5 V tolerant pins exist on every 3.3 V chip. Some do, many do not; read the datasheet for that exact pin.

If this did not fix it

  • A missing common ground between the two boards, which gives random readings even with a good shifter.
  • Pull-up resistors on I2C that are too weak or doubled up by several modules.
  • A signal that is too fast for a divider, which needs a buffer or a dedicated shifter chip instead.