Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 5,363
» Latest member: melrose63
» Forum threads: 2,574
» Forum posts: 13,303

Full Statistics

Online Users
There are currently 42 online users.
» 1 Member(s) | 24 Guest(s)
AhrefsBot, Applebot, Bytespider, Crawl, Google, Google-Apps-Script, PetalBot, Yandex, bot, tugra

Latest Threads
Need help with configurat...
Forum: KC868-HxB series Smart Controller
Last Post: admin
1 hour ago
» Replies: 32
» Views: 380
ESP32 S3 set up issue
Forum: Extender module
Last Post: admin
6 hours ago
» Replies: 10
» Views: 57
A32 Pro ESPHome yaml incl...
Forum: KC868-A32/A32 Pro
Last Post: admin
6 hours ago
» Replies: 16
» Views: 175
KC868-A8 Schematic
Forum: KC868-A8
Last Post: admin
6 hours ago
» Replies: 7
» Views: 41
change wake up name
Forum: KinCony AS
Last Post: admin
6 hours ago
» Replies: 11
» Views: 65
"KCS" v2.2.8 firmware BIN...
Forum: "KCS" firmware system
Last Post: admin
6 hours ago
» Replies: 2
» Views: 158
Dimensions/drawings of bo...
Forum: Schematic and diagram
Last Post: admin
6 hours ago
» Replies: 1
» Views: 18
how to use AS ESP32-S3 vo...
Forum: KinCony AS
Last Post: admin
12-16-2024, 10:55 PM
» Replies: 12
» Views: 446
Problem with IFTTT automa...
Forum: "KCS" firmware system
Last Post: admin
12-16-2024, 10:53 PM
» Replies: 5
» Views: 34
M16 SHT31 sensor disconne...
Forum: KC868-M16 / M1 / MB / M30
Last Post: bsarra
12-16-2024, 08:36 PM
» Replies: 4
» Views: 38

  E16S home assistant
Posted by: janami - 11-30-2024, 07:39 AM - Forum: KC868-E16S/E16P - Replies (5)

Ahoj všichni,
Na mini PC mám přes PROXMOX nainstalovanou desku KC868-E16S a Home Assistant. Jaký komunikační protokol bych měl použít, abych zajistil stabilní připojení? Rozhodně nechci žádné bezdrátové možnosti.
Mohl by mi prosím někdo napsat podrobný návod jak to nastavit?
A jaký firmware mám nahrát do KC868-E16S?
Děkuju.

Print this item

  "KCS" v3.3.0 firmware for F16 controller
Posted by: admin - 11-30-2024, 03:51 AM - Forum: "KCS" firmware system - No Replies

v3.3.0 improvement:
1. Fixed the problem of Tuya automatically managing  by Reset button and network Led
2. Add a delay after i2c initialization to fix the issue where AT24C02 occasionally fails to read i2c data too quickly, resulting in interrupted startup.

.zip   KCS_F16_V3.3.0.zip (Size: 1.01 MB / Downloads: 37)

Print this item

  "KCS" v3.3.0 firmware for B16M controller
Posted by: admin - 11-30-2024, 03:50 AM - Forum: "KCS" firmware system - No Replies

v3.3.0 improvement:
1. Fixed the problem of Tuya automatically managing  by Reset button and network Led
2. Add a delay after i2c initialization to fix the issue where AT24C02 occasionally fails to read i2c data too quickly, resulting in interrupted startup.

.zip   KCS_B16M_V3.3.0.zip (Size: 1.01 MB / Downloads: 30)

Print this item

  "KCS" v3.3.0 firmware for F24 controller
Posted by: admin - 11-30-2024, 03:47 AM - Forum: "KCS" firmware system - No Replies


.zip   KCS_F24_V3.3.0.zip (Size: 1.01 MB / Downloads: 22)

Print this item

  Error when flashing A32 Pro
Posted by: drazvan2003 - 11-29-2024, 07:03 PM - Forum: DIY Project - Replies (6)

im getting this error when im trying to flash my a32pro

as you can see in the picture attached that my config, i hit run, it stays for ever in loading. When i stop this i get 

[2024-11-29 20:56:35,958][ESP8266Loader_spi[1]][espDownloader.py][line:422][ERROR]: Chip sync error
[2024-11-29 20:56:35,958][ESP8266Loader_spi[1]][espDownloader.py][line:582][ERROR]: ESP32S3 Chip sync error esp_sync_blocking.



