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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,061
» Latest member: trueseed
» Forum threads: 3,554
» Forum posts: 18,229

Full Statistics

Online Users
There are currently 34 online users.
» 0 Member(s) | 16 Guest(s)
AhrefsBot, Amazonbot, Crawl, Mediapartners-Google, PetalBot, Sogou web, bot, github.com

Latest Threads
KC-868 COLB - I do not se...
Forum: KC868-HxB series Smart Controller
Last Post: Alois Láska
12 minutes ago
» Replies: 10
» Views: 567
KC868-A16v3 Issue, No Dis...
Forum: KC868-A16v3
Last Post: admin
3 hours ago
» Replies: 1
» Views: 7
KC868-A8V3 and ESPHome fi...
Forum: KC868-HxB series Smart Controller
Last Post: admin
11 hours ago
» Replies: 5
» Views: 35
KinCony T32M Tiny ESP32 S...
Forum: News
Last Post: admin
11 hours ago
» Replies: 4
» Views: 303
N30 + KCS v3.15.0 firmwar...
Forum: N30
Last Post: HolyKirka
Yesterday, 11:41 AM
» Replies: 4
» Views: 30
N30+KCS v3.15.0
Forum: "KCS" v3 firmware
Last Post: HolyKirka
Yesterday, 06:22 AM
» Replies: 6
» Views: 41
Z1 Transmit action from. ...
Forum: KC868-AG / AG Pro / AG8 / Z1
Last Post: admin
11-12-2025, 11:11 PM
» Replies: 11
» Views: 311
Using KC868 A2 with Home ...
Forum: KC868-A2
Last Post: admin
11-12-2025, 10:45 PM
» Replies: 1
» Views: 29
KC868-A6 case 3D model
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
11-12-2025, 12:09 PM
» Replies: 3
» Views: 24
KinCony E16v3 RS485 Din R...
Forum: News
Last Post: admin
11-12-2025, 12:17 AM
» Replies: 0
» Views: 15

  [arduino code examples for DM16]-02 Read digital input ports state
Posted by: admin - 09-09-2025, 02:51 AM - Forum: DM16 - No Replies

Code:
/*
* -----------------------------------------------------------------------------
* KinCony DM16 16-Channel Digital Input Reader using PCF8575
*
* This Arduino sketch reads the state of 16 digital input channels from a
* PCF8575 I/O expander over I2C and prints their status to the serial monitor.
*
* Input logic:
*   - Input 0 = ON
*   - Input 1 = OFF (with pull-up logic)
*
* Hardware:
*   - PCF8575 I/O Expander (I2C Address: 0x22)
*   - Custom input pin mapping as defined below
*   - I2C SDA pin: GPIO8
*   - I2C SCL pin: GPIO18
*
* Author: KinCony IoT
* Website: https://www.kincony.com
* License: MIT License
* -----------------------------------------------------------------------------
*/

#include <Wire.h>
#include "PCF8575.h"

// Define I2C pins
#define I2C_SDA 8   // SDA pin
#define I2C_SCL 18  // SCL pin

// Set the I2C address for PCF8575
PCF8575 pcf8575_IN1(0x22); // 0x22 is the I2C address for the DM16 module

void setup() {
    Serial.begin(115200);

    // Initialize I2C with specified SDA and SCL pins
    Wire.begin(I2C_SDA, I2C_SCL);

    // Start communication with PCF8575 device
    pcf8575_IN1.begin();

    Serial.println("KinCony DM16 16 channel input state 0:ON  1:OFF");
}

void loop() {
    // Define custom pin read order to match hardware mapping
    uint8_t pin_order[16] = {
        8, 9, 10, 11, 12, 13, 14, 15,
        0, 1, 2, 3, 4, 5, 6, 7
    };

    Serial.print("Input state: ");

    // Loop through all 16 pins and read their state
    for (int i = 0; i < 16; i++) {
        bool state = pcf8575_IN1.read(pin_order[i]); // Read pin state (HIGH or LOW)
        Serial.print(state); // Print state: 0 = ON, 1 = OFF
        Serial.print(" ");
    }

    Serial.println(); // Print new line
    delay(500);       // Wait for 500ms before next read
}
arduino ino file download:

