All articles

    Connecting 5 V to 3.3 V: Level Shifting Without Burning Anything

    How to connect a 5 V Arduino to an ESP32 or 3.3 V modules: a voltage divider for the 5 to 3.3 direction, when 3.3 V is enough for 5 V and when it isn't, the bidirectional BSS138 MOSFET module and how it works, I2C without a chip, the 74AHCT125 and TXS0108E chips, speed, a UART example, and common faults.

    Updated 6 min read

    The Arduino Uno runs on 5 V. But the ESP32 and many modern sensors and displays run on 3.3 V. If you connect them directly, you may burn the 3.3 V pins, or the signal may not be understood correctly.

    A 5 V signal passes through a level shifter and comes out at 3.3 V
    A 5 V signal passes through a level shifter and comes out at 3.3 V

    The first direction: 5 to 3.3 (the dangerous one)

    A 3.3 V pin can't withstand 5 V (unless the datasheet says it's 5 V tolerant).

    Inside most chips there are protection diodes from each pin to the supply. If you put 5 V on a pin of a 3.3 V chip, current flows through that diode into the 3.3 V supply. It may work for a few days and then the pin or the chip dies, or you'll find the 3.3 V rail rising by itself. That's why "it worked for me" doesn't mean it's safe.

    The simple fix: a voltage divider

    • A 1k resistor from the 5V to the pin, and 2k from the pin to ground → 5 × 2 ÷ 3 ≈ 3.33 V.
    • Excellent for one-way signals at moderate speed (such as the Uno's TX to the ESP32's RX).
    • Not suitable for very fast signals or for lines that go both ways.

    Why not 10k and 20k? Because the pin itself has a small capacitance, and with large resistors the signal rises slowly and the edges become sloped. Small values (1k and 2k, or 2.2k and 3.3k) let normal speeds through cleanly.

    The second direction: 3.3 to 5

    Here there's no risk of damage; the question is: will the 5 V side understand 3.3 as HIGH?

    • Chips with TTL-level inputs (minimum HIGH voltage about 2 V): 3.3 is enough.
    • 5 V CMOS chips (minimum HIGH voltage about 0.7 × VCC = 3.5 V): 3.3 isn't guaranteed.
    • The ATmega328P in the Uno usually reads 3.3 as HIGH in practice, but the datasheet doesn't guarantee it at 5 V, so the safer route is a level shifter.
    • A famous example: a WS2812 strip with an ESP32. It needs boosting.

    This figure is called VIH in the datasheet. See reading a datasheet.

    The bidirectional module (BSS138)

    The small blue module with 4 channels. Each channel is an N-channel MOSFET and two pull-up resistors:

    • Bidirectional, so excellent for I2C (SDA and SCL).
    • Connect LV to 3.3, HV to 5, and a common GND.
    • Relatively slow, so not ideal for fast SPI.
    One channel: a MOSFET between the two sides, the gate at 3.3, and a pull-up on each side
    One channel: a MOSFET between the two sides, the gate at 3.3, and a pull-up on each side

    How does it work?

    • Nobody pulls the line: the low side sits at 3.3 from its pull-up, and the gate is also 3.3, so the difference is zero and the MOSFET is off. The high side sits at 5 from its own pull-up.
    • The low side goes LOW: the source is now zero and the gate 3.3, so the MOSFET turns on and pulls the high side LOW.
    • The high side goes LOW: the MOSFET's internal diode pulls the source down to about 0.6 V, so the MOSFET turns on and completes the pull to zero.

    So whichever side pulls down, the other follows. That's exactly how I2C works: devices only pull the line LOW, and the pull-ups raise it.

    I2C without a chip?

    If every device on the bus reads 3.3 as HIGH, you can remove the pull-ups to 5 V (from the modules) and fit pull-ups to 3.3 only. Then the line never rises above 3.3, and the 5 V chip reads it as HIGH. But you must check VIH for every device, and make sure no module has resistors to 5 V. See troubleshooting I2C.

    Ready-made chips

    ChipUse
    74AHCT125 or 74HCT2453.3 to 5, one-way and fast (LED strips, SPI)
    TXS0108E8 bidirectional channels, but unsuitable with strong pull-ups such as I2C
    TXB0108For push-pull signals, not I2C

    The 74AHCT125 with an LED strip: the chip is powered from 5 V, and its inputs read 3.3 as HIGH (because it's from the HCT family). Connect the data from the ESP32 to the input, that channel's OE pin to ground, and the output delivers a clean 5 V to the strip.

    Speed

    MethodApproximate speedSuited to
    Voltage dividerUp to hundreds of kHzUART and simple signals
    BSS138About 400 kHzNormal I2C
    74AHCT125MegahertzSPI and WS2812

    Example: a 3.3 V UART module with an Uno

    FromToWhat's needed
    Uno TX (5 V)Module RX (3.3)A 1k and 2k divider
    Module TX (3.3)Uno RXUsually direct (the Uno reads 3.3)
    GNDGNDCommon

    That's exactly what's done with the HC-05.

    Tips

    • Always a common ground between the two sides.
    • Before anything, read the datasheet: some modules carry a regulator and a level shifter already (as many sensor modules do), so they connect to 5 V normally. See reading a datasheet.
    • If you're not sure, measure the voltage on the pin with a multimeter before connecting.
    • A single transistor as an amplifier inverts the signal (HIGH becomes LOW). It works, but you must invert in code or use two transistors.

    Common faults

    FaultUsual cause
    The signal gets through only sometimes3.3 is at the edge of the 5 V chip's VIH
    I2C doesn't work after the moduleLV and HV swapped, or no common ground
    The LED strip flickers wrong colours3.3 V data without boosting
    UART produces wrong characters at high speedThe divider resistors are too large
    The 3.3 V rail rises by itself5 V entering the chip through a pin

    FAQ

    Can the ESP32 take 5 V on its pins? No; officially its pins aren't 5 V tolerant. People try it and it works for them, but it's outside the specifications and shortens the chip's life.

    Can I power a 3.3 V module from the Uno's 3.3V pin? Yes, if its current is small (about 50 mA or less). Modules that draw more (such as an nRF24 with an amplifier) need their own regulator.

    Circuits Nerd
    © 2026 Circuits Nerd. All rights reserved.