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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 10,711
» Latest member: ao88revview
» Forum threads: 4,360
» Forum posts: 21,417

Full Statistics

Online Users
There are currently 405 online users.
» 0 Member(s) | 378 Guest(s)
AhrefsBot, Amazonbot, Applebot, Baidu, Bytespider, Crawl, Google, PetalBot, Semrush, Sogou web, bot, python-requests

Latest Threads
KC868-A16v3 MQTT TLS/SSL ...
Forum: "KCS" v3 firmware
Last Post: admin
1 hour ago
» Replies: 1
» Views: 33
HMI touch panel for Home ...
Forum: Suggestions and feedback on KinCony's products
Last Post: rosnoteh
Yesterday, 11:31 PM
» Replies: 2
» Views: 108
Reset energy counter on N...
Forum: N30
Last Post: admin
Yesterday, 11:03 PM
» Replies: 3
» Views: 65
VisionCamPro-Turn an ESP3...
Forum: DIY Project
Last Post: nikhuge
Yesterday, 09:21 AM
» Replies: 0
» Views: 43
Reading Eastron SDM630 vi...
Forum: N60
Last Post: buttom3
12-01-2026, 12:58 PM
» Replies: 2
» Views: 100
Lumen – Open-Source Smart...
Forum: DIY Project
Last Post: nikhuge
12-01-2026, 09:04 AM
» Replies: 0
» Views: 103
Get Register data by conn...
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
11-30-2026, 11:34 PM
» Replies: 1
» Views: 118
Domticz - native communic...
Forum: KC868-A16
Last Post: admin
11-30-2026, 11:17 PM
» Replies: 3
» Views: 1,384
B4 water tank controller
Forum: B4
Last Post: Fenndy
11-30-2026, 09:05 AM
» Replies: 1
» Views: 153
Calender events instad of...
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
11-28-2026, 11:45 PM
» Replies: 1
» Views: 117

  [arduino code examples for MT4v2]-07 RF433MHz wireless recevier decode
Posted by: admin - 10-20-2026, 03:30 AM - Forum: MT4v2 - No Replies

Code:
#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(digitalPinToInterrupt(14));
  Serial.print("begin test");
}

void loop() {
  if (mySwitch.available()) {
   
    Serial.print("Received ");
    Serial.print( mySwitch.getReceivedValue() );
    Serial.print(" / ");
    Serial.print( mySwitch.getReceivedBitlength() );
    Serial.print("bit ");
    Serial.print("Protocol: ");
    Serial.println( mySwitch.getReceivedProtocol() );

    mySwitch.resetAvailable();
  }
}
arduino ino file download:

.zip   7-RF-433M-receiver.zip (Size: 417 bytes / Downloads: 97)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 

.zip   7-RF-433M-receiver.ino.merged.zip (Size: 181.95 KB / Downloads: 108)

Print this item

  [arduino code examples for MT4v2]-06 How to use SD Card
Posted by: admin - 10-20-2026, 03:28 AM - Forum: MT4v2 - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* SD Card File Operations
*
* This program demonstrates basic file operations on an SD card using the ESP32.
* It includes functionality to:
* - Initialize and test the SD card
* - Read from, write to, append to, and delete files on the SD card
* - Measure file read and write performance
*
* Hardware Connections:
* - SCK: GPIO 11
* - MISO: GPIO 12
* - MOSI: GPIO 10
* - CS: GPIO 9
*/

#include "FS.h"
#include "SD.h"
#include "SPI.h"

// Pin definitions for SD card
#define SCK  11
#define MISO 12
#define MOSI 10
#define CS   9

/**
* @brief Reads the contents of a file from the SD card and prints it to the serial monitor.
*
* @param fs File system to use (in this case, SD).
* @param path Path of the file to read.
*/
void readFile(fs::FS &fs, const char * path) {
  Serial.printf("Reading file: %s\n", path);

  File file = fs.open(path);
  if (!file) {
    Serial.println("Failed to open file for reading");
    return;
  }

  Serial.print("Read from file: ");
  while (file.available()) {
    Serial.print((char)file.read());
  }
  file.close();
}

/**
* @brief Writes a message to a file on the SD card.
*
* @param fs File system to use (in this case, SD).
* @param path Path of the file to write.
* @param message Message to write to the file.
*/
void writeFile(fs::FS &fs, const char * path, const char * message) {
  Serial.printf("Writing file: %s\n", path);

  File file = fs.open(path, FILE_WRITE);
  if (!file) {
    Serial.println("Failed to open file for writing");
    return;
  }
  if (file.print(message)) {
    Serial.println("File written");
  } else {
    Serial.println("Write failed");
  }
  file.close();
}

/**
* @brief Appends a message to a file on the SD card.
*
* @param fs File system to use (in this case, SD).
* @param path Path of the file to append.
* @param message Message to append to the file.
*/
void appendFile(fs::FS &fs, const char * path, const char * message) {
  Serial.printf("Appending to file: %s\n", path);

  File file = fs.open(path, FILE_APPEND);
  if (!file) {
    Serial.println("Failed to open file for appending");
    return;
  }
  if (file.print(message)) {
    Serial.println("Message appended");
  } else {
    Serial.println("Append failed");
  }
  file.close();
}

/**
* @brief Deletes a file from the SD card.
*
* @param fs File system to use (in this case, SD).
* @param path Path of the file to delete.
*/
void deleteFile(fs::FS &fs, const char * path) {
  Serial.printf("Deleting file: %s\n", path);
  if (fs.remove(path)) {
    Serial.println("File deleted");
  } else {
    Serial.println("Delete failed");
  }
}

