Wire (I2C)

Pins (I2C)

These pins are used via the Wire object.

  • SCL => D1
  • SDA => D0

Gen 3 Devices (nRF52) (B-Series SoM, Tracker SoM, Tracker One, Boron, Argon, and E404X):

On the Argon/Boron/Xenon, D0 is the Serial Data Line (SDA) and D1 is the Serial Clock (SCL). Additionally, there is a second optional I2C interface on D2 and D3 on the Argon and Xenon only.

Both SCL and SDA pins are open-drain outputs that only pull LOW and typically operate with 3.3V logic. Connect a pull-up resistor (1.5k to 10k) on the SDA line to 3V3. Connect a pull-up resistor (1.5k to 10k) on the SCL line to 3V3. If you are using a breakout board with an I2C peripheral, check to see if it already incorporates pull-up resistors.

Note that unlike Gen 2 devices (Photon/P1/Electron), Gen 3 devices are not 5V tolerant.

Tracker

The Tracker SoM allows an alternate mapping of the Wire (I2C interface) from D0/D1 to RX/TX. The Wire3 interface allows you to use RX as SDA and TX as SCL. You cannot use Wire3 and Serial1 at the same time. Likewise, you cannot use Wire and Wire3 at the same time, as there is only one I2C peripheral, just different pin mappings.

This is primarily use with the Tracker One as TX/RX are exposed by the external M8 connector. By using Wire3.begin() you can repurpose these pins as I2C, allowing external expansion by I2C instead of serial.

Argon and B-Series SoM

Additionally, on the Argon and B-Series SoM there is a second I2C port that can be used with the Wire1 object. This a separate I2C peripheral and can be used at the same time as Wire.

  • SCL => D3
  • SDA => D2


Gen 4 Devices (RTL872x) (P2, Photon 2, and M-SoM):

On the P2 and Photon there there is a single I2C port, D0 is SDA and D1 is SCL.

Both SCL and SDA pins are open-drain outputs that only pull LOW and typically operate with 3.3V logic. Connect a pull-up resistor (1.5k to 10k) on the SDA line to 3V3. Connect a pull-up resistor (1.5k to 10k) on the SCL line to 3V3. If you are using a breakout board with an I2C peripheral, check to see if it already incorporates pull-up resistors.

Note that unlike Gen 2 devices (Photon/P1/Electron), the P2 and Photon 2 are not 5V tolerant.

The P2 does not contain internal strong pull-up resistors on D0 and D1, unlike the P1.


Gen 2 Devices (STM32) (E-Series, Electron, Photon, and P2; does not include E404X):

On the Gen 2 devices (Photon, P1, Electron, E-Series), D0 is the Serial Data Line (SDA) and D1 is the Serial Clock (SCL).

Additionally on the Electron, there is an alternate pin location for the I2C interface: C4 is the Serial Data Line (SDA) and C5 is the Serial Clock (SCL).

Both SCL and SDA pins are open-drain outputs that only pull LOW and typically operate with 3.3V logic, but are tolerant to 5V. Connect a pull-up resistor(1.5k to 10k) on the SDA line to 3V3. Connect a pull-up resistor(1.5k to 10k) on the SCL line to 3V3. If you are using a breakout board with an I2C peripheral, check to see if it already incorporates pull-up resistors.

On the P1, there are 2.1K hardware pull-up resistors inside the P1 module.

Electron

Additionally on the Electron, there is an alternate pin location for the I2C interface, which can be used via the Wire1 object. This alternate location is mapped as follows:

  • SCL => C5
  • SDA => C4 Note that you cannot use both Wire and Wire1. These are merely alternative pin locations for a single hardware I2C port.