07-16-2025, 11:59 PM
Subject: Help Needed - PCF8574 Not Functioning as Expected on KC868-A4S (ESP32)
Hello KingCony team,
I'm working on a project using the KC868-A4S board (ESP32) and I'm trying to control a PCF8574 module (I2C address 0x24) using the following code. The code compiles correctly and seems to run, but unfortunately, none of the outputs on the PCF8574 respond — the connected relays do not activate at all.
Here is the code I’m using:#include "Arduino.h"
#include "PCF8574.h"
#define A4S_SDA 4
#define A4S_SCL 16
TwoWire I2Cone = TwoWire(0);
TwoWire I2Ctwo = TwoWire(1);
PCF8574 pcf8574_RE1(&I2Cone, 0x24, A4S_SDA, A4S_SCL); // DO
void setup() {
Serial.begin(115200);
pcf8574_RE1.pinMode(P0, OUTPUT);
pcf8574_RE1.pinMode(P1, OUTPUT);
pcf8574_RE1.pinMode(P2, OUTPUT);
pcf8574_RE1.pinMode(P3, OUTPUT);
}
void loop() {
pcf8574_RE1.digitalWrite(P0, LOW); delay(1000);
pcf8574_RE1.digitalWrite(P1, HIGH); delay(1000);
pcf8574_RE1.digitalWrite(P2, HIGH); delay(1000);
pcf8574_RE1.digitalWrite(P3, HIGH); delay(1000);
}
I have double-checked the wiring, the I2C address, and the power supply. I also tried using the Wire.begin() directly and doing an I2C scan, and the device is detected correctly at address 0x24.
However, despite everything looking fine, the relays or outputs connected to the PCF8574 are not switching at all.
Has anyone experienced a similar issue with the KC868-A4S and PCF8574? Am I missing a step to initialize or activate the bus correctly?
Any advice or sample code that is known to work with KC868-A4S and PCF8574 would be greatly appreciated.
Thank you in advance for your support!
Hello KingCony team,
I'm working on a project using the KC868-A4S board (ESP32) and I'm trying to control a PCF8574 module (I2C address 0x24) using the following code. The code compiles correctly and seems to run, but unfortunately, none of the outputs on the PCF8574 respond — the connected relays do not activate at all.
Here is the code I’m using:#include "Arduino.h"
#include "PCF8574.h"
#define A4S_SDA 4
#define A4S_SCL 16
TwoWire I2Cone = TwoWire(0);
TwoWire I2Ctwo = TwoWire(1);
PCF8574 pcf8574_RE1(&I2Cone, 0x24, A4S_SDA, A4S_SCL); // DO
void setup() {
Serial.begin(115200);
pcf8574_RE1.pinMode(P0, OUTPUT);
pcf8574_RE1.pinMode(P1, OUTPUT);
pcf8574_RE1.pinMode(P2, OUTPUT);
pcf8574_RE1.pinMode(P3, OUTPUT);
}
void loop() {
pcf8574_RE1.digitalWrite(P0, LOW); delay(1000);
pcf8574_RE1.digitalWrite(P1, HIGH); delay(1000);
pcf8574_RE1.digitalWrite(P2, HIGH); delay(1000);
pcf8574_RE1.digitalWrite(P3, HIGH); delay(1000);
}
I have double-checked the wiring, the I2C address, and the power supply. I also tried using the Wire.begin() directly and doing an I2C scan, and the device is detected correctly at address 0x24.
However, despite everything looking fine, the relays or outputs connected to the PCF8574 are not switching at all.
Has anyone experienced a similar issue with the KC868-A4S and PCF8574? Am I missing a step to initialize or activate the bus correctly?
Any advice or sample code that is known to work with KC868-A4S and PCF8574 would be greatly appreciated.
Thank you in advance for your support!

