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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 10,314
» Latest member: LukeRodgel
» Forum threads: 4,289
» Forum posts: 21,228

Full Statistics

Online Users
There are currently 357 online users.
» 0 Member(s) | 339 Guest(s)
AhrefsBot, Amazonbot, Baidu, Bing, Bytespider, Crawl, Google, PetalBot, bot

Latest Threads
[Bug] A16v3 KCS 3.27.2 - ...
Forum: "KCS" v3 firmware
Last Post: admin
Today, 03:53 AM
» Replies: 2
» Views: 97
KC868-A128 Arduino Demo: ...
Forum: KC868-A128
Last Post: admin
Today, 03:24 AM
» Replies: 0
» Views: 24
KC868-A128 Arduino Chasin...
Forum: KC868-A128
Last Post: admin
Today, 03:23 AM
» Replies: 0
» Views: 5
KC868-AP – max current pe...
Forum: KC868-AP / ADR
Last Post: admin
Today, 01:01 AM
» Replies: 4
» Views: 58
[Arduino source code for ...
Forum: KC868-A2
Last Post: admin
Today, 12:57 AM
» Replies: 2
» Views: 1,604
KC868-A8v3 ModBus Temp. S...
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
Today, 12:56 AM
» Replies: 3
» Views: 1,270
Which KinCony board for a...
Forum: DIY Project
Last Post: admin
10-21-2026, 06:26 AM
» Replies: 3
» Views: 70
KC868-HAv2: TS sensor on ...
Forum: KC868-HA /HA v2
Last Post: swisstmack25
10-20-2026, 07:00 AM
» Replies: 4
» Views: 80
MT4v2 Driver Board Web To...
Forum: MT4v2
Last Post: admin
10-20-2026, 03:37 AM
» Replies: 0
» Views: 30
ARM CPU Modbus communicat...
Forum: MT4v2
Last Post: admin
10-20-2026, 03:36 AM
» Replies: 0
» Views: 29

  [arduino code examples for TA]-01 Turn ON/OFF relay
Posted by: admin - 04-03-2025, 06:36 AM - Forum: TA - No Replies

Code:
// Made by KinCony IoT: https://www.kincony.com

#include <Wire.h>        // Include I2C communication library
#include <PCF8575.h>     // Include PCF8575 library

#define SDA_PIN 8        // I2C SDA pin
#define SCL_PIN 18       // I2C SCL pin

#define RELAY1 14        // Relay 1 (PCF8575 CH15)
#define RELAY2 15       // Relay 2 (PCF8575 CH16)

#define I2C_ADDRESS 0x22 // I2C address of PCF8575

PCF8575 pcf8575(I2C_ADDRESS); // Create PCF8575 object

void setup() {
    Wire.begin(SDA_PIN, SCL_PIN); // Initialize I2C bus
    Serial.begin(115200);
    Serial.println("PCF8575 Relay Control: Starting...");

    pcf8575.begin(); // Initialize PCF8575

    // Initialize relay state, default OFF (HIGH)
    pcf8575.write(RELAY1, HIGH);
    pcf8575.write(RELAY2, HIGH);
    Serial.println("All relays are OFF");
}

void loop() {
    Serial.println("Turning Relay 1 ON");
    pcf8575.write(RELAY1, LOW); // Turn ON relay 1
    delay(2000);
    Serial.println("Turning Relay 1 OFF");
    pcf8575.write(RELAY1, HIGH); // Turn OFF relay 1
    delay(2000);

    Serial.println("Turning Relay 2 ON");
    pcf8575.write(RELAY2, LOW); // Turn ON relay 2
    delay(2000);
    Serial.println("Turning Relay 2 OFF");
    pcf8575.write(RELAY2, HIGH); // Turn OFF relay 2
    delay(2000);
}
arduino ino file download:

.zip   1-output.zip (Size: 631 bytes / Downloads: 737)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:

.zip   1-output.ino.merged.zip (Size: 192.13 KB / Downloads: 743)

Print this item

  TA ESPHome yaml for home assistant
Posted by: admin - 04-03-2025, 06:33 AM - Forum: TA - No Replies

Code:
esphome:
  name: ta
  friendly_name: TA
  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
#logger:
#  level: DEBUG
#   hardware_uart: USB_SERIAL_JTAG
# Enable Home Assistant API
api:
  encryption:
    key: "WeVOuL5oNhjXcfzXtTirlOwvtWvCD5yqIxd3oV4es1k="

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

wifi:
  ssid: KinCony
  password: 'a12345678'

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

pcf8574:
  - id: 'pcf8574_hub_out_1'  # for output channel 1-16
    i2c_id: bus_a
    address: 0x22
    pcf8575: true

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

  - id: tuya_mcu_uart
    tx_pin: GPIO16
    rx_pin: GPIO17
    baud_rate: 9600

tuya_wifi_mcu:
  # tuya mcu product id
  product_id: asowcylz7am5cbtp
  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: "ta-output01"
    id: "ta_output01"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 14
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: ta-output1-tuya
    dp_id: 1
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "ta_output01"

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


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

  - platform: gpio
    name: "ta-input02"
    id: "ta_input02"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: ta-input2-tuya
    dp_id: 112
    bind_binary_sensor_id: ta_input02
    internal: true

  - platform: gpio
    name: "ta-input03"
    id: "ta_input03"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: ta-input3-tuya
    dp_id: 113
    bind_binary_sensor_id: ta_input03
    internal: true

  - platform: gpio
    name: "ta-input04"
    id: "ta_input04"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: ta-input4-tuya
    dp_id: 114
    bind_binary_sensor_id: ta_input04
    internal: true

  - platform: gpio
    name: "ta-input05"
    id: "ta_input05"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: ta-input5-tuya
    dp_id: 115
    bind_binary_sensor_id: ta_input05
    internal: true

  - platform: gpio
    name: "ta-input06"
    id: "ta_input06"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: ta-input6-tuya
    dp_id: 116
    bind_binary_sensor_id: ta_input06
    internal: true

  - platform: gpio
    name: "ta-input07"
    id: "ta_input07"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: ta-input7-tuya
    dp_id: 117
    bind_binary_sensor_id: ta_input07
    internal: true

  - platform: gpio
    name: "ta-input08"
    id: "ta_input08"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: ta-input8-tuya
    dp_id: 118
    bind_binary_sensor_id: ta_input08
    internal: true

  - platform: gpio
    name: "ta-input09"
    id: "ta_input09"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 8
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: ta-input9-tuya
    dp_id: 119
    bind_binary_sensor_id: ta_input09
    internal: true

  - platform: gpio
    name: "ta-input10"
    id: "ta_input10"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 9
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: ta-input10-tuya
    dp_id: 120
    bind_binary_sensor_id: ta_input10
    internal: true

  - platform: gpio
    name: "ta-input11"
    id: "ta_input11"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 10
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: ta-input11-tuya
    dp_id: 121
    bind_binary_sensor_id: ta_input11
    internal: true

  - platform: gpio
    name: "ta-input12"
    id: "ta_input12"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 11
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: ta-input12-tuya
    dp_id: 122
    bind_binary_sensor_id: ta_input12
    internal: true


##pull-up resistance on PCB
  - platform: gpio
    name: "ta-io09"
    pin:
      number: 9
      inverted: true

  - platform: gpio
    name: "ta-io11"
    pin:
      number: 11
      inverted: true

  - platform: gpio
    name: "ta-io05"
    pin:
      number: 5
      inverted: true

  - platform: gpio
    name: "ta-io04"
    pin:
      number: 4
      inverted: true

  - platform: gpio
    name: "ta-io07"
    pin:
      number: 7
      inverted: false

  - platform: gpio
    name: "ta-io06"
    pin:
      number: 6
      inverted:  false

  - platform: gpio
    name: "ta-io13"
    pin:
      number: 13
      inverted:  false

  - platform: gpio
    name: "ta-io40"
    pin:
      number: 40
      inverted:  false

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

  - platform: gpio
    name: "ta-io48"
    pin:
      number: 48
      inverted:  false

  - platform: gpio
    name: "ta-io21"
    pin:
      number: 21
      inverted:  false

  - platform: gpio
    name: "ta-io47"
    pin:
      number: 47
      inverted:  false

  - platform: gpio
    name: "ta-io0"
    pin:
      number: 0
      inverted:  false

  - platform: gpio
    name: "ta-433M-R"
    pin:
      number: 12
      inverted:  false

web_server:
  port: 80

Print this item

  TA ESP32-S3 IO pins define
Posted by: admin - 04-03-2025, 06:33 AM - Forum: TA - No Replies

SDA:GPIO8
SCL:GPIO18

PCF8575:i2c address:0x22
digital input: CH1-12
relay output: CH15,CH16


24C02 EPROM i2c address: 0x50
DS3231 RTC i2c address: 0x68

1-wire (pull-up resistance on PCB):
1-wire1:GPIO9
1-wire2:GPIO11
1-wire3:GPIO5
1-wire4:GPIO4
1-wire5:GPIO7
1-wire6:GPIO6
1-wire7:GPIO13
1-wire8:GPIO40
1-wire9:GPIO14
1-wire10:GPIO48
1-wire11:GPIO21
1-wire12:GPIO47

-----------------------
Ethernet (W5500) I/O define:

clk_pin: GPIO1
mosi_pin: GPIO2
miso_pin: GPIO41
cs_pin: GPIO42

interrupt_pin: GPIO43
reset_pin: GPIO44

--------------------
RS485:
RXD:GPIO38
TXD:GPIO39

Tuya module:
RXD:GPIO17
TXD:GPIO16

Tuya network button: Tuya module's P28
Tuya network LED: Tuya module's P16

RF433M receiver: GPIO12

Print this item

  KC868-A16 rev.1.6 update problem
Posted by: simpl3x - 04-02-2025, 10:01 AM - Forum: "KCS" v2 firmware system - Replies (4)

hi. try to update new device KC868-A16
   

but have error after 15 sec from start
   

Code:
test offset :  0 0x0
case ok
.
Uploading stub...
Running stub...
Stub running...
FLASH_CRYPT_CNT 0
ABS_DONE_0 False
Compressed 2081424 bytes to 792650...
[2025-04-02 12:57:04,480][ESP8266Loader_spi[1]][espDownloader.py][line:606][ERROR]: ESP32 Chip flash download error esp_write_flash.

Print this item

  KC868-A4 - DHT 22
Posted by: ariffakil - 04-02-2025, 09:01 AM - Forum: KC868-A4 - Replies (7)

Dear sir  ., 

i like to know  to   which in i hvae to Connect DHT 22  or 11  in KC-868 -A4 1.2.5   borad , i used  pin 13  but  its cant able to reade

Print this item

  A32pro RGB led strip
Posted by: Nikola - 04-01-2025, 05:11 PM - Forum: DIY Project - Replies (1)

Can i control RGB led strip with B16M or A32pro in home assistant.

Print this item

  Simulating RF Remote Button Press via Relay
Posted by: sebagsm - 04-01-2025, 03:04 PM - Forum: KC868-A16 - Replies (2)

Hi everyone,
I'm using a KC868-A16, and I have an RF remote control that operates at 12V using a 12V battery.
My goal is to use the KC868-A16 to simulate a button press on the RF remote, so I can trigger it from Home Assistant.
I’ve opened the remote and soldered two wires to the button I want to control. I know that:

  • The button is normally at 12V
  • Pressing the button pulls it to GND
I understand that directly connecting the remote’s 12V logic to the KC868-A16 outputs is not safe, since the remote is powered by its own 12V battery and the GNDs are not shared.
So instead, I want to use one of the mechanical relays on the KC868-A16 (e.g. Relay 1) to physically short the button pins, just like a real button press.
My question is:
  • Am I doing this the right way?
  • where to connect the 2 wires on the KC868?
  • Do I need to do anything else to ensure safety or reliability?
Thanks in advance!

Print this item

  KC868-A16 analog input
Posted by: elemarek - 04-01-2025, 01:31 PM - Forum: KC868-A series and Uair Smart Controller - Replies (5)

Is it possible to connect an analog sensor with a 4-20mA output to the KC868-A16? Some say only 0-5V and some say both. If so, how please? Thanks.

Print this item

  M30 negative power
Posted by: Linus68 - 04-01-2025, 11:29 AM - Forum: KC868-M16 / M1 / MB / M30 - Replies (3)

Hi
have the M30  V2.4.10
One clamp is in postive direction one in negative installed, but have always positive power at display.
I can not get negative power. What can this be?

Print this item

  BM16 Problems
Posted by: PWJ - 04-01-2025, 07:49 AM - Forum: B16M - Replies (2)

First of im a newbie so please dont be hard on me. I purchased a B16M with Tuya it arrived yesterday. It came with no instructions but it seemed quite straight forward to connect up. Two terminals marked 12v I powered it up opened the Tuya app and hey presto it found it and installed it.

Once installed all the inputs and outputs were greyed out and no matter what I did. So I started hunting for instructions. Found the forum but couldnt post (but thats another story) found the ESP32 YAML File for home assistant installed that via ESPHome from my home assistant. That worked too but I was still unable to control the relays from HA even though the buttons moved on my HA nothing was happening on the board.

Now when I try to connect via usb the unit connects then disconnect connects then disconnect as if its drawing too much current and dropping out.

Ive since spoken via we chat and discovered there are some more 12v inputs (I suspect these drive the relays) connected these up but now I am just unable to connect to the unit.

Unfortunately Im at work now so unable to try any suggestions until this evening when I get home, but I would be grateful for any help that might point me in the right direction please. Ideally I need to get this back on Tuya.

Thanks Peter

Print this item