MyRoboPath
electronics10 min readUpdated 2026-03-01Beginner

Logic Level Shifting: Interfacing 3.3V Microcontrollers & 5V Sensors

Avoid blowing up 3.3V ARM/ESP32 inputs when talking to 5V legacy sensors using MOSFET-based bidirectional level shifters and TXS0108E ICs.

Dr. Evelyn Carter
Dr. Evelyn Carter
Hardware Systems Lead

Key Engineering Takeaways

  • Applying 5V directly to standard 3.3V ESP32/STM32 GPIO pins will forward-bias internal ESD diodes and destroy the silicon pin cell.
  • I2C buses require open-drain bidirectional shifters because slave and master both pull the SDA/SCL lines low.
  • Use TXS0108E for open-drain buses (I2C) and TXB0108 for push-pull high-speed buses (SPI/UART).
Prerequisites
  • Basic electronics

Why Logic Levels Matter: Understanding Thresholds

Digital logic is not just 0 and 1—it is defined by precise voltage thresholds: - $V_{\text{IH}}$ (Minimum High-Level Input): Lowest voltage guaranteed to be recognized as Logic 1. - $V_{\text{IL}}$ (Maximum Low-Level Input): Highest voltage guaranteed to be recognized as Logic 0. When a 5V Arduino Uno sends a 5V HIGH signal to a 3.3V ESP32, the excessive voltage attempts to dump current through the internal clamp diode into the 3.3V supply rail, causing microcontroller overheating or permanent latch-up.
Tags:#Logic Levels#Level Shifter#3.3V#5V#BSS138#I2C Bus