CrowPanel 5in / 7in add I2C communication device with I2C IO expander.

I wrote this for my reminder. CrowPanel 5 and 7in use (SDA 19, SLC 20) for TFT operation. Just connect I2C device to I2C(19,20) port does not allow to communicate. I was suffering for a while about this problem connecting to PCF8574 8ch I2C relay board. I found following 2 ways to solve problem.
1. Assign GPIO port for additional I2C device.
Add "Wire.begin(43,44);" in setup( ) and just connect I2C device to GPIO(43,44) port. However if you are using this GPIO port, you need to find another GPIOs.

  1. Include I2C IO expander library.
    You can find the I2C IO expander library for most of the I2C devices. This may be specific for each device. For my I2C relay, PCF8574.h is the expander library. I added following in *.ino file. Do not need to write "Wire.begin(19, 20);" in setup( ).

include <PCF8574.h>

PCF8574 PCF2(0x27, &Wire1); //0x27 is the target relay board i2c Address
This allowed to run TFT screen and the Relay in same I2C (19, 20) bas together. You can use GPIO port for other usage. It is also good idea to update the "deviceAddress" in the PCF8574.h file to your device address.

Sign In or Register to comment.