Logic Levels (3.3V vs 5V): Wiring and Common Errors
Share
Logic Levels (3.3V vs 5V): Wiring and Common Errors
Every digital signal is just a voltage read as HIGH or LOW, and the logic level is the voltage that counts as HIGH. 5V logic (Arduino Uno, Nano, Mega) reads anything above ~3V as HIGH. 3.3V logic (ESP32, Raspberry Pi, Pico, most sensors) reads anything above ~2V as HIGH — its pins must never be driven above ~3.6V.
Quick answer: A 5V output feeding a 3.3V input is the dangerous direction — it can latch or kill the pin, and needs a level shifter or voltage divider, non-negotiable. A 3.3V output feeding a 5V input often works directly, since 3.3V clears most 5V-logic HIGH thresholds, but test it rather than assume on critical pins.
Proof of work: the explanation below is Soldr's actual answer to "What is Logic Levels (3.3V vs 5V) and how do I use it?", asked through Soldr on 11 August 2026. Published 11 August 2026 · Last updated 11 August 2026.
Why does mixing 5V and 3.3V boards actually matter?
A 5V Arduino output pushing 5V into a 3.3V ESP32 pin is over-voltage — it can latch the pin, corrupt the chip, or kill it outright. The reverse direction is usually more forgiving: a 3.3V sensor feeding 3.3V into a 5V Arduino input usually still reads as HIGH, because 3.3V clears the roughly 3V threshold — so that direction is often fine, but "often" isn't "always," and testing beats assuming on a pin you can't afford to lose.
| Direction | Risk | Fix |
|---|---|---|
| 3.3V output → 5V input | Often works directly | Test it; don't assume on critical pins |
| 5V output → 3.3V input | Can damage the 3.3V pin | Level shifter or voltage divider — non-negotiable |
| I2C (SDA/SCL), mixed voltage | Garbage data, not damage | Almost always needs shifting on both lines |
| Analog signals | Signal distortion | Use a voltage divider or op-amp, never a digital level shifter |
How do you actually wire a level shifter between two boards?
The 2-Channel Logic Level Converter is the standard tool — no code required, bi-directional, and it handles the two I2C lines or any pair of signals. Wire HV to the 5V side, LV to the 3.3V side, ground the two sides together, and route each signal through one channel. If you're shifting up only — driving a 5V relay from a 3.3V ESP32, one direction only — the CD40109 IC does that specific job instead.
Why does my I2C sensor work but my display show garbage?
This is the classic mixed-voltage I2C symptom: SDA and SCL almost always need level shifting when one device is 5V and the other is 3.3V, and a sensor that "just barely" works unshifted can sit right at the edge of reliable while a display on the same unshifted bus shows corrupted characters. Add a 2-channel level converter on both I2C lines rather than debugging library settings first — it's the more common root cause than a software bug.
What do you need to try this yourself?
A 2-Channel Logic Level Converter (3.3V-5V) (Rs.48) for general bi-directional shifting, or a CD40109 CMOS Quad Low-to-High Voltage Level Shifter IC (Rs.73) if you only need to shift up (Soldr's session referred to this as "CD40109BE" — the catalog lists it as CD40109, the same part family).
Frequently asked questions
3.3V aur 5V logic mein kya fark hai?
Yeh dono alag voltage standards hain jo batate hain ki kaunsi voltage HIGH maani jayegi. 5V logic mein 3V se upar HIGH maana jata hai, aur 3.3V logic mein 2V se upar. Do alag logic-level boards ko seedha jodna khatarnak ho sakta hai, khaaskar 5V se 3.3V ki taraf.
Can I connect a 3.3V sensor directly to a 5V Arduino?
Often yes for a digital output, since 3.3V usually clears the 5V board's HIGH threshold - but test it rather than assume, especially on a pin you can't afford to damage. For I2C specifically, use a level shifter even in this direction, since I2C's pull-up behavior makes mixed-voltage buses less forgiving than a single digital pin.
What is the price of a logic level converter in India?
The 2-Channel Logic Level Converter (3.3V-5V) costs Rs.48 at Compoden, with cash on delivery available across India. The CD40109 one-direction shifter IC costs Rs.73. Prices checked 11 August 2026.
Can I use a level shifter for analog signals?
No - digital level shifters are built for clean HIGH/LOW logic transitions, not continuous analog voltages, and running an analog signal through one will distort it. For analog signals between voltage domains, use a voltage divider or an op-amp circuit instead.