Windmill Data Acquisition Software Logo
24 May 2018

Windmill Software Ltd
Data Acquisition Intelligence
Call now: +44 (0)161 834 6688

I2C Communications and Data Logging

The I2C bus was developed by Philips Semiconductors. Originally it's purpose was to provide a communication link between integrated circuits. It's now used in many other applications.

This method of communication uses just two wires: the clock wire (called SCL) and the data wire (called SDA).

All devices on the I2C bus are either a master or slave. There is generally just one master which controls the clock and data transfer. The slave devices respond to the master.

I2c

Windmill software communicates with and logs data from I2C devices as well as those communicating over RS232, RS485, Modbus or TCP/IP.

Initiating a Message

When the master wishes to talk to a slave it sends a start sequence on the bus.

Data is transferred in sequences of 8 bits. The bits are placed on the data line starting with the Most Significant Bit (MSB). After every bit the clock line pulses high then low.

For every 8 bits transferred, the device receiving the data sends back an acknowledge bit (ACK). This means that there are 9 SCL clock pulses for each 8-bit byte of data.

Acknowledging the Data Transfer

If the receiving device sends back a low ACK bit, then it has received the data and is ready to accept another byte. If it sends back a high then it is indicating it cannot accept any further data and the master should terminate the transfer by sending a stop sequence.

Addressing I2C Devices

I2C addresses are most commonly 7 bits. As a 7-bit number can be from 0 to 127, you can have up to 128 addresses.

Even though the address is 7-bit, the master always sends 8 bits. The extra bit tells the slave whether data is being read or written. If the bit is 0 then the master is writing to the slave. If the bit is 1 then master is reading from the slave. The 7-bit address is placed in the upper 7 bits of the byte and the Read/Write (R/W) bit is in the LSB (Least Significant Bit). Thinking in 8-bit bytes, this means that even numbers are write addresses and odd numbers read addresses.

Working in decimal this addressing method can be confusing. Decimal 15 for example, is 00001111. But if you are sending 15 as a 7-bit address plus a read direction bit, you send 00011111 which is decimal 31.

Reading from and Writing to Registers

After sending the start sequence and the slave address, the next thing is to specify the register to which you want to write or from which you want to read. Some devices don't have any registers, some have several. After specifying the register the master can send the data. If more data arrives than will fit in the register, the slave just allocates it to the next register.

Stopping sending Data

At the end of the transfer the master sends the stop sequence.

Product Testing over I2C - How one of our customers is logging data from I2C Devices

During high quality chicken processing, carcasses are scalded in a bath of hot water to loosen the feathers. The temperature of the scalder needs to be controlled and the SenTrolSMB company are developing an I2C-based thermostat to do so. They have chosen Windmill data acquisition software to help them with this, and to verify that the scalder is working properly.

Windmill captures and displays temperature data before passing it to an Excel spreadsheet for later analysis. SenTrolSMB made the decision to use Windmill partly because of the Graphics program, which will let them quickly build an individual control panel interface for each customer.

SenTrolSMB uses Windmill with I2C devices by means of an RS232 to I2C converter.

More information

Help with using Windmill

You can read the complete I2C bus specification at http://www.nxp.com/documents/user_manual/UM10204.pdf.