/**
* @brief Tests file read and write performance.
*
* @param fs File system to use (in this case, SD).
* @param path Path of the file to test.
*/
void testFileIO(fs::FS &fs, const char * path) {
  File file = fs.open(path);
  static uint8_t buf[512];
  size_t len = 0;
  uint32_t start = millis();
  uint32_t end = start;

  if (file) {
    len = file.size();
    size_t flen = len;
    start = millis();
    while (len) {
      size_t toRead = len;
      if (toRead > 512) {
        toRead = 512;
      }
      file.read(buf, toRead);
      len -= toRead;
    }
    end = millis() - start;
    Serial.printf("%u bytes read for %u ms\n", flen, end);
    file.close();
  } else {
    Serial.println("Failed to open file for reading");
  }

  file = fs.open(path, FILE_WRITE);
  if (!file) {
    Serial.println("Failed to open file for writing");
    return;
  }

  size_t i;
  start = millis();
  for (i = 0; i < 2048; i++) {
    file.write(buf, 512);
  }
  end = millis() - start;
  Serial.printf("%u bytes written for %u ms\n", 2048 * 512, end);
  file.close();
}

void setup() {
  // Initialize serial communication
  Serial.begin(115200);
 
  // Initialize SPI and SD card
  SPIClass spi = SPIClass(HSPI);
  spi.begin(SCK, MISO, MOSI, CS);

  if (!SD.begin(CS, spi, 80000000)) {
    Serial.println("Card Mount Failed");
    return;
  }

  uint8_t cardType = SD.cardType();

  if (cardType == CARD_NONE) {
    Serial.println("No SD card attached");
    return;
  }

  Serial.print("SD Card Type: ");
  if (cardType == CARD_MMC) {
    Serial.println("MMC");
  } else if (cardType == CARD_SD) {
    Serial.println("SDSC");
  } else if (cardType == CARD_SDHC) {
    Serial.println("SDHC");
  } else {
    Serial.println("UNKNOWN");
  }

  uint64_t cardSize = SD.cardSize() / (1024 * 1024);
  Serial.printf("SD Card Size: %lluMB\n", cardSize);
  delay(2000);

  // Perform file operations
  deleteFile(SD, "/hello.txt");
  writeFile(SD, "/hello.txt", "Hello ");
  appendFile(SD, "/hello.txt", "World!\n");
  readFile(SD, "/hello.txt");
  testFileIO(SD, "/test.txt");
  Serial.printf("Total space: %lluMB\n", SD.totalBytes() / (1024 * 1024));
  Serial.printf("Used space: %lluMB\n", SD.usedBytes() / (1024 * 1024));
}

void loop() {
  // No operation in loop
}
arduino ino file download:

.zip   6-SD.zip (Size: 1.53 KB / Downloads: 112)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 

.zip   6-SD.ino.merged.zip (Size: 219.15 KB / Downloads: 109)

Print this item

  [arduino code examples for MT4v2]-05 Read free GPIO state
Posted by: admin - 10-20-2026, 03:27 AM - Forum: MT4v2 - No Replies

Code:
/*
* ESP32 GPIO State Reader
* Reads the state of GPIO47, GPIO48, GPIO7, GPIO40, GPIO0, and GPIO5
* and prints the results to the serial monitor.
*
* Made by KinCony IoT: https://www.kincony.com
*/


#define GPIO_40  40
#define GPIO_48  48
#define GPIO_0   0
#define GPIO_47  47
#define GPIO_17  17



void setup() {
    Serial.begin(115200); // Initialize serial communication at 115200 baud rate
   
    // Set GPIOs as input

    pinMode(GPIO_40, INPUT);
    pinMode(GPIO_48, INPUT);
    pinMode(GPIO_0, INPUT);
    pinMode(GPIO_47, INPUT);
    pinMode(GPIO_17, INPUT);           
}

void loop() {
    // Read GPIO states
    int state_40 = digitalRead(GPIO_40);
    int state_48 = digitalRead(GPIO_48);
    int state_0  = digitalRead(GPIO_0);
    int state_47 = digitalRead(GPIO_47);
    int state_17 = digitalRead(GPIO_17);


    // Print GPIO states to the serial monitor
    Serial.printf("GPIO40: %d, GPIO48: %d, GPIO0: %d, GPIO47: %d, GPIO17: %d\n",
                  state_40, state_48, state_0, state_47, state_17);
   
    delay(1000); // Read GPIO states every second
}
arduino ino file download:

.zip   5-free-gpio-state.zip (Size: 685 bytes / Downloads: 107)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 

.zip   5-free-gpio-state.ino.merged.zip (Size: 180.12 KB / Downloads: 101)

Print this item

  [arduino code examples for MT4v2]-04 RS485 communication test
Posted by: admin - 10-20-2026, 03:26 AM - Forum: MT4v2 - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* RS485 Communication Test
*
* This program is a simple test for RS485 communication using ESP32-S3.
* It will send a message over RS485 and then read incoming messages.
* The TXD pin is defined as GPIO 18 and RXD pin is defined as GPIO 8.
*/

#include <HardwareSerial.h>

// Define RS485 pins
#define RS485_RXD 38
#define RS485_TXD 39

// Create a hardware serial object
HardwareSerial rs485Serial(1);

void setup() {
  // Start serial communication for debugging
  Serial.begin(115200);
  while (!Serial);

  // Initialize RS485 Serial communication
  rs485Serial.begin(9600, SERIAL_8N1, RS485_RXD, RS485_TXD);
 
  Serial.println("RS485 Test Start");
}

void loop() {
  // Send a test message
  rs485Serial.println("Hello from KinCony");

  // Wait for a short period
  delay(1000);

  // Check if data is available to read
  if (rs485Serial.available()) {
    String receivedMessage = "";
    while (rs485Serial.available()) {
      char c = rs485Serial.read();
      receivedMessage += c;
    }
    // Print the received message
    Serial.print("Received: ");
    Serial.println(receivedMessage);
  }

  // Wait before sending the next message
  delay(2000);
}
arduino ino file download:

.zip   4-RS485-Test.zip (Size: 758 bytes / Downloads: 96)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 

.zip   4-RS485-Test.ino.merged.zip (Size: 185.84 KB / Downloads: 104)

Print this item

  [arduino code examples for MT4v2]-03 Read ADS1115 analog input ports value
Posted by: admin - 10-20-2026, 03:24 AM - Forum: MT4v2 - No Replies