Attached Files Thumbnail(s)
   
Print this item

  Hardware issues
Posted by: ogo - 11-29-2024, 09:54 AM - Forum: KC868-A8 - Replies (1)

Hello,

I bought a KC868-A8 a while ago that I've been using to test things and learn. Today I finally wanted to configure it properly to controls some lights. I have two issues

  1. Output 3 and 4 don't work: when I enable the outputs via home assistant or KCS, the LEDs for the outputs don't turn on, and I can't hear the click on the relay.
  2. When activating output 8, outputs 5, 6, and 7 are also activated: When I activate output 8 via home assistant or KCS, the LEDs of outputs 5, 6, 7, 8 turn on, even though those relays aren't active.

Things I've done so far:
  • Remove everything from home assistant and install it again
  • Disconnect everything from the board
  • Flashed KCS instead of ESPHome
  • Factory reset using KCS
  • Flashed ESPHome again

Nothing seems to fix it, so I can only think it's a hardware issue, not software. The board version is 1.6, and it also has a 433 MHz receiver/transmitter.

Any ideas?

Print this item

  Replacing KCS868-E8 relays with 24V
Posted by: Revinor - 11-29-2024, 09:24 AM - Forum: Development - Replies (1)

I'm using 24V output from KCS868-B16M for controlling few devices. At same time, I would like to use some of these outputs to drive 230VAC. Can I just replace all relays on KCS868-E8 with G2R-1A-E-24VDC, connect 24V supply and 24V outputs from KCS868-B16M there and everything will work? Or are there some parts there which won't work with 24V even if all relays are replaced?

Print this item

  G1 ESP32-S3 IO pins define
Posted by: admin - 11-28-2024, 12:01 PM - Forum: G1 - No Replies

IIC SDA:GPIO12
IIC SCL:GPIO11

------------------------

Ethernet (W5500) I/O define:

clk_pin: GPIO42
mosi_pin: GPIO43
miso_pin: GPIO44
cs_pin: GPIO41

interrupt_pin: GPIO2
reset_pin: GPIO1
--------------------
RS485:
RXD:GPIO18
TXD:GPIO8
--------------------
4G SIM7600:
RXD:GPIO10
TXD:GPIO9
--------------------
1-wire (pull-up resistance on PCB):
1-wire1:GPIO15
1-wire2:GPIO16
1-wire3:GPIO17
1-wire4:GPIO40

1-wire (without resistance on PCB):
1-wire1:GPIO13
1-wire2:GPIO14
1-wire2:GPIO21

free GPIOs(without ESD diode on PCB):
GPIO4
GPIO5
GPIO6
GPIO7

------------------------
24C02 EPROM i2c address: 0x50
SSD1306 display: i2c address:0x3c

Print this item

  F24 ESPHome yaml for home assistant
Posted by: admin - 11-28-2024, 11:54 AM - Forum: F24 - No Replies

Code:
esphome:
  name: f24
  friendly_name: f24
  platformio_options:
    board_build.extra_flags:
      # WIFI_CONTROL_SELF_MODE = 0
      # WIFI_CONTROL_SELF_MODE = 1
      - "-DWIFI_CONTROL_SELF_MODE=1"
esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino
   

external_components:
  - source:
      type: git
      url: https://github.com/hzkincony/esphome-tuya-wifi-mcu
      ref: v1.1.0

# Enable logging

  # hardware_uart: USB_SERIAL_JTAG
# Enable Home Assistant API
api:
  encryption:
    key: "WeVOuL5oNhjXcfzXtTirlOwvtWvCD5yqIxd3oV4es1k="

ethernet:
  type: W5500
  clk_pin: GPIO42
  mosi_pin: GPIO43
  miso_pin: GPIO44
  cs_pin: GPIO41
  interrupt_pin: GPIO2
  reset_pin: GPIO1

i2c:
   - id: bus_a
     sda: 8
     scl: 18
     scan: true
     frequency: 400kHz

pcf8574:
  - id: 'pcf8574_hub_out_1'  # for output channel 9-24
    i2c_id: bus_a
    address: 0x25
    pcf8575: true

  - id: 'pcf8574_hub_in_1'  # for digital input channel 1-16
    i2c_id: bus_a
    address: 0x24
    pcf8575: true

  - id: 'pcf8574_hub_out_in_2'  # for output channel 1-8  + (input 17-24)
    i2c_id: bus_a
    address: 0x26
    pcf8575: true

