User Tools

Site Tools


tutorials:library:i2caddr.html

This is an old revision of the document!


Introdution

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 - mulitple 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 is incredibly popular beccause 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 (0 to 0x3F 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.

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!

Address table

These addresses are in 7-bit notation (which is what the Arduino uses). Some systems want 8-bit notation, in which case you should multiply the address by 2.

If multiple address are supported, all of them will be indicated.

This table is absolutely not guaranteed to be correct, and is offered 'as is'

Type Part # Notes Address Address Address Address Address Address Address Address
OLED SSD1306 One addr pin 0x3C 0x3D
NFC/RFID PN532 0x48
Sensor TSL2561 1 tri-state addr pin 0x29 0x39 0x49
Sensor BMP085 Can use XCLR to select/deselect 0x77
Sensor ADXL345 1 address pin 0x1D 0x53
Sensor HMC5883L 0x1E
Sensor BMA180 0x40 0x41
Sensor MMA7455L Same as ADXL345 0x1D
Sensor VCNL4000 0x13
Sensor ITG3200 0x68 0x69
Sensor MS5607 Same as MS5611 0x76 0x77
Sensor MS5611 Same as MS5607 0x76 0x77
RTC DS1307 Same as DS3231 0x68
RTC DS3231 Same as DS1307 0x68
I/O MCP23008 3 addr pins 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27
I/O MCP23017 3 addr pins 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27

We'll update this with more as we use other chips!

/home/ladyada/public_html/wiki/data/attic/tutorials/library/i2caddr.html.1335899212.txt.gz · Last modified: 2016/01/28 18:05 (external edit)