Code:
/*
* This program reads voltage values from the ADS1115 analog-to-digital converter
* on all four channels (A0, A1, A2, A3) and prints the results through the serial port.
* The ADS1115 communicates via the I2C protocol. This version of the code includes
* the capability to specify custom SDA and SCL pins for I2C communication.
*
* Copyright: Made by KinCony IoT: https://www.kincony.com
*
*/

#include <Wire.h>                // Library for I2C communication
#include <DFRobot_ADS1115.h>     // Library for ADS1115 ADC module

// Define the I2C SDA and SCL pins for communication with ADS1115
#define SDA_PIN 8 
#define SCL_PIN 18 

// Initialize ADS1115 instance using the Wire library
DFRobot_ADS1115 ads(&Wire);

void setup(void)
{
    // Begin serial communication at a baud rate of 115200
    Serial.begin(115200);

    // Initialize the I2C bus using the defined SDA and SCL pins
    Wire.begin(SDA_PIN, SCL_PIN);

    // Set the I2C address for the ADS1115 (default: 0x49)
    ads.setAddr_ADS1115(ADS1115_IIC_ADDRESS0);   // Address is 0x49

    // Set the gain for the ADS1115 (2/3x gain allows for a maximum input voltage of 6.144V)
    ads.setGain(eGAIN_TWOTHIRDS);

    // Set the ADS1115 to operate in single-shot mode (each reading is a single conversion)
    ads.setMode(eMODE_SINGLE);

    // Set the sample rate to 128 samples per second (SPS)
    ads.setRate(eRATE_128);

    // Set the operational status mode to single-conversion start
    ads.setOSMode(eOSMODE_SINGLE);

    // Initialize the ADS1115 module
    ads.init();
}

void loop(void)
{
    // Check if the ADS1115 is properly connected and functioning
    if (ads.checkADS1115())
    {
        // Variables to store the voltage readings for each channel
        int16_t adc0, adc1, adc2, adc3;

        // Read the voltage from channel A0 and print the value
        adc0 = ads.readVoltage(0);
        Serial.print("A0:");
        Serial.print(adc0);
        Serial.print("mV,  ");    // Print the value in millivolts

        // Read the voltage from channel A1 and print the value
        adc1 = ads.readVoltage(1);
        Serial.print("A1:");
        Serial.print(adc1);
        Serial.print("mV,  ");    // Print the value in millivolts

        // Read the voltage from channel A2 and print the value
        adc2 = ads.readVoltage(2);
        Serial.print("A2:");
        Serial.print(adc2);
        Serial.print("mV,  ");    // Print the value in millivolts

        // Read the voltage from channel A3 and print the value
        adc3 = ads.readVoltage(3);
        Serial.print("A3:");
        Serial.print(adc3);
        Serial.println("mV");     // Print the value in millivolts and end the line
    }
    else
    {
        // If ADS1115 is not connected, print a message indicating disconnection
        Serial.println("ADS1115 Disconnected!");
    }

    // Wait for 1 second before the next loop iteration
    delay(1000);
}
arduino ino file download:

.zip   3-ads1115_adc.zip (Size: 1.2 KB / Downloads: 102)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 

.zip   3-ads1115_adc.ino.merged.zip (Size: 194.32 KB / Downloads: 107)

Print this item

  [arduino code examples for MT4v2]-02 Read digital input ports state
Posted by: admin - 10-20-2026, 03:22 AM - Forum: MT4v2 - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* Description:
* This Arduino program reads the state of a 16-channel PCF8574 I/O expander
* and prints the state of all input pins to the Serial Monitor. The state of
* each pin is represented as a bit in a 8-bit value, where each bit corresponds
* to an input pin. The program prints the input state in binary format.
*
* Pin Definitions:
* - SDA: GPIO 8
* - SCL: GPIO 18
* - PCF8575 I2C Address: 0x22
*/

#include "Arduino.h"
#include "PCF8574.h"

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

// Set I2C address
PCF8574 pcf8574_IN1(0x22); // The I2C address of the PCF8575

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

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

    pcf8574_IN1.pinMode(P0, INPUT);
    pcf8574_IN1.pinMode(P1, INPUT);
    pcf8574_IN1.pinMode(P2, INPUT);
    pcf8574_IN1.pinMode(P3, INPUT);
    pcf8574_IN1.pinMode(P4, INPUT);
    pcf8574_IN1.pinMode(P5, INPUT);
    pcf8574_IN1.pinMode(P6, INPUT);
    pcf8574_IN1.pinMode(P7, INPUT);

    pcf8574_IN1.begin(); // Initialize the PCF8575

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

void loop() {
    uint16_t state = 0;

    // Read the state of each pin (assuming 16 pins)
    for (int pin = 0; pin < 8; pin++) {
        if (pcf8574_IN1.digitalRead(pin)) {
            state |= (1 << pin); // Set the bit for the active pin
        }
    }

    Serial.print("Input state: ");
    Serial.println(state, BIN); // Print the state of inputs in binary

    delay(500); // Delay 500ms
}
arduino ino file download:

.zip   2-digital-input.zip (Size: 890 bytes / Downloads: 105)
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: 195.59 KB / Downloads: 118)

Print this item

  [arduino code examples for MT4v2]-01 Control 4 channel DC motor
Posted by: admin - 10-20-2026, 03:18 AM - Forum: MT4v2 - No Replies

Code:
/*
* KinCony MT4V2 DC Motor Test
* Power ON -> M1-M4 run at 100%
*
* Made by KinCony IoT
* https://www.kincony.com
*/

#include <Arduino.h>

#define RXD 15
#define TXD 16

HardwareSerial MotorSerial(1);

uint16_t crc16(const uint8_t *data, uint8_t len)
{
  uint16_t crc = 0xFFFF;

  while (len--)
  {
    crc ^= *data++;

    for (uint8_t i = 0; i < 8; i++)
      crc = (crc & 1) ? (crc >> 1) ^ 0xA001 : crc >> 1;
  }

  return crc;
}

