When people need to communicate with each other, we use language. If two people speak the same language, they can talk all they want about all sorts of topics. If they don't speak the same language, communication is difficult. Likewise, electronic parts need to communicate - and they also have their own languages. There are a few common languages that are spoken. The most popular ones are TTL Serial, SPI, I2C, I2S, 1-Wire, and Parallel (such as 8080 or 6800). Of these, Parallel and SPI can 'share a bus' using a select line - multiple devices can share the pins as long as they have a single pin that can be used to indicate who is permitted to speak at one time. 1-Wire and I2C are true shared-bus protocols - you can have 100+ components all talking at once using the same 2 wires (for I2C) or 1-wire (for the aptly-named 1-wire). 1-Wire is much slower than I2C and is a strongly-patented protocol owned by Maxim so you won't see a lot of devices out there other than Maxim/Dallas parts that use 1-wire.

I2C - Inter-Integrated Circuit communications!

This guide doesn't cover the nitty-gritty details of I2C, other than to note that you can connect multiple I2C devices (often referred to as "I2C slaves") to a single I2C controller (a.k.a "I2C master") using only two wires.

For example, in this diagram, one Metro (e.g. Arduino compatible) connects to 5 devices.

In general, you can only have one controller and up to 127 devices. (There are exceptions such as multi-master and 10-bit address devices but they are so rare and we've never seen them in practice)

I2C is incredibly popular because it uses only 2 wires, and like we said, multiple devices can share those wires, making it a great way to connect tons of sensors, drivers, expanders, without using all the microcontroller pins. The only bad news about I2C is that each I2C device must have a unique address - and the addresses only range from 0 to 127 (aka 0 to 0x7F hex). One thing this means is that if you have two accelerometers (lets say) and they both have address 0x22 you cannot have both of them on the same I2C lines.

There are a few work-arounds:

  • One is you might be able to power down or 'de-select' one sensor or another at a time.
  • Another is that some boards have an address-select line or jumper or other configuration. If you can set one to a different address you're good to go.
  • Some devices have a software-reprogrammable address, where they come up as one address on boot but can be told to change address. Oftentimes, the new address is forgotten on reboots, so you have to de-power all the other similarly-addressed devices while you do so.
  • You can use an I2C multiplexer like the TCA9548A which will let you use one I2C address to talk to the multiplexer and tell it which lane you want to enable

Since we deal with so many I2C devices we thought it would be handy to have a table with all the most common sensors and modules we encounter, and their I2C address!

Continue onto the next page to see our current list

Last updated on 2017-07-29 at 11.22.36 PM Published on 2017-07-29 at 11.24.53 PM