Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Relay
#1
Hi, I can't understand which doors are to be configured to command the relays from ESP32. 
can you help me. From the example file I can't understand, thanks
Reply
#2
https://www.kincony.com/forum/showthread.php?tid=2618 here is yaml file for KC868-A4S. the following content is use for relay:

# Example configuration entry for ESP32
i2c:
sda: 4
scl: 16
scan: true
id: bus_a

# Example configuration entry
pcf8574:
- id: 'pcf8574_hub_out_1' # for output channel 1-4 for DI9--DI12
address: 0x24

- id: 'pcf8574_hub_in_1' # for input channel 1-8
address: 0x22

# Individual outputs
switch:
- platform: gpio
name: "a4s-light1"
id: light1
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true

- platform: gpio
name: "a4s-light2"
id: light2
pin:
pcf8574: pcf8574_hub_out_1
number: 1
mode: OUTPUT
inverted: true

- platform: gpio
name: "a4s-light3"
id: light3
pin:
pcf8574: pcf8574_hub_out_1
number: 2
mode: OUTPUT
inverted: true

- platform: gpio
name: "a4s-light4"
id: light4
pin:
pcf8574: pcf8574_hub_out_1
number: 3
mode: OUTPUT
inverted: true
Reply
#3
Thanks for the reply, I am trying to use this card with Arduino Cloud and invest the KC868-A4 model I managed to activate the releases as per the demo scheme: 
Const Int relay1 = 2;
Const int Relay2 = 15;
Const int Relay3 = 5;
Const int Relay4 = 4;
In the KC868-A4S card the scheme is different and I don't understand how to activate the releases. Thank you
Reply
#4
A4S use PCF8574 IIC bus extend gpio chips. here is our arduino sample code how to use relay:
https://www.kincony.com/forum/showthread.php?tid=2628
Reply
#5
Hi, for Arduino Cloud which library I need to add for PCF8574 IIC? It gives me an error that does not find the PCF8574.h file. Thank you
Reply
#6
yes, need add PCF8574 arduino library.

.zip   PCF8574_library.zip (Size: 23.8 MB / Downloads: 197)
Reply
#7
(03-28-2023, 08:35 AM)admin Wrote: yes, need add PCF8574 arduino library.
Thanks for the reply, with the additional library on Arduino ide it works. I'm supposed to use it on the Arduino Cloud and I can't get it to work. I attach the error

/usr/local/bin/arduino-cli compile --fqbn esp32:esp32:esp32:CPUFreq=240,DebugLevel=none,EraseFlash=none,EventsCore=1,FlashFreq=80,FlashMode=qio,FlashSize=4M,LoopCore=1,PSRAM=disabled,PartitionScheme=default,UploadSpeed=921600 --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/078383118/build --build-path /tmp/arduino-build-F7B4CC6F93B1FBCAD39B43F824F23BDC --library /mnt/create-efs/webide/d3/90/d390ef1e05c8bc72a98d38ac0679549cConfusedatifiltri/libraries_v2/PCF8574 library /tmp/078383118/BEMOPRO_LORI_mar30a
Using library pcf8574_0_3_8 at version 0.3.8 in folder: /home/builder/opt/libraries/pcf8574_0_3_8
Using library Wire at version 2.0.0 in folder: /home/builder/.arduino15/packages/esp32/hardware/esp32/2.0.5/libraries/Wire
/tmp/078383118/BEMOPRO_LORI_mar30a/BEMOPRO_LORI_mar30a.ino:10:49: error: no matching function for call to 'PCF8574:TongueCF8574(TwoWire*, int, int, int)'
PCF8574 pcf8574_RE1(&I2Cone,0x24,A4S_SDA,A4S_SCL);//DO
^
In file included from /tmp/078383118/BEMOPRO_LORI_mar30a/BEMOPRO_LORI_mar30a.ino:3:
/home/builder/opt/libraries/latest/pcf8574_0_3_8/PCF8574.h:30:12: note: candidate: 'PCF8574:TongueCF8574(uint8_t, TwoWire*)'
explicit PCF8574(const uint8_t deviceAddress = 0x20, TwoWire *wire = &Wire);
^~~~~~~
/home/builder/opt/libraries/latest/pcf8574_0_3_8/PCF8574.h:30:12: note: candidate expects 2 arguments, 4 provided
/home/builder/opt/libraries/latest/pcf8574_0_3_8/PCF8574.h:27:7: note: candidate: 'constexpr PCF8574:TongueCF8574(const PCF8574&)'
class PCF8574
^~~~~~~
/home/builder/opt/libraries/latest/pcf8574_0_3_8/PCF8574.h:27:7: note: candidate expects 1 argument, 4 provided
/home/builder/opt/libraries/latest/pcf8574_0_3_8/PCF8574.h:27:7: note: candidate: 'constexpr PCF8574:TongueCF8574(PCF8574&&)'
/home/builder/opt/libraries/latest/pcf8574_0_3_8/PCF8574.h:27:7: note: candidate expects 1 argument, 4 provided
/tmp/078383118/BEMOPRO_LORI_mar30a/BEMOPRO_LORI_mar30a.ino: In function 'void setup()':
/tmp/078383118/BEMOPRO_LORI_mar30a/BEMOPRO_LORI_mar30a.ino:20:17: error: 'class PCF8574' has no member named 'pinMode'
pcf8574_RE1.pinMode(P0, OUTPUT);
^~~~~~~
Reply
#8
sorry, i have not used Arduino Cloud . maybe you need to chose another PCF8574 library for Arduino Cloud.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)