void sendFrame(uint8_t *data)
{
  uint16_t crc = crc16(data, 6);

  MotorSerial.write(data, 6);
  MotorSerial.write(crc & 0xFF);
  MotorSerial.write(crc >> 8);
  MotorSerial.flush();

  delay(50);

  // Clear ARM response
  while (MotorSerial.available())
    MotorSerial.read();
}

void enableMotor()
{
  uint8_t cmd[] = {
    1, 0x05,
    0x01, 0xF7,     // Coil 503
    0xFF, 0x00      // ON
  };

  sendFrame(cmd);
}

void setMotor(uint8_t motor, int16_t speed)
{
  uint16_t reg = 2000 + motor - 1;

  uint8_t cmd[] = {
    1, 0x06,
    uint8_t(reg >> 8),
    uint8_t(reg),
    uint8_t(speed >> 8),
    uint8_t(speed)
  };

  sendFrame(cmd);
}

void startMotors()
{
  enableMotor();

  setMotor(1, 100);  //100 is speed
  setMotor(2, 100);  //100 is speed
  setMotor(3, 100);  //100 is speed
  setMotor(4, 100);  //100 is speed
}

void setup()
{
  MotorSerial.begin(115200, SERIAL_8N1, RXD, TXD);

  // Wait for ARM CPU startup
  delay(3000);

  startMotors();
}

void loop()
{
  // Refresh commands every 2 seconds
  delay(2000);

  startMotors();
}
arduino ino file download:

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

.zip   1-motor.ino.merged.zip (Size: 185.77 KB / Downloads: 97)

Print this item

  MT4v2 ESPHome yaml for home assistant without tuya
Posted by: admin - 10-20-2026, 03:15 AM - Forum: MT4v2 - No Replies

Code:
esphome:
  name: mt4v2
  friendly_name: mt4v2


# ============================================================
# ESP32-S3
# ============================================================

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


# ============================================================
# Logger
# ============================================================

logger:
  hardware_uart: USB_SERIAL_JTAG


# ============================================================
# Home Assistant API
# ============================================================

api:


# ============================================================
# Ethernet - W5500
# ============================================================

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


# ============================================================
# I2C
# ============================================================

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


# ============================================================
# PCF8574 - Digital Inputs
# ============================================================

pcf8574:
  - id: pcf8574_hub_in_1
    i2c_id: bus_a
    address: 0x24


# ============================================================
# UART
# ============================================================

uart:

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

  # ARM CPU Motor Control UART
  # ESP32-S3 TX GPIO16 -> ARM RX
  # ESP32-S3 RX GPIO15 <- ARM TX
  # MODBUS RTU 115200 / 8N1
  - id: uart_motor
    baud_rate: 115200
    tx_pin: 16
    rx_pin: 15
    data_bits: 8
    parity: NONE
    stop_bits: 1


# ============================================================
# Global Motor Speed Variables
#
# Positive = Forward
# Negative = Reverse
# 0        = Stop
# ============================================================

globals:

  - id: motor1_speed
    type: int
    restore_value: no
    initial_value: '100'

  - id: motor2_speed
    type: int
    restore_value: no
    initial_value: '100'

  - id: motor3_speed
    type: int
    restore_value: no
    initial_value: '100'

  - id: motor4_speed
    type: int
    restore_value: no
    initial_value: '100'


# ============================================================
# Motor MODBUS Scripts
# ============================================================

script:

  # ----------------------------------------------------------
  # Motor Master Enable
  # Coil 503 = ON
  # ----------------------------------------------------------

  - id: motor_enable
    then:
      - lambda: |-
          uint8_t data[6] = {
            0x01, 0x05,
            0x01, 0xF7,
            0xFF, 0x00
          };

          uint16_t crc = 0xFFFF;

          for (int p = 0; p < 6; p++) {
            crc ^= data[p];

            for (int i = 0; i < 8; i++) {
              crc = (crc & 1)
                    ? (crc >> 1) ^ 0xA001
                    : crc >> 1;
            }
          }

          id(uart_motor).write_array(data, 6);

          uint8_t crc_data[2] = {
            (uint8_t)(crc & 0xFF),
            (uint8_t)(crc >> 8)
          };

          id(uart_motor).write_array(crc_data, 2);


  # ----------------------------------------------------------
  # Motor 1 - Register 2000
  # ----------------------------------------------------------

  - id: motor1_write
    mode: restart
    then:
      - lambda: |-
          int16_t speed = id(motor1_speed);

          uint8_t data[6] = {
            0x01, 0x06,
            0x07, 0xD0,
            (uint8_t)(speed >> 8),
            (uint8_t)speed
          };

          uint16_t crc = 0xFFFF;

          for (int p = 0; p < 6; p++) {
            crc ^= data[p];

            for (int i = 0; i < 8; i++) {
              crc = (crc & 1)
                    ? (crc >> 1) ^ 0xA001
                    : crc >> 1;
            }
          }

          id(uart_motor).write_array(data, 6);

          uint8_t crc_data[2] = {
            (uint8_t)(crc & 0xFF),
            (uint8_t)(crc >> 8)
          };

          id(uart_motor).write_array(crc_data, 2);


  # ----------------------------------------------------------
  # Motor 2 - Register 2001
  # ----------------------------------------------------------

  - id: motor2_write
    mode: restart
    then:
      - lambda: |-
          int16_t speed = id(motor2_speed);

          uint8_t data[6] = {
            0x01, 0x06,
            0x07, 0xD1,
            (uint8_t)(speed >> 8),
            (uint8_t)speed
          };

          uint16_t crc = 0xFFFF;

          for (int p = 0; p < 6; p++) {
            crc ^= data[p];

            for (int i = 0; i < 8; i++) {
              crc = (crc & 1)
                    ? (crc >> 1) ^ 0xA001
                    : crc >> 1;
            }
          }

          id(uart_motor).write_array(data, 6);

          uint8_t crc_data[2] = {
            (uint8_t)(crc & 0xFF),
            (uint8_t)(crc >> 8)
          };

          id(uart_motor).write_array(crc_data, 2);


  # ----------------------------------------------------------
  # Motor 3 - Register 2002
  # ----------------------------------------------------------

  - id: motor3_write
    mode: restart
    then:
      - lambda: |-
          int16_t speed = id(motor3_speed);

          uint8_t data[6] = {
            0x01, 0x06,
            0x07, 0xD2,
            (uint8_t)(speed >> 8),
            (uint8_t)speed
          };

          uint16_t crc = 0xFFFF;

          for (int p = 0; p < 6; p++) {
            crc ^= data[p];

            for (int i = 0; i < 8; i++) {
              crc = (crc & 1)
                    ? (crc >> 1) ^ 0xA001
                    : crc >> 1;
            }
          }

          id(uart_motor).write_array(data, 6);

          uint8_t crc_data[2] = {
            (uint8_t)(crc & 0xFF),
            (uint8_t)(crc >> 8)
          };

          id(uart_motor).write_array(crc_data, 2);


  # ----------------------------------------------------------
  # Motor 4 - Register 2003
  # ----------------------------------------------------------

  - id: motor4_write
    mode: restart
    then:
      - lambda: |-
          int16_t speed = id(motor4_speed);

          uint8_t data[6] = {
            0x01, 0x06,
            0x07, 0xD3,
            (uint8_t)(speed >> 8),
            (uint8_t)speed
          };

          uint16_t crc = 0xFFFF;

          for (int p = 0; p < 6; p++) {
            crc ^= data[p];

            for (int i = 0; i < 8; i++) {
              crc = (crc & 1)
                    ? (crc >> 1) ^ 0xA001
                    : crc >> 1;
            }
          }

          id(uart_motor).write_array(data, 6);

          uint8_t crc_data[2] = {
            (uint8_t)(crc & 0xFF),
            (uint8_t)(crc >> 8)
          };

          id(uart_motor).write_array(crc_data, 2);


