Difference between revisions of "I2C"

From Advanced Projects Lab
Jump to: navigation, search
 
Line 4: Line 4:
  
 
== I2C v SPI v Serial ==  
 
== I2C v SPI v Serial ==  
There are two other main communication protocols that are still in use, SPI and Serial. Serial uses just 2 connections RX, and TX. These two lines will exchange all the necessary information. They also have to agree on the time before they can accurately communicate, this is what is called the Baud rate. For two serial devices to communicate their Baud rates need to be close or identical. This limits the
+
There are two other main communication protocols that are still in use, SPI and Serial. Serial uses just 2 connections RX, and TX. These two lines will exchange all the necessary information. They also have to agree on the time before they can accurately communicate, this is what is called the Baud rate. For two serial devices to communicate their Baud rates need to be close or identical. This can lead to errors when hooking up serial devices. SPI works by connecting 4 wires between master and slave. These four wires can send and receive data at very high speeds and they include a clock wire that allows for synchronized communications without having to preset the clocks on either device. The draw back to SPI is that for each new device that connects to the master a new wire needs to be directly connected to the master. This can be cumbersome for multiple devices and is only really used to 1 to 1 or 1 to a few connections. I2C is a compromise of these two systems. I2C uses only two wires and with those two wires you can connect up to 1008 devices! Additionally I2C is synchronized so no worrying about baud rates. In terms of speed I2C is slower than SPI but faster than serial. The slow do for I2C is due to saving space and connections by funneling all the data down one line. Still though I2C is quite fast, clocking in at either 100kHZ or 400kHZ (for standard set ups) which is fast enough for many purposes and certainly fast enough for equipment in this lab.

Latest revision as of 11:45, 16 March 2017

Note: This guide was adapted from sparkfun their guide is much more comprehensive and provides more context than what is in this guide. However, it is a bit higher level than one would need to work on projects for this lab.

I2C is a communications protocol used to connect chips inside of a device. What that means is that I2C is the rules for how the chips talk to each other. Usually there is one or more master chips that collect information from "slave" chips and also send instructions to the slave nodes.

I2C v SPI v Serial

There are two other main communication protocols that are still in use, SPI and Serial. Serial uses just 2 connections RX, and TX. These two lines will exchange all the necessary information. They also have to agree on the time before they can accurately communicate, this is what is called the Baud rate. For two serial devices to communicate their Baud rates need to be close or identical. This can lead to errors when hooking up serial devices. SPI works by connecting 4 wires between master and slave. These four wires can send and receive data at very high speeds and they include a clock wire that allows for synchronized communications without having to preset the clocks on either device. The draw back to SPI is that for each new device that connects to the master a new wire needs to be directly connected to the master. This can be cumbersome for multiple devices and is only really used to 1 to 1 or 1 to a few connections. I2C is a compromise of these two systems. I2C uses only two wires and with those two wires you can connect up to 1008 devices! Additionally I2C is synchronized so no worrying about baud rates. In terms of speed I2C is slower than SPI but faster than serial. The slow do for I2C is due to saving space and connections by funneling all the data down one line. Still though I2C is quite fast, clocking in at either 100kHZ or 400kHZ (for standard set ups) which is fast enough for many purposes and certainly fast enough for equipment in this lab.