CP/PC364 Data Communications & Networks Laboratory
I2C communication with the Arduino
The I2C (Inter-Integrated Circuit) protocol is used for communication between many devices. It is more complicated than either UART or SPI, because it allows several devices to share a common bus, but it it useful for this same reason.
The objectives for this lab are:
- to learn how to use the Arduino I2C interface
- to connect one I2C digital sensor for proper operation
- to write a test sketch to show the I2C digital sensor in operation
BackgroundThe I2C (Inter-Integrated Circuit) communication protocol allows several device to communicate using only two wires. One device acts as a master, and all of the other devices are slaves. The Arduino board has an The I2C bus built-in so it can be used to study I2C communications.
- bench supply, oscilloscope
- breadboard, debugger board, resistors, capacitors
- one I2C device
- From the Arduino documentation, what pins are used for I2C communication?
- The I2C device lines need pull-up resisors. Does the Arduino have internal pull-up resistors or will you need to add them externally? If the latter, what values will you need?
- Consult the data sheet for the device to figure out how
to wire it up.
What is the address of the device?
- Create a sketch to communicate with the device, using the
LCD for display.
Hint: Look online: There are lots of examples out
Demonstrate your circuit to the lab supervisor.