# ============================================================
# Motor Speed Sliders
#
# 0   = Stop
# 100 = Full Speed
#
# Slider changes motor speed immediately.
# Current direction is retained.
# ============================================================

number:

  - platform: template
    name: "Motor 1 Speed"
    id: motor1_speed_slider
    min_value: 0
    max_value: 100
    step: 1
    initial_value: 100
    optimistic: true
    mode: slider
    set_action:
      - lambda: |-
          if (id(motor1_speed) < 0)
            id(motor1_speed) = -(int)x;
          else
            id(motor1_speed) = (int)x;
      - script.execute: motor1_write


  - platform: template
    name: "Motor 2 Speed"
    id: motor2_speed_slider
    min_value: 0
    max_value: 100
    step: 1
    initial_value: 100
    optimistic: true
    mode: slider
    set_action:
      - lambda: |-
          if (id(motor2_speed) < 0)
            id(motor2_speed) = -(int)x;
          else
            id(motor2_speed) = (int)x;
      - script.execute: motor2_write


  - platform: template
    name: "Motor 3 Speed"
    id: motor3_speed_slider
    min_value: 0
    max_value: 100
    step: 1
    initial_value: 100
    optimistic: true
    mode: slider
    set_action:
      - lambda: |-
          if (id(motor3_speed) < 0)
            id(motor3_speed) = -(int)x;
          else
            id(motor3_speed) = (int)x;
      - script.execute: motor3_write


  - platform: template
    name: "Motor 4 Speed"
    id: motor4_speed_slider
    min_value: 0
    max_value: 100
    step: 1
    initial_value: 100
    optimistic: true
    mode: slider
    set_action:
      - lambda: |-
          if (id(motor4_speed) < 0)
            id(motor4_speed) = -(int)x;
          else
            id(motor4_speed) = (int)x;
      - script.execute: motor4_write


# ============================================================
# Motor Control Buttons
# ============================================================

button:

  # Motor 1
  - platform: template
    name: "Motor 1 Forward"
    on_press:
      - script.execute: motor_enable
      - delay: 50ms
      - lambda: |-
          id(motor1_speed) =
            abs((int)id(motor1_speed_slider).state);
      - script.execute: motor1_write

  - platform: template
    name: "Motor 1 Reverse"
    on_press:
      - script.execute: motor_enable
      - delay: 50ms
      - lambda: |-
          id(motor1_speed) =
            -abs((int)id(motor1_speed_slider).state);
      - script.execute: motor1_write

  - platform: template
    name: "Motor 1 Stop"
    on_press:
      - lambda: |-
          id(motor1_speed) = 0;
      - script.execute: motor1_write


  # Motor 2
  - platform: template
    name: "Motor 2 Forward"
    on_press:
      - script.execute: motor_enable
      - delay: 50ms
      - lambda: |-
          id(motor2_speed) =
            abs((int)id(motor2_speed_slider).state);
      - script.execute: motor2_write

  - platform: template
    name: "Motor 2 Reverse"
    on_press:
      - script.execute: motor_enable
      - delay: 50ms
      - lambda: |-
          id(motor2_speed) =
            -abs((int)id(motor2_speed_slider).state);
      - script.execute: motor2_write

  - platform: template
    name: "Motor 2 Stop"
    on_press:
      - lambda: |-
          id(motor2_speed) = 0;
      - script.execute: motor2_write


  # Motor 3
  - platform: template
    name: "Motor 3 Forward"
    on_press:
      - script.execute: motor_enable
      - delay: 50ms
      - lambda: |-
          id(motor3_speed) =
            abs((int)id(motor3_speed_slider).state);
      - script.execute: motor3_write

  - platform: template
    name: "Motor 3 Reverse"
    on_press:
      - script.execute: motor_enable
      - delay: 50ms
      - lambda: |-
          id(motor3_speed) =
            -abs((int)id(motor3_speed_slider).state);
      - script.execute: motor3_write

  - platform: template
    name: "Motor 3 Stop"
    on_press:
      - lambda: |-
          id(motor3_speed) = 0;
      - script.execute: motor3_write


  # Motor 4
  - platform: template
    name: "Motor 4 Forward"
    on_press:
      - script.execute: motor_enable
      - delay: 50ms
      - lambda: |-
          id(motor4_speed) =
            abs((int)id(motor4_speed_slider).state);
      - script.execute: motor4_write

  - platform: template
    name: "Motor 4 Reverse"
    on_press:
      - script.execute: motor_enable
      - delay: 50ms
      - lambda: |-
          id(motor4_speed) =
            -abs((int)id(motor4_speed_slider).state);
      - script.execute: motor4_write

  - platform: template
    name: "Motor 4 Stop"
    on_press:
      - lambda: |-
          id(motor4_speed) = 0;
      - script.execute: motor4_write


