top of page

Communication with an IO Expander via I2C

Updated: Feb 21

Overview

This demonstration outlines the method for establishing communication between SmartWave and the NXP PCF8575 IO Expander through I2C communication. The PCF8575 consists of a 16-bit quasi-bidirectional port and I2C bus interface. The device offers general-purpose remote I/O expansion for various microcontroller families via the two-line bidirectional bus (I2C-bus).  For a detailed description of the IO Expander, please refer to the product’s datasheet.


PCF8575 IO Expander

Used I2C Protocol Details

As mentioned earlier, to communicate with the IO Expander, the I2C protocol is employed. I2C requires only two communication lines: one for the clock (SCL), enabling synchronous communication, and the other for data transmission and reception (SDA).


In the I2C protocol, data is transmitted in messages, which are further divided into frames of data. Each message consists of an address frame containing the binary address of the subnode/peripheral, along with one or more data frames containing the transmitted data. The message encompasses start and stop conditions, read/write bits, and ACK/NACK bits positioned between each data frame.



I2C Communication Protocol

If the reader is interested in understanding how the I2C protocol works, a detailed explanation can be found in the following article.


In our previous blog post, we covered how to address common I2C communication setup issues. Make sure to give it a read.  


Setup

The hardware setup involves soldering the IO Expander module onto a perfboard, which is great for prototyping electronic circuits. Each output port of the device is then connected to an LED, along with a current-limiting resistor. The module is subsequently linked to the SmartWave, providing the necessary voltage (3.3 Vdd), ground (GND), as well as the I2C lines (SCL and SDA). The wiring schematic is depicted below.


IO Expander demo schematic

Hardware setup


Use Case with SmartWave

To showcase the SmartWave's capability with the IO Expander, we've created the "Blinky" demo. This involves toggling the outputs of the IO expander to flash the LEDs previously soldered onto the perfboard.


For those eager to replicate these demos, SmartWave's WebGUI offers a user-friendly interface, ensuring a seamless and flexible experience without the need for any software installation. A comprehensive introduction to SmartWave is available on our website.


To initiate the demo, load the "I2C_IOexpander_blinky.json" configuration file into the WebGUI. The I2C frequency and sample frequency have been reduced, and each sample is transmitted three times to intentionally slow down the transmission. This setup allows for the observation of the red and blue lights blinking.



SmartWave WebGUI configuration

Be sure to check out SmartWave in action at the following link: SmartWave - Blinky 


Conclusion

In conclusion, this demo showcases the efficient communication between SmartWave and the NXP PCF8575 IO Expander through I2C. With a user-friendly WebGUI and versatile use case, SmartWave proves its seamless integration capabilities.


For those eager to harness the potential of SmartWave in their projects, we invite you to contact semify via email (office@semify-eda.com) for more information, product demonstrations, or to discuss specific requirements. You can also explore other interesting articles and demos featuring SmartWave using the following links.








95 views0 comments

Recent Posts

See All

Kommentarer


bottom of page