Notes #3: Understanding I2C

Well, this topic may be a bit misleading.. I won’t explain how I2C works, because there are plenty of good tutorials out there already. Instead I’ve got some bullet points:

  • I2C is a 2-wire serial protocol. One wire is for the clock and one for the data.
  • One can add multiple devices on an I2C bus. Usually one device acts as master the others are slaves.
  • The master always initiates the communication.
  • Devices on the I2C bus are “open drain” (as opposed to “push pull”. Knowing the difference is key to understand how the bus’ lines can be bi-directional and how the transistor based level shifters operate).
  • Arduino has a library to handle I2C communication called Wire.
  • Arduino’s default clock speed for I2C is 100kHz, but this can be modified to 400kHz. (I did eventually succeed to do this even though the procedure is for an older version of the IDE.)
  • At 400kHz you’ll most likely need to add smaller pull-up resistors to get faster rise times. (It worked for me as-is, but the signal looked more lika a sawtooth than a square wave. Lowering the pull-up values fixed this.)

Alright. Then some links to I2C tutorials:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s