# ============================================================
# RS485 Test Switch
# ============================================================

switch:

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


# ============================================================
# Digital Inputs
# ============================================================

binary_sensor:

  - platform: gpio
    name: "mt4v2-input01"
    id: mt4v2_input01
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "mt4v2-input02"
    id: mt4v2_input02
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "mt4v2-input03"
    id: mt4v2_input03
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "mt4v2-input04"
    id: mt4v2_input04
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "mt4v2-input05"
    id: mt4v2_input05
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "mt4v2-input06"
    id: mt4v2_input06
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "mt4v2-input07"
    id: mt4v2_input07
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "mt4v2-input08"
    id: mt4v2_input08
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true


  # GPIO inputs with pull-up resistors on PCB

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

  - platform: gpio
    name: "mt4v2-W1-io48"
    pin:
      number: 48
      inverted: true

  - platform: gpio
    name: "mt4v2-W1-io17"
    pin:
      number: 17
      inverted: true

  - platform: gpio
    name: "mt4v2-W1-io40"
    pin:
      number: 40
      inverted: true


  # ==========================================================
  # DRV8262 Fault Status
  #
  # Register 2020 = DRV8262 #1
  # Register 2021 = DRV8262 #2
  #
  # OFF = Normal
  # ON  = Problem
  # ==========================================================

  - platform: template
    name: "DRV8262-1 Fault"
    id: drv8262_1_fault
    device_class: problem

  - platform: template
    name: "DRV8262-2 Fault"
    id: drv8262_2_fault
    device_class: problem


# ============================================================
# ADS1115
# ============================================================

ads1115:
  - address: 0x48


# ============================================================
# Sensors
# ============================================================

sensor:

  # ADS1115 Channel 1
  - platform: ads1115
    multiplexer: A0_GND
    gain: 6.144
    resolution: 16_BITS
    name: "ADS1115 Channel A0-GND"
    update_interval: 5s

  # ADS1115 Channel 2
  - platform: ads1115
    multiplexer: A1_GND
    gain: 6.144
    name: "ADS1115 Channel A1-GND"
    update_interval: 5s

  # ADS1115 Channel 3
  - platform: ads1115
    multiplexer: A2_GND
    gain: 6.144
    name: "ADS1115 Channel A2-GND"
    update_interval: 5s

  # ADS1115 Channel 4
  - platform: ads1115
    multiplexer: A3_GND
    gain: 6.144
    name: "ADS1115 Channel A3-GND"
    update_interval: 5s


  # ==========================================================
  # Motor Current
  #
  # ARM MODBUS Registers:
  # 2010 = Motor 1 Current
  # 2011 = Motor 2 Current
  # 2012 = Motor 3 Current
  # 2013 = Motor 4 Current
  #
  # Values are displayed as raw register values.
  # ==========================================================

  - platform: template
    name: "Motor 1 Current"
    id: motor1_current
    accuracy_decimals: 0
    update_interval: never

  - platform: template
    name: "Motor 2 Current"
    id: motor2_current
    accuracy_decimals: 0
    update_interval: never

  - platform: template
    name: "Motor 3 Current"
    id: motor3_current
    accuracy_decimals: 0
    update_interval: never

  - platform: template
    name: "Motor 4 Current"
    id: motor4_current
    accuracy_decimals: 0
    update_interval: never


# ============================================================
# MODBUS Status Polling
#
# Every 2 seconds:
#
# Read 2010-2013 -> Motor Current
# Read 2020-2021 -> DRV8262 Fault
# ============================================================