uart:
  - id: uart_1    #RS485
    baud_rate: 9600
    debug:
      direction: BOTH
      dummy_receiver: true
      after:
        timeout: 10ms
    tx_pin: 16
    rx_pin: 17

  - id: tuya_mcu_uart
    tx_pin: GPIO39
    rx_pin: GPIO38
    baud_rate: 9600

tuya_wifi_mcu:
  # tuya mcu product id
  product_id: cchos3g1j2ucfbyd
  uart_id: tuya_mcu_uart
  wifi_reset_pin: 28
  wifi_led_pin: 16

switch:
  - platform: uart
    uart_id: uart_1
    name: "RS485 Button"
    data: [0x11, 0x22, 0x33, 0x44, 0x55]

  - platform: gpio
    name: "f24-output01"
    id: "f24_output01"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 12
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output1-tuya
    dp_id: 1
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output01"

  - platform: gpio
    name: "f24-output02"
    id: "f24_output02"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 13
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output2-tuya
    dp_id: 2
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output02"

  - platform: gpio
    name: "f24-output03"
    id: "f24_output03"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 14
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output3-tuya
    dp_id: 3
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output03"

  - platform: gpio
    name: "f24-output04"
    id: "f24_output04"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 15
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output4-tuya
    dp_id: 4
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output04"

  - platform: gpio
    name: "f24-output05"
    id: "f24_output05"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 8
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output5-tuya
    dp_id: 5
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output05"

  - platform: gpio
    name: "f24-output06"
    id: "f24_output06"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 9
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output6-tuya
    dp_id: 6
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output06"

  - platform: gpio
    name: "f24-output07"
    id: "f24_output07"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 10
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output7-tuya
    dp_id: 101
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output07"

  - platform: gpio
    name: "f24-output08"
    id: "f24_output08"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 11
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output8-tuya
    dp_id: 102
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output08"

  - platform: gpio
    name: "f24-output09"
    id: "f24_output09"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output9-tuya
    dp_id: 103
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output09"

  - platform: gpio
    name: "f24-output10"
    id: "f24_output10"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output10-tuya
    dp_id: 104
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output10"

  - platform: gpio
    name: "f24-output11"
    id: "f24_output11"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output11-tuya
    dp_id: 105
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output11"

  - platform: gpio
    name: "f24-output12"
    id: "f24_output12"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output12-tuya
    dp_id: 106
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output12"

  - platform: gpio
    name: "f24-output13"
    id: "f24_output13"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output13-tuya
    dp_id: 107
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output13"

  - platform: gpio
    name: "f24-output14"
    id: "f24_output14"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output14-tuya
    dp_id: 108
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output14"

  - platform: gpio
    name: "f24-output15"
    id: "f24_output15"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output15-tuya
    dp_id: 109
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output15"

  - platform: gpio
    name: "f24-output16"
    id: "f24_output16"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output16-tuya
    dp_id: 110
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output16"

  - platform: gpio
    name: "f24-output17"
    id: "f24_output17"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 8
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output17-tuya
    dp_id: 126
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output17"

  - platform: gpio
    name: "f24-output18"
    id: "f24_output18"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 9
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output18-tuya
    dp_id: 129
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output18"

  - platform: gpio
    name: "f24-output19"
    id: "f24_output19"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 10
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output19-tuya
    dp_id: 130
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output19"

  - platform: gpio
    name: "f24-output20"
    id: "f24_output20"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 11
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output20-tuya
    dp_id: 131
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output20"

  - platform: gpio
    name: "f24-output21"
    id: "f24_output21"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 12
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output21-tuya
    dp_id: 132
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output21"

  - platform: gpio
    name: "f24-output22"
    id: "f24_output22"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 13
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output22-tuya
    dp_id: 133
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output22"

  - platform: gpio
    name: "f24-output23"
    id: "f24_output23"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 14
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output23-tuya
    dp_id: 134
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output23"

  - platform: gpio
    name: "f24-output24"
    id: "f24_output24"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 15
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-output24-tuya
    dp_id: 135
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "f24_output24"


