I2C/The two wires/5 V and 3.3 V
Lesson 12 of 12 · in 3D and VR

5 V and 3.3 V

A 5 V module's pull-ups hold the line at 5 V, which is on the ESP32's pins every time the line is a one. A one-transistor level converter gives each side its own wire at its own voltage.

Lonely BinaryUpdated 2026-09-274 min readNo board required

View it in VR

Lesson 12 of the I2C course opens in a VR headset, on a table in front of you, and a voice starts three seconds after you arrive. Type this short address into the browser on a headset such as Meta Quest or Apple Vision Pro, and press Enter VR. No headset? Press Start the lesson: the same lesson, full screen.

learn.lonelybinary.com/vr/i2c/12

Some I2C modules run at 5 V, and their pull-up resistors go to 5 V. Wire one straight to an ESP32 and every released line sits at 5 V, on the ESP32's pin. Espressif's datasheet allows an input no higher than the chip's supply plus 0.3 V, which on 3.3 V is 3.6 V. Five volts is over that every time the line is a one.

The fix is a level converter between them, and for I2C it is the one-transistor kind: an N-channel MOSFET on each line, gate on the 3.3 V supply, with a pull-up on each side to that side's own supply.

On the bench, a 5 V pull-up is a taller tank. Wired straight, it fills the glass past the red line the ESP32's pin allows. With the converter fitted, each side has its own glass and its own tank, and the transistor is a valve between them at the bottom.

How one transistor passes a zero both ways

  • The ESP32 pulls its side down. The transistor's gate is at 3.3 V and its source now at 0 V, so it turns on and pulls the 5 V side down too.
  • The module pulls its side down. The transistor's built-in diode drags the 3.3 V side low enough to turn the transistor on, and it follows the rest of the way.
  • Nobody pulls. Each side's pull-up takes it to its own supply: 3.3 V for the ESP32, 5 V for the module.

Herman Schutte, one of the two engineers behind I2C, published the circuit at Philips in 1997, in application note AN97055. Our converter board uses a BSS138 on each channel with a 10 kΩ pull-up on each side.

Which converter

Not every level converter suits I2C. The TXB0108 drives its outputs itself and fights the pull-ups; Texas Instruments says not to use it on I2C. The logic level converter handbook compares the boards and says which to use for what.

Edit this page — content/fundamentals/i2c/five-volts-and-three.mdx

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Fundamentals on the forum →