{"product_id":"adafruit-ltc4316-i2c-address-translator-stemma-qt-qwiic","title":"Adafruit LTC4316 I2C Address Translator","description":"\u003cp\u003eOn the fly address translation for I2C devices!\u003c\/p\u003e\n\u003cp\u003eAdafruit has hundreds of designs that use I2C - a two-wire protocol that can let you quickly connect sensors, OLEDs, GPIO expanders, and more.\u003cspan\u003e \u003c\/span\u003e\u003ca href=\"https:\/\/learn.adafruit.com\/working-with-i2c-devices\"\u003eFolks love I2C because you can simply connect 4 wires for power and data, and even better, share those wires with multiple devices\u003c\/a\u003e!\u003c\/p\u003e\n\u003cp\u003eOne things folks\u003cspan\u003e \u003c\/span\u003e\u003ci\u003edon't like \u003c\/i\u003eabout I2C is that each device requires it's own unique 'address'. You can only have one device with a 0x20 address, for example, so while in theory you could have up to 127 device, each for the 7-bits of address space available, in reality you will quickly bump into two sensors with the same address. Many I2C components have jumpers or switches that allow changing the address, but not all. And some only let you pick between two values.\u003cspan\u003e \u003c\/span\u003e\u003ca rel=\"noopener\" href=\"https:\/\/shop.pimoroni.com\/search?q=i2c%20multiplexer\" target=\"_blank\"\u003eOne solution is to use an I2C multiplexer\u003c\/a\u003e,  and these work pretty well, but they\u003cspan\u003e \u003c\/span\u003e\u003ca href=\"https:\/\/learn.adafruit.com\/working-with-i2c-devices\/address-conflicts\"\u003erequire some noodling in your code to set up the 'plexer and then switch between the devices being plexed\u003c\/a\u003e.\u003c\/p\u003e\n\u003cp\u003eThe\u003cstrong\u003e\u003cspan\u003e \u003c\/span\u003eAdafruit LTC4316 I2C Address Translator\u003cspan\u003e \u003c\/span\u003e\u003c\/strong\u003eis another solution, with some magic sprinkled inside. This chip does \u003cem\u003eon the fly address translation\u003c\/em\u003e. There's an 'input I2C' half, and an 'output I2C' half. And any devices on the 'output' half will automatically have their addresses translated from the input half. Specifically, each device will have bit A6 flipped  (most-significant-bit of the address) and then bits A4 and A5 can also be flipped or kept the same, with the two DIP switches on board. To determine the translated address, we use XOR bitwise math.\u003c\/p\u003e\n\u003cp\u003eOK that's a little confusing so let's work through an example. Say we have an AHT20 connected on the output side of this breakout. The AHT20 does not have an adjustable I2C address: it's fixed at 0x38. If both DIP switches are ON, then only A6 is flipped. That means the I2C controller on the input side will see\u003cspan\u003e \u003c\/span\u003e\u003cstrong\u003e0x38 XOR 0x40 = 0x78\u003c\/strong\u003e\u003cspan\u003e \u003c\/span\u003eaddress. If we flip the A5 switch off, now it will be \u003cstrong\u003e0x38 XOR 0x60 = 0x58\u003cspan\u003e \u003c\/span\u003e\u003c\/strong\u003eand if both switches are off, now bits A4, A5 and A6 will be flipped, so \u003cstrong\u003e0x38 XOR 0x70 = 0x48.\u003c\/strong\u003e As far as the AHT20 is concerned, it will happily still see I2C writes and reads on 0x38, but from the I2C controller's perspective, the device is responding on the new address.\u003c\/p\u003e\n\u003cp\u003eIf you need\u003cstrong\u003e \u003c\/strong\u003emore than 4 address translation options (two switches give you 4 options) we also have a spot where you can solder an XOR_LOW resistor for setting the 'bottom' 3 bits by soldering in a resistor value according to the datasheet. It can get confusing quickly so we definitely recommend using an I2C scanner to debug. Note also that you have to reset the LTC if you change the translation address with resistors or the DIP switches: the translation value is picked up on chip boot and isn't on-the-fly adjustable without a toggle of the Enable pin.\u003c\/p\u003e\n\u003cp\u003eWhile this chip is magical, there's a few things to watch for: it doesn't seem to support clock-stretching so\u003cspan\u003e \u003c\/span\u003e\u003ca href=\"https:\/\/learn.adafruit.com\/working-with-i2c-devices\/clock-stretching\"\u003enot for funky chips like BNO055\u003c\/a\u003e. Just because you can change the address on the fly, doesn't mean the drive supports it! Some firmware is expecting a specific address and it may not be trivial to change the address. Check the driver to make sure you know how to change the address, to the new value.\u003c\/p\u003e\n\u003cp\u003eTo get you going fast, we spun up a custom-made PCB in the\u003ca rel=\"noopener\" href=\"\/en-us\/collections\/stemma-qt\" title=\"STEMMA QT form factor\" target=\"_blank\"\u003e \u003cstrong\u003eSTEMMA QT\u003c\/strong\u003e form factor\u003c\/a\u003e, making it easy to interface. The \u003ca href=\"https:\/\/learn.adafruit.com\/introducing-adafruit-stemma-qt\/what-is-stemma-qt\"\u003eSTEMMA QT connectors\u003c\/a\u003e on either side are compatible with the \u003ca href=\"https:\/\/www.sparkfun.com\/qwiic\"\u003eSparkFun Qwiic\u003c\/a\u003e I2C connectors. This allows you to make solderless connections between your development board and the LTC4316 or to chain it with a wide range of other sensors and accessories using a \u003ca rel=\"noopener\" href=\"\/en-us\/products\/jst-sh-cable-qwiic-stemma-qt-compatible\" target=\"_blank\"\u003e\u003cstrong\u003ecompatible cable\u003c\/strong\u003e\u003c\/a\u003e. \u003ca rel=\"noopener\" href=\"\/en-us\/products\/jst-sh-cable-qwiic-stemma-qt-compatible\" target=\"_blank\"\u003e\u003cstrong\u003eQT Cable is not included\u003c\/strong\u003e, but we have a variety in the shop\u003c\/a\u003e. \u003c\/p\u003e\n\u003ch2\u003eTechnical Details\u003c\/h2\u003e\n\u003cp\u003eProduct Dimensions: 25.2mm x 17.7mm x 5.8mm \/ 1.0\" x 0.7\" x 0.2\"\u003c\/p\u003e\n\u003cp\u003eProduct Weight: 1.9g \/ 0.1oz\u003c\/p\u003e\n\u003ch2\u003eLearn\u003c\/h2\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https:\/\/learn.adafruit.com\/adafruit-ltc4316-i2c-address-translator\"\u003ePrimary Guide: Adafruit LTC4316 I2C Address Translator\u003c\/a\u003e\u003c\/li\u003e\n\u003cli\u003e\u003ca href=\"https:\/\/learn.adafruit.com\/working-with-multiple-i2c-devices\"\u003eWorking with Multiple Same Address I2C Devices\u003c\/a\u003e\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"Adafruit","offers":[{"title":"Default Title","offer_id":56500169081205,"sku":"ADA5914","price":7.46,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0389\/1025\/files\/5914-01.jpg?v=1766148623","url":"https:\/\/wholesale.pimoroni.com\/en-us\/products\/adafruit-ltc4316-i2c-address-translator-stemma-qt-qwiic","provider":"Pimoroni Wholesale","version":"1.0","type":"link"}