Skip to content
MichaelMeissner edited this page Mar 12, 2020 · 30 revisions

I2C

  • I2C is a shared bus system that allows multiple devices to be hooked to a microprocessor.
  • Devices can either be the I2C master or slave.
  • Each I2C slave has an address it listens to. On some devices there are solder pads or pins that allow you to configure which I2C address is used.
  • An older Arduino I2C tutorial is at: (http://www.gammon.com.au/i2c).
  • I2C has 4 pins: Power, ground, SDA, and SCL.

Libraries

Pull-up resistors

  • On ARM based systems (Teensy LC, 3.2, 3.5, 3.6, and 4.0) you need to have 2 pull-up resistors on the I2C bus.
  • One resistor goes between the SDA pin and 3.3v power in parallel to the data connection(s).
  • One resistor goes between the SCL pin and 3.3v power in parallel to the data connection(s).
  • On I2C buses that support 5 volts, a common value for the pull-up resistors is 4.7K ohms. On I2C buses that are 3.3 volts only, a common value for the pull-up resistors is 2.2K ohms. However, complex I2C buses can need different values for the resistors.
  • Many I2C devices provide their own pull-up resistors.
  • You can have multiple pull-up resistors on the I2C bus, and generally they will work together. However, having multiple pull-up resistors can mean the devices might not be able to handle faster I2C bus speeds.
  • If no devices have pull-up resistors, I2C requests may hang.
Clone this wiki locally