binary_sensor:
  - platform: gpio
    name: "f24-input01"
    id: "f24_input01"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input1-tuya
    dp_id: 111
    bind_binary_sensor_id: f24_input01
    internal: true

  - platform: gpio
    name: "f24-input02"
    id: "f24_input02"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input2-tuya
    dp_id: 112
    bind_binary_sensor_id: f24_input02
    internal: true

  - platform: gpio
    name: "f24-input03"
    id: "f24_input03"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input3-tuya
    dp_id: 113
    bind_binary_sensor_id: f24_input03
    internal: true

  - platform: gpio
    name: "f24-input04"
    id: "f24_input04"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input4-tuya
    dp_id: 114
    bind_binary_sensor_id: f24_input04
    internal: true

  - platform: gpio
    name: "f24-input05"
    id: "f24_input05"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input5-tuya
    dp_id: 115
    bind_binary_sensor_id: f24_input05
    internal: true

  - platform: gpio
    name: "f24-input06"
    id: "f24_input06"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input6-tuya
    dp_id: 116
    bind_binary_sensor_id: f24_input06
    internal: true

  - platform: gpio
    name: "f24-input07"
    id: "f24_input07"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input7-tuya
    dp_id: 117
    bind_binary_sensor_id: f24_input07
    internal: true

  - platform: gpio
    name: "f24-input08"
    id: "f24_input08"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input8-tuya
    dp_id: 118
    bind_binary_sensor_id: f24_input08
    internal: true

  - platform: gpio
    name: "f24-input09"
    id: "f24_input09"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 8
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input9-tuya
    dp_id: 119
    bind_binary_sensor_id: f24_input09
    internal: true

  - platform: gpio
    name: "f24-input10"
    id: "f24_input10"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 9
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input10-tuya
    dp_id: 120
    bind_binary_sensor_id: f24_input10
    internal: true

  - platform: gpio
    name: "f24-input11"
    id: "f24_input11"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 10
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input11-tuya
    dp_id: 121
    bind_binary_sensor_id: f24_input11
    internal: true

  - platform: gpio
    name: "f24-input12"
    id: "f24_input12"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 11
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input12-tuya
    dp_id: 122
    bind_binary_sensor_id: f24_input12
    internal: true

  - platform: gpio
    name: "f24-input13"
    id: "f24_input13"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 12
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input13-tuya
    dp_id: 123
    bind_binary_sensor_id: f24_input13
    internal: true

  - platform: gpio
    name: "f24-input14"
    id: "f24_input14"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 13
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input14-tuya
    dp_id: 124
    bind_binary_sensor_id: f24_input14
    internal: true

  - platform: gpio
    name: "f24-input15"
    id: "f24_input15"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 14
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: f24-input15-tuya
    dp_id: 125
    bind_binary_sensor_id: f24_input15
    internal: true

  - platform: gpio
    name: "f24-input16"
    id: "f24_input16"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 15
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "f24-input17"
    id: "f24_input17"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 0
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "f24-input18"
    id: "f24_input18"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 1
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "f24-input19"
    id: "f24_input19"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 2
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "f24-input20"
    id: "f24_input20"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 3
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "f24-input21"
    id: "f24_input21"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 4
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "f24-input22"
    id: "f24_input22"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 5
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "f24-input23"
    id: "f24_input23"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 6
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "f24-input24"
    id: "f24_input24"
    pin:
      pcf8574: pcf8574_hub_out_in_2
      number: 7
      mode: INPUT
      inverted: true


##pull-up resistance on PCB
  - platform: gpio
    name: "f24-W1-io48"
    pin:
      number: 48
      inverted: true

  - platform: gpio
    name: "f24-W1-io47"
    pin:
      number: 47
      inverted: true

  - platform: gpio
    name: "f24-W1-io21"
    pin:
      number: 21
      inverted: true

  - platform: gpio
    name: "f24-W1-io15"
    pin:
      number: 15
      inverted: true
## without resistance on PCB
  - platform: gpio
    name: "f24-W1-io13"
    pin:
      number: 13
      inverted: false

  - platform: gpio
    name: "f24-W1-io14"
    pin:
      number: 14
      inverted:  false

  - platform: gpio
    name: "f24-433M"
    pin:
      number: 40
      inverted:  false

