I have looked through several documents, but I haven't find found a clear answer which pins on ESP32 support I2C communication.

Can the I2C be routed to almost any I/O pins?

Are there certain pins which support I2C?

  • \$\begingroup\$ Are you familiar wit the terms SCL and SDA as the signals comprising an I2C bus? Pretty much any ESP32 pin diagram shows these. Granted, you may also be able to implement I2C in software, aka "bit bang" it using undedicated pins, but generally the pins connected to the I2C peripheral engine should be your first choice unless there is a compelling reason why they cannot be used. \$\endgroup\$ Nov 24, 2019 at 17:31
  • 2
    \$\begingroup\$ @ChrisStratton the ESP32 has an IO_mux and a GPIO_matrix that allow almost any port/function to be remapped to different pins, so his question makes sense, as most of the Arduinos/NodeMCU/MicroPython tutorials and pinout pictures indicate as if there was a fixed pin for each of the functions. \$\endgroup\$
    – jDAQ
    Nov 25, 2019 at 5:05

1 Answer 1


According to Section 4.2 the ESP32 datasheet, any GPIO pin can be configured as an I2C pin. There are two I2C interfaces (I2CEXT0 and I2CEXT1), and they can operate in either master or slave mode at up to 400kHz. Just make sure you don't use any pins that your module uses for another purpose. For instance, some ESP32 modules have status LEDs or external level-shifting circuitry.

As mentioned by @jDAQ, the IO_mux and GPIO_matrix registers can be used to "rewire" the peripherals.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.