I2C meetup with Dan Hienzsch

In March, we were lucky to host Dan Hienzsch from Rheingold Heavvy in our meetup.

I2C is about communication between multiple components. Dan provided a number of examples how I2C applies to the usage of the real-time clock, a temperature sensor or a display.

Dan explained how he designed the I2C and SPI Education Shield. First, we got insights into PCB design and some common calculations when designing I2C signal lines on a PCB. A good place to learn about these things is ContextualElectronics.

After a better feeling for signal physics, we had discussions about pins for I2C on Arduino and the code in the Arduino Wire Library. For I2C, the internal pull-up resistors are enabled by default, so it is important to check if they must be disabled or not. If there are pullup resistors on the circuit board, disable the internal pull up resistors.

Then here is addressing of nodes on the bus. Many components have their I2C address hardcoded by the manufacturer, but some components can be configured to take a certain address by so-called “configuration pins”. The address is always listed in the datasheet for the component for reference.

When it comes to sending addresses, there is the question about timing of bits. I2C has a clock line (SCL), and a data line (SDA). A bit is clocked in from the data line during the full pulse of the clock. Transitions between high and low on the data line must happen between clock pulses.

Signals on the SCL and SDA lines follow certain rules. And Dan taught us a number of them. First, components (= slaves) on the bus can be idling in the Free State. To announce a new message, the master pulls the SDA line LOW to create the Start Condition. Then comes the address, and then, whether the master expects to READ data, or to WRITE data to the slaves.

After the R/W bit, the master listens for an acknowledgement from the slave component that everything was understood. This is the ninth bit, the ACK/NACK bit. With I2C it is often necessary to write data first, before data is read. This, and the fact that every message frame contains some address bytes, make I2C communication inefficient.

With only 2 signal lines, I2C is easy to debug however and great for learning more about advanced electronic communication. And the I2C and SPI Education Shield will provide a great learning device, maybe for another meetup.

The write up on I2C is available on Dan’s website at Rheingoldheavy.com

Thanks to Dan for the great and entertaining I2C introduction!

PS Robert also shared a link about hacking a flipdot display.