interval:

  - interval: 2s
    then:

      # ======================================================
      # Read Motor Current
      #
      # FC03
      # Start Register = 2010
      # Quantity       = 4
      # ======================================================

      - lambda: |-

          // Clear old UART receive data
          while (id(uart_motor).available()) {
            uint8_t c;
            id(uart_motor).read_byte(&c);
          }

          // MODBUS request:
          // Slave 1
          // Function 03
          // Start address 2010 = 0x07DA
          // Read 4 registers

          uint8_t data[6] = {
            0x01, 0x03,
            0x07, 0xDA,
            0x00, 0x04
          };

          uint16_t crc = 0xFFFF;

          // Calculate MODBUS RTU CRC16
          for (int p = 0; p < 6; p++) {
            crc ^= data[p];

            for (int i = 0; i < 8; i++) {
              crc = (crc & 1)
                    ? (crc >> 1) ^ 0xA001
                    : crc >> 1;
            }
          }

          // Send MODBUS request
          id(uart_motor).write_array(data, 6);

          // Send CRC
          uint8_t crc_data[2] = {
            (uint8_t)(crc & 0xFF),
            (uint8_t)(crc >> 8)
          };

          id(uart_motor).write_array(crc_data, 2);


      # Wait for ARM CPU response
      - delay: 50ms


      # ======================================================
      # Process Motor Current Response
      # ======================================================

      - lambda: |-

          uint8_t rx[32];
          int len = 0;

          // Read UART response
          while (id(uart_motor).available() && len < 32) {
            id(uart_motor).read_byte(&rx[len]);
            len++;
          }

          // Expected response:
          //
          // 01 03 08
          // M1_H M1_L
          // M2_H M2_L
          // M3_H M3_L
          // M4_H M4_L
          // CRC_L CRC_H
          //
          // Total = 13 bytes

          if (len >= 13 &&
              rx[0] == 0x01 &&
              rx[1] == 0x03 &&
              rx[2] == 0x08) {

            uint16_t m1 =
              ((uint16_t)rx[3] << 8) | rx[4];

            uint16_t m2 =
              ((uint16_t)rx[5] << 8) | rx[6];

            uint16_t m3 =
              ((uint16_t)rx[7] << 8) | rx[8];

            uint16_t m4 =
              ((uint16_t)rx[9] << 8) | rx[10];

            // Publish values to ESPHome
            id(motor1_current).publish_state(m1);
            id(motor2_current).publish_state(m2);
            id(motor3_current).publish_state(m3);
            id(motor4_current).publish_state(m4);
          }


      # ======================================================
      # Read DRV8262 Fault Status
      #
      # FC03
      # Start Register = 2020
      # Quantity       = 2
      # ======================================================

      - lambda: |-

          // Clear UART receive buffer
          while (id(uart_motor).available()) {
            uint8_t c;
            id(uart_motor).read_byte(&c);
          }

          // MODBUS request:
          // Slave 1
          // Function 03
          // Start address 2020 = 0x07E4
          // Read 2 registers

          uint8_t data[6] = {
            0x01, 0x03,
            0x07, 0xE4,
            0x00, 0x02
          };

          uint16_t crc = 0xFFFF;

          // Calculate MODBUS RTU CRC16
          for (int p = 0; p < 6; p++) {
            crc ^= data[p];

            for (int i = 0; i < 8; i++) {
              crc = (crc & 1)
                    ? (crc >> 1) ^ 0xA001
                    : crc >> 1;
            }
          }

          // Send MODBUS request
          id(uart_motor).write_array(data, 6);

          // Send CRC
          uint8_t crc_data[2] = {
            (uint8_t)(crc & 0xFF),
            (uint8_t)(crc >> 8)
          };

          id(uart_motor).write_array(crc_data, 2);


      # Wait for ARM CPU response
      - delay: 50ms


      # ======================================================
      # Process DRV8262 Fault Response
      # ======================================================

      - lambda: |-

          uint8_t rx[16];
          int len = 0;

          // Read UART response
          while (id(uart_motor).available() && len < 16) {
            id(uart_motor).read_byte(&rx[len]);
            len++;
          }

          // Expected response:
          //
          // 01 03 04
          // Fault1_H Fault1_L
          // Fault2_H Fault2_L
          // CRC_L CRC_H
          //
          // Total = 9 bytes

          if (len >= 9 &&
              rx[0] == 0x01 &&
              rx[1] == 0x03 &&
              rx[2] == 0x04) {

            uint16_t fault1 =
              ((uint16_t)rx[3] << 8) | rx[4];

            uint16_t fault2 =
              ((uint16_t)rx[5] << 8) | rx[6];

            // 0 = Normal
            // Non-zero = Fault
            id(drv8262_1_fault).publish_state(
              fault1 != 0
            );

            id(drv8262_2_fault).publish_state(
              fault2 != 0
            );
          }


# ============================================================
# Web Server
# ============================================================

web_server:
  port: 80


# ============================================================
# OLED Font
# ============================================================

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


# ============================================================
# OLED Display
# ============================================================

display:

  - platform: ssd1306_i2c
    i2c_id: bus_a
    model: "SSD1306 128x64"
    address: 0x3C

    lambda: |-
      it.printf(
        0,
        0,
        id(roboto),
        "KinCony MT4v2"
      );
ESPHome yaml file download:

.txt   MT4v2-HA-Motor-Current-Without-Tuya.txt (Size: 22.74 KB / Downloads: 94)

Print this item

  MT4v2 ESP32-S3 IO pins define
Posted by: admin - 10-20-2026, 03:14 AM - Forum: MT4v2 - No Replies

IIC Bus:

SDA:GPIO8
SCL:GPIO18

24C02 EPROM i2c address: 0x50
ADS1115 (4CH ADC): i2c address:0x48
-----------------------

PCF8574: i2c address:0x22

PCF8574->P0 (digital input-1)
PCF8574->P1 (digital input-2)
PCF8574->P2 (digital input-3)
PCF8574->P3 (digital input-4)
PCF8574->P4 (digital input-5)
PCF8574->P5 (digital input-6)
PCF8574->P6 (digital input-7)
PCF8574->P7 (digital input-8)


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

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:GPIO7
TXD:GPIO6

Tuya network button: Tuya module's P28
Tuya network LED: Tuya module's P16
--------------------
1-Wire-TEP1:GPIO40
1-Wire-TEP2:GPIO17
1-Wire-TEP3:GPIO48
1-Wire-TEP4:GPIO47

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

433MHz RF receiver: GPIO14
IR receiver: GPIO13

DL(download) button: GPIO0
---------------------
ARM CPU RXD: GPIO15
ARM CPU TXD: GPIO16
115200bps
--------------------
SD Card:
SPI-MOSI:GPIO10
SPI-SCK:GPIO11
SPI-MISO:GPIO12
SPI-CS:GPIO9
SPI-CD:GPIO5

   

Print this item

  KC868-A8 V1.7.1 — Complete Verified DS18B20 Sensor Connector Pinout and ESPHome YAML
Posted by: Raddad - 10-19-2026, 04:48 PM - Forum: KC868-A series and Uair Smart Controller - No Replies

KinCony KC868-A8 V1.7.1 — Verified DS18B20 Temperature Sensor Pinout and ESPHome Configuration
Hardware: KinCony KC868-A8, PCB revision V1.7.1
Firmware: ESPHome with ESP-IDF framework
Connection: Wired Ethernet (LAN8720)
Sensors tested: Konnected waterproof DS18B20 temperature probes
Verification date: October 19, 2026
1. Overview
The KC868-A8 V1.7.1 has a six-position connector providing four independent DS18B20 temperature sensor data connections, 3.3 V power, and ground.
The connector terminals are not individually labeled on this board revision. The following pinout was established through electrical measurements and successful operation of DS18B20 sensors using ESPHome.
All four temperature inputs have been tested successfully.
2. Verified connector pinout
Terminal numbering begins with the terminal nearest the USB-C connector.
Terminal
Connection
ESP32 GPIO
Verification
1
+3.3 V
—
Continuity to 3V3 test point
2
S4
GPIO33
DS18B20 operational
3
S3
GPIO32
DS18B20 operational
4
S2
GPIO13
DS18B20 operational
5
S1
GPIO14
DS18B20 operational
6
GND
—
Continuity to power supply negative
Physical terminal diagram
The following diagram shows the connector with the USB-C socket at the bottom.

