As we've been adding STEMMA QT connectors to our breakouts and dev boards, folks have been really enjoying the simplicity and speed of plugging in I2C sensors and devices for quick iteration and design. That's all good, but I2C wasn't really designed for hot-plugging. You're kinda supposed to have everything connected once on boot and never mess with it - I2C was specified for on-board connections. And, folks who have experimented with hot-plugging I2C devices eventually have discovered that if you plug in or unplug at the wrong moment you can cause the bus to hang due to an extra SCL pulse or an unexpected capacitive load.

The Adafruit TCA4307 Hot-Swap I2C Buffer breakout here solves that problem. It's specifically designed to take a non-hot-swap protocol (I2C) and protect the controller from wayward peripherals messing with the bus during attach/detach.

Usage is super simple. Connect the left side (IN) to your main board controller - Arduino, Raspberry Pi, Feather, etc. Then connect any I2C sensors you like to OUT side. Power is connected through - this isn't a power isolator, just a bus buffer. You can use 2.3 to 5.5V DC power and logic levels.

The chip can handle up to 400KHz I2C clock rates and even has stuck bus recovery: it automatically disconnects the bus if it detects either SDAOUT or SCLOUT are low for about 40 ms. Once the bus is disconnected, the device automatically generates up to 16 pulses on SCLOUT to attempt to reset the device which is holding the bus low.

There's also an extra ENable pin, if you want to disconnect the in and out sides, and a READY pin that will let you know if the peripheral is buffer-connected to the controller (and is safe to attempt communication).

To get you going fast, we spun up a custom-made PCB in the STEMMA QT form factor, making it easy to interface with. The STEMMA QT connectors on either side are compatible with the SparkFun Qwiic I2C connectors. This allows you to make solderless connections between your development board and the TCA4307 or to chain it with a wide range of other sensors and accessories using a compatible cableQT Cables are not included, but we have a variety in the shop

Power Pins

This breakout requires between 2.3V and 5.5V, and can be easily used with most microcontrollers from an Arduino to a Feather or something else. Power is connected through to both sides - this board is not a power isolator.

  • VCC - this is the power pin.  To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V
  • GND - common ground for power and logic

Logic Pins

  • SCL - I2C clock pin, connect to your microcontrollers I2C clock line. The logic level is the same as VCC.
  • SDA - I2C data pin, connect to your microcontrollers I2C data line. The logic level is the same as VCC.
  • STEMMA QT - These connectors allow you to connect to dev boards with STEMMA QT connectors or to other things with various associated accessories.

Other Pins

  • EN - This is the Enable input pin. Allows you to disconnect the in and out sides when pulled low
  • RDY - This is the Ready output pin. It will let you know if the peripheral is buffer-connected to the controller (and is safe to attempt communication).

Connecting up the TCA4307 is super simple. Simply include it between your microcontroller and your I2C sensor or breakout as shown below.

Here is how to wire it up using STEMMA QT:

  • Board 3V to TCA4307 in VIN
  • Board GND to TCA4307 in GND
  • Board SCL to TCA4307 in SCL
  • Board SDA to TCA4307 in SDA
  • TCA4307 out VIN to breakout VIN
  • TCA4307 out GND to breakout GND
  • TCA4307 out SCL to breakout SCL
  • TCA4307 out SDA to breakout SDA

Here is how to wire it up using a solderless breadboard:

  • Board 3V to TCA4307 in VIN
  • Board GND to TCA4307 in GND
  • Board SCL to TCA4307 in SCL
  • Board SDA to TCA4307 in SDA
  • TCA4307 out VIN to breakout VIN
  • TCA4307 out GND to breakout GND
  • TCA4307 out SCL to breakout SCL
  • TCA4307 out SDA to breakout SDA

Now you're ready to hot--swap your I2C breakout or sensor!

This guide was first published on Jul 17, 2021. It was last updated on 2021-07-17 16:00:09 -0400.