.zip   2-digital-input.zip (Size: 995 bytes / Downloads: 127)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 

.zip   2-digital-input.ino.merged.zip (Size: 192.34 KB / Downloads: 133)

Print this item

  [arduino code examples for DM16]-01 16 Channel DAC output by digital input
Posted by: admin - 09-09-2025, 02:49 AM - Forum: DM16 - No Replies

Code:
/*
* ----------------------------------------------------------------------------
* Copyright (c) 2025 KinCony IoT
*
* ----------------------------------------------------------------------------
*/

#include <Adafruit_PCF8575.h>
#include <HardwareSerial.h>

// Define Modbus RTU frame format constants
#define MODBUS_READ_COILS 0x01
#define MODBUS_READ_REGISTERS 0x03
#define MODBUS_WRITE_SINGLE_REGISTER 0x06
#define MODBUS_WRITE_MULTIPLE_REGISTERS 0x10

/* Example for 16 input buttons that are connected from the GPIO expander pins to ground.
* Note: The buttons must be connected with the other side of the switch to GROUND.
* There is a built-in pull-up resistor on each input, but no pull-down resistor capability.
*/
#define SDA_PIN 8
#define SCL_PIN 18
#define ADDRESS_PCF8575 0x22

#define ST_RX   4 //// ESP32 receive pin
#define ST_TX   6 //// ESP32 send pin
typedef enum {KEY_RELEASE=0, KEY_SHORT_PRESSED, KEY_LONG_PRESSED} KEY_STATUS;

typedef struct {
  uint8_t key_index;
  KEY_STATUS key_status;
  long key_time_start;
  long key_time_rec;
  long key_press_time;
  int16_t key_press_cnt;    //// Send serial data every 100ms
  int16_t key_press_cnt_old;
  float current_light;      /// Percentage of 0-4095
} KEY_PRESS_PROP;

KEY_PRESS_PROP key_press_prop[16] = {0};

Adafruit_PCF8575 pcf;
HardwareSerial myst_serial(1);

TwoWire myI2c = TwoWire(0);

// Modbus CRC16 calculation function
uint16_t modbus_crc16(uint8_t *data, uint16_t length) {
  uint16_t crc = 0xFFFF;
 
  for (uint16_t i = 0; i < length; i++) {
    crc ^= data[i];
    for (uint8_t j = 0; j < 8; j++) {
      if (crc & 0x0001) {
        crc = (crc >> 1) ^ 0xA001;
      } else {
        crc = crc >> 1;
      }
    }
  }
  return crc;
}

/**
* Send Modbus RTU frame
*
* @param serial HardwareSerial object
* @param address Slave address (1-247)
* @param function Function code
* @param data Data section
* @param dataLen Data length
*/
void send_modbus_frame(HardwareSerial &serial, uint8_t address, uint8_t function,
                      const uint8_t *data, uint16_t dataLen) {
  // Create send buffer
  uint16_t totalLen = 1 + 1 + dataLen + 2; // Address + Function code + Data + CRC
  uint8_t buffer[totalLen];
 
  // Fill address and function code
  buffer[0] = address;
  buffer[1] = function;
 
  // Copy data
  memcpy(&buffer[2], data, dataLen);
 
  // Calculate CRC (excluding CRC section)
  uint16_t crc = modbus_crc16(buffer, 2 + dataLen);
 
  // Add CRC (little-endian: low byte first)
  buffer[2 + dataLen] = crc & 0xFF;         // CRC low byte
  buffer[3 + dataLen] = (crc >> 8) & 0xFF;  // CRC high byte
 
  // Send complete frame
  for (uint16_t i = 0; i < totalLen; i++) {
    serial.write(buffer[i]);
  }
 
  // Flush send buffer to ensure all data is sent
  serial.flush();
}