Code:
        KC868-A8 V1.7.1
        Six-terminal block
       ┌──────────────────┐
       │ 6   GND          │
       ├──────────────────┤
       │ 5   S1  GPIO14   │
       ├──────────────────┤
       │ 4   S2  GPIO13   │
       ├──────────────────┤
       │ 3   S3  GPIO32   │
       ├──────────────────┤
       │ 2   S4  GPIO33   │
       ├──────────────────┤
       │ 1   +3.3 V       │
       └──────────────────┘
                 │
              USB-C
This represents the vertical orientation shown in the board photographs, with terminal 1 nearest USB-C.
3. Electrical verification
With the board disconnected from power:
  • Terminal 1 showed continuity to the PCB's 3V3 test point.
  • Terminal 6 showed continuity to power supply ground.
  • Terminals 2, 3, 4, and 5 each measured approximately 4.7 kΩ to terminal 1.
With power applied and no temperature sensors connected:
  • Terminals 1–5 each measured approximately 3.29 V relative to ground.
The four 4.7 kΩ resistances are consistent with pull-up resistors for DS18B20 OneWire communication.
No additional external pull-up resistors were needed during testing.
4. Sensor connections
The Konnected waterproof DS18B20 probes used in testing have the following wire assignments:
Probe wire
Connection
Red
+3.3 V — terminal 1
Yellow
OneWire data — terminal 2, 3, 4, or 5
Black
GND — terminal 6
All four temperature inputs share the same power and ground terminals.
The wiring colors are specific to the probes tested. Verify the pinout of other manufacturers' probes before connecting them.
5. ESPHome configuration
The following is a complete example for the KC868-A8 V1.7.1, retaining all eight relays and eight optically isolated digital inputs while configuring S1–S4 as temperature inputs.
Replace the API encryption key placeholder with your own existing key.
Code:
esphome:
  name: kc868-a8-boiler-outlets
  friendly_name: KC868-A8-Boiler outlets
esp32:
  variant: esp32
  framework:
    type: esp-idf
logger:
api:
  encryption:
    key: "YOUR_EXISTING_API_ENCRYPTION_KEY"
ota:
  - platform: esphome
ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk:
    pin: GPIO17
    mode: CLK_OUT
  phy_addr: 0
i2c:
  sda: GPIO4
  scl: GPIO5
  scan: true
  id: bus_a
pcf8574:
  - id: pcf8574_hub_out_1
    address: 0x24
  - id: pcf8574_hub_in_1
    address: 0x22
# Eight relay outputs
switch:
  - platform: gpio
    name: "Boiler Outlet 1"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "Boiler Outlet 2"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "Boiler Outlet 3"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "Boiler Outlet 4"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "Boiler Outlet 5"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "Boiler Outlet 6"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "Boiler Outlet 7"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "Boiler Outlet 8"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: OUTPUT
      inverted: true
# Eight optically isolated digital inputs
binary_sensor:
  - platform: gpio
    name: "Boiler Input 1"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "Boiler Input 2"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "Boiler Input 3"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "Boiler Input 4"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "Boiler Input 5"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "Boiler Input 6"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "Boiler Input 7"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "Boiler Input 8"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true
# Four dedicated OneWire temperature inputs
one_wire:
  - platform: gpio
    pin: GPIO14
    id: boiler_temp_bus_1
  - platform: gpio
    pin: GPIO13
    id: boiler_temp_bus_2
  - platform: gpio
    pin: GPIO32
    id: boiler_temp_bus_3
  - platform: gpio
    pin: GPIO33
    id: boiler_temp_bus_4
# DS18B20 temperature sensors
sensor:
  - platform: dallas_temp
    one_wire_id: boiler_temp_bus_1
    name: "Boiler Temperature 1"
    update_interval: 10s
  - platform: dallas_temp
    one_wire_id: boiler_temp_bus_2
    name: "Boiler Temperature 2"
    update_interval: 10s
  - platform: dallas_temp
    one_wire_id: boiler_temp_bus_3
    name: "Boiler Temperature 3"
    update_interval: 10s
  - platform: dallas_temp
    one_wire_id: boiler_temp_bus_4
    name: "Boiler Temperature 4"
    update_interval: 10s
6. Test results
Two Konnected DS18B20 probes were used for verification.
S1 and S2 were successfully operated simultaneously, producing valid temperature readings in Home Assistant.
The second probe was then moved between the S3 and S4 connections, and both were successfully detected using their respective GPIO assignments.
All four data inputs are therefore confirmed operational.
Because each input uses a separate OneWire bus, up to four temperature probes can be connected using this configuration, with one probe assigned to each input.
7. Important observations
  1. The eight DI1–DI8 optically isolated inputs are separate from the four dedicated temperature inputs.
  2. GPIO32 and GPIO33 must not be configured simultaneously as binary inputs and OneWire temperature inputs.
  3. The connector's 3.3 V supply and ground are shared among the temperature sensors.
  4. Other KC868-A8 board revisions may use different physical terminal arrangements.
  5. This pinout was verified on PCB revision V1.7.1 and should not be assumed correct for other revisions without checking.
8. Conclusion
The KC868-A8 V1.7.1 supports four independently connected DS18B20 temperature sensors using GPIO14, GPIO13, GPIO32 and GPIO33.
The six-terminal sensor connector has now been electrically mapped and all four OneWire data connections have been verified through actual temperature sensor operation.
These findings are provided to assist other KinCony KC868-A8 users and to supplement the manufacturer's existing documentation.


Suggested documentation title:
KC868-A8 V1.7.1 — Complete Verified DS18B20 Sensor Connector Pinout and ESPHome YAML



Attached Files
.pdf   Kincony KC868-a8 pin id.pdf (Size: 445.27 KB / Downloads: 194)
Print this item