TCA9555 - I2C GPIO Expander Use Cases
This blog post covers two I2C GPIO expander use cases with the TCA9555 I2C GPIO expander.
Interrupt Management
Driving LED’s
Interrupt Management:
Interrupts are communication flags used by peripheral devices to let the central compute or MCU know that something has changed in the system.
A better way to understand this is to think of the components of a common electrical system such as a microwave. When the microwave is operating and heating up some food, the microwave is sending high energy signals behind the glass door. When a person opens the microwave door while the timer is still going, we need a way to shut off the microwave so that it doesn’t heat something else up outside the microwave! Thus, a communication flag or interrupt is sent from the door control back to the MCU to let the MCU know that it needs to shut down the microwave to prevent microwave energy from escaping.
(Please keep the microwave signals inside the box. No need to fry humans any time soon)
An I2C GPIO expander can be used as a way to manage several interrupt signals especially in environments where GPIO pins are scarce on an MCU. An I2C GPIO expander can essentially convert a number of GPIO’s into the two-wire interface of I2C on the serial data and clock lines (SDA & SCL).
This is a picture of the TCA9555 which converts 16 GPIO’s to the I2C bus (or the I2C bus to 16 GPIO). The I2C bus can read data from these GPI’s or write data to output on a GPO.
Interrupts 1-16 can be from various peripheral devices in an electrical system.
Temperature Sensor - when the device exceeds an over-temperature event, send an interrupt, MCU cuts power to that part of the system to prevent temperature overstress
Humidity Sensor - when the device reaches a specific humidity point, send an interrupt, too much water in the air is dangerous for certain electrical applications
Proximity Sensor - when you get to close, send an interrupt, prevent a car from hitting a wall when backing up
Keyboard - press a key, throw an interrupt, MCU deciphers which key was pressed
USB Controllers - when a device that uses USB is plugged into a computer, ping the MCU to determine what was connect to the PC
ADC - Analog to Digital Converter - when converting an analog signal such as a person’s voice to digital values, an ADC can trigger an interrupt when the computation is complete
I2C GPIO Expander - Can take in interrupts on the IO side and trigger an interrupt to the MCU to signal something has changed in the system. IO expanders can do this for multiple peripherals.
Essentially, the TCA9555 is used to take in 16 interrupt signals that otherwise the MCU could not handle itself. An MCU most likely runs out of GPIO pins for these interrupts. The use of a GPIO expander above allows the MCU to trade 3 pins (SDA - SCL - /INT) for an additional 16 through the use of the GPIO expander.
Driving LED’s:
Most I2C GPIO expanders have sufficient current drive for LED’s. A common drive current is roughly 8 - 10 mA of IOL current which is the output low sinking current through the output driver of the GPIO expander. The TCA9555 has an IOL current sink of 25 mA at junction temperatures less than 65 C, 18 mA at less than 85 C, and 11 mA at less than 100 C.
The TCA9555 can be used to drive up to 16 LED’s on the IO side.
One key point to note when designing TCA9555 as an LED driver is ensuring that the total current driven would not break the device. This current limitation can be found in the absolute maximum ratings table in the datasheet.
IOL is the continuous output low current drive for a single IO. This cannot exceed 50 mA and is recommended to stay below 25 mA for recommended use cases.
ICC(GND) is the continuous current through GND. This would be a key spec to understand when driving 16 LED's and sinking the current through the GND pin. If each LED contributes 5 mA of current, you can expect roughly 80 mA of current through the GND pin alone, plus any additional current from the normal operation of the TCA9555.
It is recommended to choose the current limiting resistor carefully for each LED attached to each GPIO pin. If set correctly, the I2C GPIO expander can be used to drive 16 LED’s and you can keep the current sink and additional heat away from the MCU.