// Encapsulation of common Modbus functions

/**
* Send "Read Holding Registers" request
*
* @param serial HardwareSerial object
* @param address Slave address
* @param startReg Start register address
* @param numRegs Number of registers to read
*/
void modbus_read_registers(HardwareSerial &serial, uint8_t address,
                          uint16_t startReg, uint16_t numRegs) {
  uint8_t data[4];
 
  // Fill register address and quantity in big-endian
  data[0] = (startReg >> 8) & 0x
arduino ino file download:

.zip   1-dac-16ch.zip (Size: 1.47 KB / Downloads: 138)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:

.zip   1-dac-16ch.ino.merged.zip (Size: 205.57 KB / Downloads: 134)

Print this item

  DM16 ESPHome yaml for home assistant with tuya
Posted by: admin - 09-09-2025, 02:39 AM - Forum: DM16 - No Replies

Code:
esphome:
  name: dm16
  friendly_name: dm16
  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.2.0

# Enable logging
logger:
  baud_rate: 0
  hardware_uart: UART0

# Enable Home Assistant API
api:

ota:
  platform: esphome

web_server:
  port: 80

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

i2c:
   - id: bus_a
     sda: 8
     scl: 18
     scan: true
     frequency: 400kHz
     
text_sensor:
  - platform: ethernet_info
    ip_address:
      name: ESP IP Address
      id: eth_ip
      address_0:
        name: ESP IP Address 0
      address_1:
        name: ESP IP Address 1
      address_2:
        name: ESP IP Address 2
      address_3:
        name: ESP IP Address 3
      address_4:
        name: ESP IP Address 4
    dns_address:
      name: ESP DNS Address
    mac_address:
      name: ESP MAC Address

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

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.printf(0, 15, id(roboto), "IP: %s", id(eth_ip).state.c_str());
uart:
  - id: dac_uart
    rx_pin: 4
    tx_pin: 6
    baud_rate: 115200
    stop_bits: 1
    data_bits: 8
    parity: NONE
  - id: tuya_mcu_uart 
    tx_pin: 16
    rx_pin: 17
    baud_rate: 9600

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

modbus:
  - uart_id: dac_uart

modbus_controller:
  - address: 1
    update_interval: 5s

output:
  # CH1 (0x0FA0 / 4000)
  - platform: modbus_controller
    id: dac_ch1_out
    address: 0x0FA0
    value_type: U_WORD
    write_lambda: |-
      // state = 0.0 ~ 1.0 → 0 ~ 4095
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH2 (0x0FA1 / 4001)
  - platform: modbus_controller
    id: dac_ch2_out
    address: 0x0FA1
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH3
  - platform: modbus_controller
    id: dac_ch3_out
    address: 0x0FA2
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH4
  - platform: modbus_controller
    id: dac_ch4_out
    address: 0x0FA3
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH5
  - platform: modbus_controller
    id: dac_ch5_out
    address: 0x0FA4
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH6
  - platform: modbus_controller
    id: dac_ch6_out
    address: 0x0FA5
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH7
  - platform: modbus_controller
    id: dac_ch7_out
    address: 0x0FA6
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH8
  - platform: modbus_controller
    id: dac_ch8_out
    address: 0x0FA7
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH9
  - platform: modbus_controller
    id: dac_ch9_out
    address: 0x0FA8
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH10
  - platform: modbus_controller
    id: dac_ch10_out
    address: 0x0FA9
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH11
  - platform: modbus_controller
    id: dac_ch11_out
    address: 0x0FAA
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH12
  - platform: modbus_controller
    id: dac_ch12_out
    address: 0x0FAB
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH13
  - platform: modbus_controller
    id: dac_ch13_out
    address: 0x0FAC
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH14
  - platform: modbus_controller
    id: dac_ch14_out
    address: 0x0FAD
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH15
  - platform: modbus_controller
    id: dac_ch15_out
    address: 0x0FAE
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH16
  - platform: modbus_controller
    id: dac_ch16_out
    address: 0x0FAF
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

# -------------------
# 16 路 Light (调光灯)
# -------------------
light:
  - platform: monochromatic
    name: "DAC CH1"
    output: dac_ch1_out
    id: light_1
    default_transition_length: 0s
 
  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH1"
    # bind other light, sync state
    bind_light_id: light_1
    output: dac_ch1_out
    dp_id: 2
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH2"
    output: dac_ch2_out
    id: light_2
    default_transition_length: 0s
 
  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH2"
    # bind other light, sync state
    bind_light_id: light_2
    output: dac_ch2_out
    dp_id: 8
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH3"
    output: dac_ch3_out
    id: light_3
    default_transition_length: 0s

  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH3"
    # bind other light, sync state
    bind_light_id: light_3
    output: dac_ch3_out
    dp_id: 16
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH4"
    output: dac_ch4_out
    id: light_4
    default_transition_length: 0s
 
  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH4"
    # bind other light, sync state
    bind_light_id: light_4
    output: dac_ch4_out
    dp_id: 101
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH5"
    output: dac_ch5_out
    id: light_5
    default_transition_length: 0s

  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH5"
    # bind other light, sync state
    bind_light_id: light_5
    output: dac_ch5_out
    dp_id: 102
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH6"
    output: dac_ch6_out
    id: light_6
    default_transition_length: 0s

  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH6"
    # bind other light, sync state
    bind_light_id: light_6
    output: dac_ch6_out
    dp_id: 103
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH7"
    output: dac_ch7_out
    id: light_7
    default_transition_length: 0s
 
  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH7"
    # bind other light, sync state
    bind_light_id: light_7
    output: dac_ch7_out
    dp_id: 104
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH8"
    output: dac_ch8_out
    id: light_8
    default_transition_length: 0s
 
  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH8"
    # bind other light, sync state
    bind_light_id: light_8
    output: dac_ch8_out
    dp_id: 105
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH9"
    output: dac_ch9_out
    id: light_9
    default_transition_length: 0s
 
  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH9"
    # bind other light, sync state
    bind_light_id: light_9
    output: dac_ch9_out
    dp_id: 106
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH10"
    output: dac_ch10_out
    id: light_10
    default_transition_length: 0s

  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH10"
    # bind other light, sync state
    bind_light_id: light_10
    output: dac_ch10_out
    dp_id: 107
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH11"
    output: dac_ch11_out
    id: light_11
    default_transition_length: 0s
 
  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH11"
    # bind other light, sync state
    bind_light_id: light_11
    output: dac_ch11_out
    dp_id: 108
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH12"
    output: dac_ch12_out
    id: light_12
    default_transition_length: 0s

  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH12"
    # bind other light, sync state
    bind_light_id: light_12
    output: dac_ch12_out
    dp_id: 109
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH13"
    output: dac_ch13_out
    id: light_13
    default_transition_length: 0s

  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH13"
    # bind other light, sync state
    bind_light_id: light_13
    output: dac_ch13_out
    dp_id: 110
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH14"
    output: dac_ch14_out
    id: light_14
    default_transition_length: 0s

  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH14"
    # bind other light, sync state
    bind_light_id: light_14
    output: dac_ch14_out
    dp_id: 111
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH15"
    output: dac_ch15_out
    id: light_15
    default_transition_length: 0s
 
  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH15"
    # bind other light, sync state
    bind_light_id: light_15
    output: dac_ch15_out
    dp_id: 112
    # hide from homeassistant ui
    internal: true

  - platform: monochromatic
    name: "DAC CH16"
    output: dac_ch16_out
    id: light_16
    default_transition_length: 0s
 
  - platform: tuya_wifi_mcu
    name: "Tuya DAC CH16"
    # bind other light, sync state
    bind_light_id: light_16
    output: dac_ch16_out
    dp_id: 113
    # hide from homeassistant ui
    internal: true



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

binary_sensor:
  - platform: gpio
    name: "dm16-input01"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 8
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input02"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 9
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input03"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 10
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input04"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 11
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input05"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 12
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input06"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 13
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input07"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 14
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input08"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 15
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input09"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input10"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input11"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input12"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input13"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input14"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input15"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input16"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true

ads1115:
  - address: 0x48
sensor:
  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 6.144
    resolution: 16_BITS
    name: "ADS1115 Channel A0-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A1_GND'
    gain: 6.144
    name: "ADS1115 Channel A1-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A2_GND'
    gain: 6.144
    name: "ADS1115 Channel A2-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A3_GND'
    gain: 6.144
    name: "ADS1115 Channel A3-GND"
    update_interval: 5s
esphome yaml file download:

.txt   DM16-HA-with-Tuya.txt (Size: 13.11 KB / Downloads: 62)

Print this item

  KinCony DM16 Smart Dimmer Controller released
Posted by: admin - 09-09-2025, 02:25 AM - Forum: News - No Replies

KinCony DM16 ESP32 smart dimmer controller based on ESP32-S3-WROOM-1U (N16R8) wifi chip. Support 16 channel DC 0-10v output, 7 channel 1-wire GPIOs, 4 channel ADS1115 16bit analog input ports. One SD card using SPI bus. DM16 include DS3231 high precision RTC clock chip. OLED display will show wifi and ethernet IP address and Tuya connection state. DM16 have 2pcs of RS485 port. one RS485 connect with ARM CPU, support use by modbus directly. Another RS485 work with ESP32. You can write any code by Arduino IDE / MicroPython / ESP-IDF development tool to ESP32 module. We will supply Arduino / ESP-IDF demo code for different samples. Everyone can modify and change the code for your own smart home automation system project. it support use by ESPHome for home assistant or tasmota firmware for smart home automation DIY. DM16 use KCS v3 firmware, it support home assistant auto discovery function by MQTT, so without write any config code (zero code) for home assistant. KCS v3 support KinCony cloud service (official shop customer free 2 years), remote monitor and control device by webpage in anywhere. KCS v3 support KinCony board integrate to Loxone Miniserver. Support Apple HomeKit for Siri.
[Image: DM16-1.jpg]
Model No. KinCony DM16
Description: KinCony 16 Channel ESP32-S3 Smart Dimmer Controller – DM16
Power supply: 12-24V DC
Processor: ESP32-S3-WROOM-1U (N16R8)
Size: 174mm*83mm*59mm
interfaces: Ethernet(RJ45)-LAN 100Mbps IPv4/IPv6,WiFi,RS485,Bluetooth,USB-C,OLED,Tuya Module
RTC: DS3231 high precision chip (battery socket on PCB)
SD Card: SPI bus
Installation method: DIN RAIL
OLED: SSD1306 I2C display
Outputs:
16CH 0-10v Outputs.
Inputs:
ADS1115 16bit ADC: 2CH analog input DC0-5V (A1,A2) 2CH analog input 4-20mA (A3,A4)
16CH dry contact inputs (optocoupler isolation, long distance circuit for MAX 500 meters cable)
4 buttons: 1:ESP32 Reset 2:ESP32 Download 3:Tuya config 4: ARM CPU Reset
1-Wire GPIO: 4CH (with pull-up resistance on PCB)
Free GPIO: 4CH (ESP32 pin directly, without pull-up resistance on PCB)
[Image: DM16-2.jpg]

Print this item

  DM16 ESPHome yaml for home assistant without tuya
Posted by: admin - 09-09-2025, 02:17 AM - Forum: DM16 - No Replies

Code:
esphome:
  name: dm16
  friendly_name: dm16

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  platform: esphome

web_server:
  port: 80

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

i2c:
   - id: bus_a
     sda: 8
     scl: 18
     scan: true
     frequency: 400kHz
     
text_sensor:
  - platform: ethernet_info
    ip_address:
      name: ESP IP Address
      id: eth_ip
      address_0:
        name: ESP IP Address 0
      address_1:
        name: ESP IP Address 1
      address_2:
        name: ESP IP Address 2
      address_3:
        name: ESP IP Address 3
      address_4:
        name: ESP IP Address 4
    dns_address:
      name: ESP DNS Address
    mac_address:
      name: ESP MAC Address

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

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.printf(0, 15, id(roboto), "IP: %s", id(eth_ip).state.c_str());
uart:
  id: dac_uart
  rx_pin: 4
  tx_pin: 6
  baud_rate: 115200
  stop_bits: 1
  data_bits: 8
  parity: NONE
  debug:

modbus:

modbus_controller:
  - address: 1
    update_interval: 5s

output:
  # CH1 (0x0FA0 / 4000)
  - platform: modbus_controller
    id: dac_ch1_out
    address: 0x0FA0
    value_type: U_WORD
    write_lambda: |-
      // state = 0.0 ~ 1.0 → 0 ~ 4095
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH2 (0x0FA1 / 4001)
  - platform: modbus_controller
    id: dac_ch2_out
    address: 0x0FA1
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH3
  - platform: modbus_controller
    id: dac_ch3_out
    address: 0x0FA2
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH4
  - platform: modbus_controller
    id: dac_ch4_out
    address: 0x0FA3
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH5
  - platform: modbus_controller
    id: dac_ch5_out
    address: 0x0FA4
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH6
  - platform: modbus_controller
    id: dac_ch6_out
    address: 0x0FA5
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH7
  - platform: modbus_controller
    id: dac_ch7_out
    address: 0x0FA6
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH8
  - platform: modbus_controller
    id: dac_ch8_out
    address: 0x0FA7
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH9
  - platform: modbus_controller
    id: dac_ch9_out
    address: 0x0FA8
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH10
  - platform: modbus_controller
    id: dac_ch10_out
    address: 0x0FA9
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH11
  - platform: modbus_controller
    id: dac_ch11_out
    address: 0x0FAA
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH12
  - platform: modbus_controller
    id: dac_ch12_out
    address: 0x0FAB
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH13
  - platform: modbus_controller
    id: dac_ch13_out
    address: 0x0FAC
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH14
  - platform: modbus_controller
    id: dac_ch14_out
    address: 0x0FAD
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH15
  - platform: modbus_controller
    id: dac_ch15_out
    address: 0x0FAE
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

  # CH16
  - platform: modbus_controller
    id: dac_ch16_out
    address: 0x0FAF
    value_type: U_WORD
    write_lambda: |-
      uint16_t reg = (uint16_t) round(x * 4095.0);
      return reg;

# -------------------
# 16 Channel Dimmer
# -------------------
light:
  - platform: monochromatic
    name: "DAC CH1"
    output: dac_ch1_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH2"
    output: dac_ch2_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH3"
    output: dac_ch3_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH4"
    output: dac_ch4_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH5"
    output: dac_ch5_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH6"
    output: dac_ch6_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH7"
    output: dac_ch7_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH8"
    output: dac_ch8_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH9"
    output: dac_ch9_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH10"
    output: dac_ch10_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH11"
    output: dac_ch11_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH12"
    output: dac_ch12_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH13"
    output: dac_ch13_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH14"
    output: dac_ch14_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH15"
    output: dac_ch15_out
    default_transition_length: 0s

  - platform: monochromatic
    name: "DAC CH16"
    output: dac_ch16_out
    default_transition_length: 0s



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

binary_sensor:
  - platform: gpio
    name: "dm16-input01"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 8
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input02"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 9
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input03"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 10
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input04"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 11
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input05"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 12
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input06"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 13
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input07"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 14
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input08"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 15
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input09"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input10"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input11"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input12"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input13"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input14"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input15"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "dm16-input16"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true

ads1115:
  - address: 0x48
sensor:
  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 6.144
    resolution: 16_BITS
    name: "ADS1115 Channel A0-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A1_GND'
    gain: 6.144
    name: "ADS1115 Channel A1-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A2_GND'
    gain: 6.144
    name: "ADS1115 Channel A2-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A3_GND'
    gain: 6.144
    name: "ADS1115 Channel A3-GND"
    update_interval: 5s
   
esphome yaml file download:

.txt   DM16-HA-without Tuya.txt (Size: 9.49 KB / Downloads: 69)

Print this item

Sad AG Pro - Disappointed
Posted by: vishal.alex@gmail.com - 09-08-2025, 11:54 AM - Forum: KC868-AG / AG Pro / AG8 / Z1 - Replies (5)

I brought the AG Pro in June of 2024 when i saw that it had all in one as a Gateway. It was advertised in such a way that it was all in one solution. But as soon as i received it, i found that many of the things advertised is not functioning out of the box. the Zigbee had to be used with tasmota and remaining functions like IR, RF, Tuya and to be with Kincony firmware. and on top of this both firmware cannot work together. I some how managed to flash the Tasmota firmware because i needed the ZHA integration.. and this worked until last month. Now the tasmota firmware has failed to recognize the Zigbee device inside. i tried rolling back to several tasmota version but it all remains the same. 

I sent a message to their support and all the response i get is to change the firmware. I feel dumped.. Kincony should have either fixed the firmware issues or informed the customer that these problems exits. 92$(inc Shipping) wasted.

Print this item

  1-WIRE multiple sensors
Posted by: Ndogo - 09-08-2025, 09:29 AM - Forum: KC868-A16v3 - Replies (1)

Can I connect multiple DS18B20 sensors to one 47 GPIO in the native firmware?

Print this item

  KinCony Raspberry Pi CM5 Linux Server released
Posted by: admin - 09-07-2025, 08:59 AM - Forum: News - No Replies

KinCony Pi5 is a Raspberry Pi CM5 server for smart home automation and industrial automation control. It can use for home assistant local server. It's a Linux computer, you can install software by yourself, such as Node red. The product default CM5 version is CM5004000. It without Bluetooth and wifi, RAM:4G Lite version.
[Image: Pi5_1.jpg]
Model No. KinCony Pi5
Description: KinCony Automation Local Server – Pi5
Power supply: 12-24V DC
Processor: Raspberry Pi Compute Module 5
Size: 139mm*83mm*56mm
interfaces: Ethernet(RJ45)-LAN 1000Mbps IPv4/IPv6,USB-C
Installation method: DIN RAIL
2 × USB 3 sockets
microSD card socket for CM5 Lite modules
M.2 M key PCIe socket
1 × full-size HDMI 2.0 connectors
DIP SWITCH for jumpers
[Image: Pi5_2.jpg]

Print this item

  DM16 ESP32-S3 IO pins define
Posted by: admin - 09-07-2025, 02:31 AM - Forum: DM16 - No Replies

SDA:GPIO8
SCL:GPIO18

PCF8575: (input1-16): i2c address:0x22 by B16-core

P8:input1
P9:input2
P10:input3
P11:input4
P12:input5
P13:input6
P14:input7
P15:input8

P0:input9
P1:input10
P2:input11
P3:input12
P4:input13
P5:input14
P6:input15
P7:input16

ADS1115 (4CH ADC): i2c address:0x48
Analog input (A1: DC 0-5v)
Analog input (A2: DC 0-5v)
Analog input (A3: DC 4-20mA)
Analog input (A4: DC 4-20mA)

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

1-wire (pull-up resistance on PCB):
1-wire1:GPIO47
1-wire2:GPIO48
1-wire3:GPIO7
1-wire4:GPIO40

free GPIOs:
GPIO13
GPIO14
GPIO21

-----------------------
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

ARM CPU TXD:GPIO4
ARM CPU RXD:GPIO6

Print this item

  "KCS" v3.12.0 firmware BIN file download
Posted by: admin - 09-06-2025, 04:56 AM - Forum: "KCS" v3 firmware - No Replies

v3.12.0 improvement:
1. Adapt to new KinCony Controller: B8/B8M/B24/B24M/DM16
2. Sensor pull-up option: When PCB include pull-up resistor, "pull-up" will auto shown as enabled
3. Network webpage -- LAN mode will show the actual ethernet IP address
4. GSM phone list: Add ID numbers
5. Password-related inputs option added masking
6. Sensor configuration webpage: added sensor name
7. IFTTT "sensor channel" change to "sensor name" have preset
8. Removed default MQTT port number "1883"
9. IFTTT THEN actions: Add "step value" for AO (analog output)
10. improve previous version first time downloaded firmware boot up speed slowly issue.



Attached Files
.zip   KCS_A2V3_V3.12.0.zip (Size: 1.07 MB / Downloads: 181)
.zip   KCS_A6V3_V3.12.0.zip (Size: 1.04 MB / Downloads: 198)
.zip   KCS_A8V3_V3.12.0.zip (Size: 1.09 MB / Downloads: 175)
.zip   KCS_A16V3_V3.12.0.zip (Size: 1.11 MB / Downloads: 250)
.zip   KCS_A32PRO_V3.12.0.zip (Size: 1.08 MB / Downloads: 161)
.zip   KCS_AG8_V3.12.0.zip (Size: 1.06 MB / Downloads: 145)
.zip   KCS_ALR_V3.12.0.zip (Size: 1.02 MB / Downloads: 143)
.zip   KCS_B8_V3.12.0.zip (Size: 1.1 MB / Downloads: 153)
.zip   KCS_B8M_V3.12.0.zip (Size: 1.1 MB / Downloads: 163)
.zip   KCS_B16_V3.12.0.zip (Size: 1.1 MB / Downloads: 163)
.zip   KCS_B16M_V3.12.0.zip (Size: 1.1 MB / Downloads: 144)
.zip   KCS_B24_V3.12.0.zip (Size: 1.1 MB / Downloads: 140)
.zip   KCS_B24M_V3.12.0.zip (Size: 1.1 MB / Downloads: 145)
.zip   KCS_DM16_V3.12.0.zip (Size: 1.07 MB / Downloads: 146)
.zip   KCS_F8_V3.12.0.zip (Size: 1.09 MB / Downloads: 150)
.zip   KCS_F16_V3.12.0.zip (Size: 1.1 MB / Downloads: 162)
.zip   KCS_F24_V3.12.0.zip (Size: 1.1 MB / Downloads: 153)
.zip   KCS_G1_V3.12.0.zip (Size: 1.06 MB / Downloads: 161)
.zip   KCS_KC_TA_V3.12.0.zip (Size: 1.05 MB / Downloads: 137)
.zip   KCS_N60_V3.12.0.zip (Size: 986.2 KB / Downloads: 165)
.zip   KCS_T16M_V3.12.0.zip (Size: 1.05 MB / Downloads: 170)
.zip   KCS_T32M_V3.12.0.zip (Size: 1.07 MB / Downloads: 157)
.zip   KCS_T64M_V3.12.0.zip (Size: 1.07 MB / Downloads: 154)
.zip   KCS_T128M_V3.12.0.zip (Size: 1.07 MB / Downloads: 158)
.zip   KCS_Z1_V3.12.0.zip (Size: 1.21 MB / Downloads: 160)
Print this item