Category:I2C
From bildr
Inter-Integrated Circuit (I²C pronounced I- Squared- C) is a 2 wire serial bus typically used to communicate with sensors and other small components.
The two lines of the I2C bus are SDA (Data) and SLC (clock) which can be run in parallel to communicate with several devices at once. I2C allows up to 112 "slave" (such as a sensor) devices to be controlled by a single "master" (such as a Microcontroller). Each slave device on the bus must have it's own unique address so the master can communicate directly with the intended device. These addresses are typically hard-coded into the slave device, but often allow it to be changed by simply pulling one of the pins of the sensor high or low. This allows more than one of the same device to be on the same bus without conflicting addresses.
I2C is often referred to as TWI or 2-wire-serial
Contents |
Advantages of I2C Over Analog Devices
Beginning hobbyists and alike often look for sensors that have an analog output because of the ease of communicating with them, and will often stay away from I2C devices because of the perceived complexity. But the advantages of I2C can significantly outweigh the learning curve. Because I2C is a digital serial device, the slaves send back literal information, and not a voltage that needs to be interpreted. So a thermometer reports back 37.05º, not 2.4 volts. This also means an I2C device can communicate with a much higher precision, and are not limited by the masters ADCs resolution (often just 10bit). The MLX90614 IR thermometer for instance samples with 17bit resolution, 128x more precise than if it just had the simpler analog output.
The ability to have 112 slaves devices on a single bus is also a great advantages as many microcontrollers have limited analog input pins. An analog 3 axis accelerometer for instance would, on its own, require 3 analog pins to be able to read each value.
How it works
The slave devices hold information in a memory bank at a specific address (not to be confused with the slave’s address on the I2C bus). A 3 axis accelerometer for instance may hold the x value at 0x47, the Y at 0x48, and the Z at 0x49. The master communicates with this slave and requests the value stored in a specific memory address.
One of the disadvantages is that without reading a components documentation, there is no way to know where the value are stored.
Pins
I²C is a 2-wire serial connection, SDA (Data) and SLC (clock) - Many Microcontrollers have the ability to communicate via I²C even though their pins may not be marked as such. The following is a list of microcontrollers and their I²C connection locations.
- Arduino (non mega)
- SDA: Analog 4
- SCL: Analog 5
- Arduino Mega
- SDA: Digital 20
- SCL: Digital 21
SMBus
SMBus is a subset of I²C that defines stricter electrical and protocol conventions. One purpose of SMBus is to promote robustness and interoperability. Accordingly, modern I²C systems incorporate policies and rules from SMBus, and the line between these two standards is often blurred in practice.
External Links
Reference
This page is an Article on bildr. Articles are pages that define or explain a concept, method, or generic item.
Pages in category "I2C"
The following 15 pages are in this category, out of 15 total.
38C |
DFI |
ST |