sensor:
  - platform: adc
    pin: 5
    name: "f24 A1 Voltage"
    update_interval: 5s
    attenuation: 11db
    filters:
      - lambda:
          if (x >= 3.11) {
            return x * 1.60256;
          } else if (x <= 0.15) {
            return 0;
          } else {
            return x * 1.51;
          }
  - platform: adc
    pin: 7
    name: "f24 A2 Voltage"
    update_interval: 5s
    attenuation: 11db
    filters:
      # - multiply: 1.51515
      - lambda:
          if (x >= 3.11) {
            return x * 1.60256;
          } else if (x <= 0.15) {
            return 0;
          } else {
            return x * 1.51;
          }
  - platform: adc
    pin: 6
    name: "f24 A3 Current"
    update_interval: 5s
    unit_of_measurement: mA
    attenuation: 11db
    filters:
      - multiply: 6.66666666
  - platform: adc
    pin: 4
    name: "f24 A4 Current"
    update_interval: 5s
    unit_of_measurement: mA
    attenuation: 11db
    filters:
      - multiply: 6.66666666

web_server:
  port: 80

font:
  - file: "gfonts://Roboto"
    id: roboto
    size: 20

display:
  - platform: ssd1306_i2c
    i2c_id: bus_a
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.printf(0, 0, id(roboto), "KinCony F24");
download yaml file:

.txt   F24-HA.txt (Size: 18.55 KB / Downloads: 21)

Print this item

  [arduino code examples for F24]-12 How to control one relay
Posted by: admin - 11-28-2024, 11:52 AM - Forum: F24 - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* This program controls a 24-channel relay board via two PCF8575 I/O expanders.
* It toggles relay 24 every 2 seconds and prints its status via the serial port.
*
* Pin Definitions:
* - SDA: GPIO 8
* - SCL: GPIO 18
*
* Relay 24 is controlled through the first PCF8575 (I2C_ADDRESS_R1).
*/

#include <Wire.h>        // Include the Wire library for I2C communication
#include <PCF8575.h>     // Include the PCF8575 library to control the I/O expander

#define SDA 8            // Define the SDA pin
#define SCL 18           // Define the SCL pin
#define TOGGLE_DELAY 2000  // Define the toggle delay time (2 seconds)

// Set I2C addresses of the PCF8575 modules
#define I2C_ADDRESS_R1 0x25 // I2C address of the first PCF8575 module (for relays 9-24)
#define I2C_ADDRESS_R2 0x26 // I2C address of the second PCF8575 module (for relays 1-8)

PCF8575 pcf8575_R1(I2C_ADDRESS_R1); // Create a PCF8575 object for the first module (for relays 9-24)
PCF8575 pcf8575_R2(I2C_ADDRESS_R2); // Create a PCF8575 object for the second module (for relays 1-8)

bool relay24State = HIGH; // Initialize relay 24 state to OFF (assuming HIGH is OFF)

void setup() {
  // Initialize I2C communication
  Wire.begin(SDA, SCL); // SDA on GPIO 8, SCL on GPIO 18 (according to your board's configuration)
 
  // Initialize serial communication for debugging
  Serial.begin(115200);
  Serial.println("PCF8575 Relay 24 Toggle Program: Starting...");

  // Initialize the PCF8575 modules
  pcf8575_R1.begin();
  pcf8575_R2.begin();

  // Ensure that all relays are turned off initially (set all pins HIGH)
  for (int i = 0; i < 16; i++) {
    pcf8575_R1.write(i, HIGH); // Set relays 9-24 to OFF (assuming HIGH means OFF for relays)
    pcf8575_R2.write(i, HIGH); // Set relays 1-8 to OFF (assuming HIGH means OFF for relays)
  }
}

void loop() {
  // Toggle relay 24 state (relay 24 corresponds to pin 15 on pcf8575_R1)
  relay24State = !relay24State; // Toggle the state
  pcf8575_R1.write(15, relay24State); // Write the new state to relay 24

  // Print the current state of relay 24 to the serial port
  if (relay24State == LOW) {
    Serial.println("Relay 24 is ON");
  } else {
    Serial.println("Relay 24 is OFF");
  }

  // Wait for 2 seconds before toggling again
  delay(TOGGLE_DELAY);
}
arduino ino file download: 

.zip   12-control-one-relay.zip (Size: 1.09 KB / Downloads: 28)

Print this item