Introduction
I²C is great, probably the simplest way to hook up peripherals to a microcontroller. You only need two connect two wires to the device you want to interface with - clock and data. These two wires are shared between all the I²C devices. To select a specific device to talk to, the 7 bit address is sent to all the devices on bus, those compare this address to their own and only the one with the same address becomes active. This way, it is possible to interface with up to 112 (2^7 minus 16 reserved addresses) I²C devices on one bus. Sounds like that's a lot, but what when you cannot use them all?While working on a new project, I stumbled upon a problem: I want to have a lot of the same I²C device on one bus. Well, usually the manufacturer of the peripheral ensures the possibility to select the address - or a part of the address - by offering one or more address select pins. There are a lot of different approaches on how to select the address:
- Tie the pin to GND or VCC (-> one address Pin doubles the amount of possible devices)
- Leave the pin open or use one of the above (-> one address Pin triples the amount of possible devices)
- Tie the pin SDA, SCL, GND or VCC (-> one address Pin quadruples the amount of possible devices)
- Tie the pin with a specific resistor to Ground (-> usually up to 4 or 5 possibilities)