Smart Home Automation Forum
How to connect SMOKE DETECTOR SENSOR with KC868-A64? - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-A64 (https://www.kincony.com/forum/forumdisplay.php?fid=28)
+--- Thread: How to connect SMOKE DETECTOR SENSOR with KC868-A64? (/showthread.php?tid=5932)

Pages: 1 2


RE: How to connect SMOKE DETECTOR SENSOR with KC868-A64? - jigneshk5 - 07-07-2024

In Definition:
PCF8575 pcf8575_in(0x24,15,4);
PCF8575 pcf8575_out(0x24,15,4);
In Setup:
for(int i=0;i<16;i++)
{
pcf8575_in.pinMode(i,INPUT);
}
pcf8575_in.begin();

for(int i=0;i<16;i++)
{
pcf8575_out.pinMode(i,OUTPUT);
}
pcf8575_out.begin();

I set i2c address for digital input like this: PCF8575 pcf8575_in(0x24,15,4);
and i2c address for relay output like this: PCF8575 pcf8575_out(0x24,15,4);
When I'm making all relay output pins to LOW with this:
for(int i=0;i<16;i++){
pcf8575_out.digitalWrite(i, LOW);
}
Its automatically making digital input pins to LOW as well in the loop:
for(int i=0;i<16;i++)
{
int piDigital = pcf8575_in.digitalRead(i); // read P(i)
if(piDigital==0)
{
Serial.print("KEY ");
Serial.print(i+1);
Serial.println(" PRESSED");
}
}

When I'm making all relay output pins to LOW, why is it making the digital input pins to LOW ?


RE: How to connect SMOKE DETECTOR SENSOR with KC868-A64? - admin - 07-07-2024

I set i2c address for digital input like this: PCF8575 pcf8575_in(0x24,15,4);
and i2c address for relay output like this: PCF8575 pcf8575_out(0x24,15,4);

WHY use same i2c address for INPUT and OUTPUT???


RE: How to connect SMOKE DETECTOR SENSOR with KC868-A64? - jigneshk5 - 07-08-2024

As per the pin definition you shared: https://www.kincony.com/forum/showthread.php?tid=1903
Its showing same address (check: https://snipboard.io/VxU7rB.jpg) for digital input and relay output. What changes is needed in the definition?


RE: How to connect SMOKE DETECTOR SENSOR with KC868-A64? - admin - 07-08-2024

i have defined same i2c address, but do you see they use by different two i2c bus?
do you have define two i2c bus?


RE: How to connect SMOKE DETECTOR SENSOR with KC868-A64? - jigneshk5 - 07-10-2024

I don't know how to define different i2c bus, I can't find in the library documentation: https://github.com/xreef/PCF8575_library
I'm defining i2c bus for (relay1-16) like this PCF8575 pcf8575_out(0x24,15,4);
and I'm defining i2c bus for (DI1-16) like this PCF8575 pcf8575_in(0x24,15,4);

Is the 15,4 value need to be changed, what change is needed in the definition. Please help.

Don't you think i2c bus could be same for the relay and digital input pins as I did that definition of INPUT and OUTPUT in setup function:
for(int i=0;i<16;i++)
{
pcf8575_in.pinMode(i,INPUT);
}
pcf8575_in.begin();

for(int i=0;i<16;i++)
{
pcf8575_out.pinMode(i,OUTPUT);
}
pcf8575_out.begin();


RE: How to connect SMOKE DETECTOR SENSOR with KC868-A64? - admin - 07-10-2024

you can see the PCF8574 library guide, how to define two different i2c bus.


RE: How to connect SMOKE DETECTOR SENSOR with KC868-A64? - jigneshk5 - 07-11-2024

But As per the documentation https://www.kincony.com/forum/showthread.php?tid=1903 , (relay1-16) and (DI1-16) are having same i2c address: 0x24
So Where am I wrong?


RE: How to connect SMOKE DETECTOR SENSOR with KC868-A64? - admin - 07-11-2024

IIC Bus-1:A

SDA-A:GPIO5
SCL-A:GPIO16

PCF8575:U143 (relay1-16): 100 100 = 0x24
PCF8575:U145 (relay17-32): 100 101 = 0x25
PCF8575:U147 (relay33-48): 100 001 = 0x21
PCF8575:U149 (relay49-64): 100 010 = 0x22

IIC Bus-2:B
SDA-B:GPIO15
SCL-B:GPIO4

PCF8575:U14 (DI1-16): 100 100 = 0x24
PCF8575:U31 (DI17-32): 100 101 = 0x25
PCF8575:U56 (DI33-48): 100 001 = 0x21
PCF8575:U57 (DI49-64): 100 010 = 0x22

do you see clearly? they use two different i2c bus! bus-1 and bus-2 you need to define two i2c bus pin define. if you don't know how to do , you can search by Google, how to define i2c bus in arduino IDE.