As mentioned in our previous discussion of the 4-20 mA current loop, there are many forms of wired data transmission that can be used in products, and today we’d like to review another form – the Inter-integrated Circuit bus (or I2C bus for short). This is also known as the “two wire interface” and has been around for quite some time. Invented by NXP (previously Philips Semiconductor) the I2C bus is a multi-master serial single-ended data bus used to allow systems to communicate with a huge variety of electronic devices.
From a hardware perspective it is quite simple – each device connects to the serial data and clock lines, which are controlled by the master device. The clock and data lines are connected to Vdd via pull-up resistors, for example:
You may be wondering how the slave addresses are organised – each device manufacturer applies for an address range from NXP for their products. Some devices will only have one set address, and some can have their address altered – for example by changing the last three bits in the binary representation of the addresses. This is done in hardware by connecting three pins to Vdd or GND.
The speed of the I2C bus varies, and can range from 10 kbps to 3.4Mbps – with the speed usually proportional to the total device power requirements. The usual speed for the majority of devices is 100 kbps.
The decision to use the I2C bus can be simple, due to the popularity of the interface even on the most inexpensive of microcontrollers – and many design engineeers are familiar with the bus due to the history.
But what sort of devices can make use of the I2C bus? There are literally thousands available, in a wide range of categories. These can include simple temperature sensors, EEPROMS, motor controllers, LCD interfaces, I/O expanders, real-time clocks, UART interfaces, ADC/DACs, and more.
Apart from the huge range of devices, the advantages of using the I2C bus include industry expertise, the ability to address literally hundreds of devices using only two master I/O pins, and that devices on the bus can be “hot swap” – that is you can add or remove devices from the bus without powering off the entire system. This in itself is perfect for systems with maximum run-time requirements, as technicians can replace faulty device modules with reduced down-time for the end user.
However there are disadvantages to the I2C bus, two of which need to be taken into consideration. The first is that the maximum physical length of a bus run is usually around 20 metres, and in some cases much less. You can use bus extension devices from NXP (and others) that will allow much further physical distances – however designers need to ensure the capacitance across the bus stays at around 400 picofarads.
The second disadvantage is the possibility of slave address clash. You may have two specialised devices with the same slave address. In these situations you need to use an address multiplexer IC on the bus which first needs to be controlled, and then the device selected is addressed as normal. Nevertheless, as part of normal prototyping and planning these disadvantages can be removed or minimised with appropriate engineering.
It can be said that the I2C data bus may not be the “latest technology”, but it can effectively solve problems in the right circumstances. However there are many options, and choosing the right one is a fundamental step for the success of your project. So if your design team is set in their ways, or you’re not sure which data communication method is best for your application – it’s time to discuss this with independent, experienced engineers.
We understand the importance of high availability, accuracy and integrity of the systems, combined with the need for future proofing infrastructure rollouts. For more information or a confidential discussion about your ideas and how we can help bring them to life – click here to contact us, or telephone 1800 810 124.