Wiznet makers

bruno

Published May 14, 2026 ©

168 UCC

14 WCC

43 VAR

0 Contests

0 Followers

0 Following

Original Link

ESP32S3 Dimmer Module – DM8 (8CH Dimmer)

KinCony DM8 ESP32 smart dimmer controller based on ESP32-S3-WROOM-1U (N16R8) wifi chip.

COMPONENTS
PROJECT DESCRIPTION

Product introduction video

 

Purchase Link : https://korean.alibaba.com/product-detail/KinCony-ESP32S3-Smart-Dimmer-Module-DM8-1601717914701.html

1) Introduction

Smart lighting systems are no longer limited to simple ON/OFF control. In modern homes, offices, retail stores, hotels, meeting rooms, factories, and building automation systems, lighting brightness often needs to be adjusted according to time, ambient light level, occupancy, energy-saving rules, or user-defined scenes.

One of the most widely used control methods for commercial and industrial lighting is 0–10V dimming. In a 0–10V dimming system, a low-voltage analog signal is sent to a compatible LED driver. The LED driver then adjusts the brightness of the connected light according to the control voltage.

The KinCony DM8 is an ESP32-S3-based 8-channel smart dimmer controller designed for this type of application. It provides 8 channels of DC 0–10V dimming output, 8 dry contact inputs, 4 analog input channels through ADS1115, WIZnet W5500 Ethernet, Wi-Fi, RS485, OLED display, USB-C, SD card support, RTC, and Tuya module support.

From a maker and system integration point of view, the DM8 is especially interesting because it combines three important features in one DIN rail module:

  • ESP32-S3 for application logic and IoT control
  • WIZnet W5500 Ethernet for stable wired network communication
  • 8-channel 0–10V output for professional lighting dimming control

This article explains how to use the KinCony DM8 as an Ethernet-enabled 8-channel smart lighting controller. It covers hardware setup, W5500 Ethernet configuration, 0–10V dimming output, dry contact input, analog input, RS485 communication, ESPHome integration, and Arduino-based TCP control.

 

Safety Note
The 0–10V output of the DM8 is a low-voltage control signal for compatible LED drivers. It is not a power output for LED strips or lamps. When working with AC mains wiring or LED driver power input wiring, always disconnect power first and follow local electrical safety regulations. Incorrect wiring can damage the controller, LED driver, or lighting fixture.


2) Required Components

ComponentDescription
KinCony DM8ESP32-S3-based 8-channel 0–10V smart dimmer controller
12–24V DC Power SupplyPower supply for the DM8 controller
0–10V Dimmable LED DriverLED driver with 0–10V dimming input
LED Light / Lighting FixtureLighting load connected to the LED driver
Ethernet CableFor W5500 wired LAN connection
Router / Ethernet SwitchLocal network connection
USB-C CableFirmware upload and serial debugging
Dry Contact SwitchesWall switches, relay contacts, or sensor contacts
0–5V SensorSensor for A1/A2 analog voltage input testing
4–20mA SensorIndustrial sensor for A3/A4 current input testing
RS485 DeviceModbus RTU sensor, power meter, PLC, or industrial device
MultimeterMeasuring 0–10V output voltage
Optional CR1220 BatteryBackup battery for RTC timekeeping

3) Hardware Setup

The KinCony DM8 is designed as a DIN rail controller, making it suitable for distribution boxes, automation panels, smart lighting cabinets, and building control systems.

The basic hardware setup consists of five parts:

  1. Supplying DC power to the DM8
  2. Connecting Ethernet through the W5500 interface
  3. Wiring 0–10V outputs to LED drivers
  4. Connecting dry contact inputs
  5. Connecting sensors or RS485 devices when required

Step 1. Connect DC Power

Connect a 12–24V DC power supply to the DM8 power input terminal.

Before powering the device:

  • Check the polarity of the DC input.
  • Confirm that the power supply voltage is within the supported range.
  • Make sure all field wiring is secure.
  • Avoid connecting or disconnecting terminals while the system is powered.

After power is applied, the controller should boot. Depending on the firmware, the OLED display may show network information, device status, or system messages.


Step 2. Connect Ethernet

Connect the RJ45 Ethernet port of the DM8 to a router or Ethernet switch using a standard Ethernet cable.

The DM8 uses a WIZnet W5500 Ethernet controller connected to the ESP32-S3 through SPI. Compared with Wi-Fi, wired Ethernet is often more reliable in control cabinets, commercial buildings, and industrial environments.

Ethernet is especially useful when:

  • The controller is installed inside a metal enclosure.
  • Wi-Fi signal quality is poor.
  • A fixed IP address is required.
  • Low-latency and stable communication is important.
  • The device must be integrated into a building automation network.

Step 3. Connect 0–10V Outputs to LED Drivers

Each 0–10V output channel of the DM8 should be connected to the dimming input of a compatible LED driver.

A typical LED driver has terminals such as:

  • DIM+
  • DIM-
  • 0–10V+
  • 0–10V-
  • Vdim+
  • Vdim-

Connect each DM8 dimmer channel to the corresponding 0–10V dimming input of the LED driver.

DM8 Output VoltageExpected Lighting Behavior
0VMinimum brightness or nearly OFF
5VAround 50% brightness
10VMaximum brightness

The actual brightness curve depends on the LED driver. Some drivers do not turn completely off at 0V, while others may support full shutoff. Always check the LED driver datasheet.


Step 4. Connect Dry Contact Inputs

The DM8 includes 8 dry contact input channels. These inputs can be used with:

  • Wall switches
  • Push buttons
  • Relay contacts
  • Door sensors
  • Occupancy sensors
  • External automation contacts

A dry contact input should be connected only to a voltage-free contact. Do not directly apply an external voltage unless the input specification explicitly allows it.

Typical use cases include:

  • Pressing a wall switch to toggle a lighting channel
  • Using a motion sensor relay output to activate a lighting scene
  • Connecting a door sensor to trigger corridor lighting
  • Using dry contact signals from another automation controller

Step 5. Connect Analog Sensors

The DM8 provides 4 analog input channels through ADS1115.

The input types are typically divided as follows:

Analog InputInput TypeExample Sensor
A10–5VLight sensor, pressure sensor, voltage output sensor
A20–5VPosition sensor, environmental sensor
A34–20mAIndustrial pressure sensor
A44–20mALevel, flow, temperature, or humidity transmitter

Analog sensors can be used to create closed-loop lighting automation. For example, a 0–5V ambient light sensor can be used to automatically increase or decrease lighting brightness.


Step 6. Connect RS485 Devices

The DM8 includes RS485 support, which can be used for Modbus RTU communication.

RS485 is commonly used with:

  • Energy meters
  • Temperature and humidity sensors
  • Industrial pressure sensors
  • PLCs
  • HVAC controllers
  • Building automation devices

When wiring RS485:

  • Connect A to A and B to B.
  • If communication fails, try swapping A/B.
  • Use twisted-pair cable for longer runs.
  • Add termination resistors when required.
  • Match baud rate, parity, stop bits, and Modbus slave ID.

4) Interface Explanation

The DM8 combines multiple hardware interfaces around the ESP32-S3. Understanding these interfaces makes it easier to customize firmware, troubleshoot hardware, and integrate the module into real automation systems.


4.1 ESP32-S3 Main Controller

The ESP32-S3 is the main processor of the DM8. It handles:

  • Ethernet communication
  • Wi-Fi communication
  • Web server or API logic
  • ESPHome / Home Assistant integration
  • I2C peripheral communication
  • RS485 communication
  • Tuya module communication
  • Internal dimmer output control
  • Sensor reading and automation rules

The ESP32-S3 is suitable for smart controller applications because it provides enough processing capability for IoT tasks while still being compact and power-efficient.


4.2 WIZnet W5500 Ethernet Interface

The W5500 is a hardware TCP/IP Ethernet controller. It communicates with the ESP32-S3 using SPI.

The DM8 W5500 pin assignment is:

W5500 FunctionESP32-S3 GPIO
SPI CLKGPIO1
SPI MOSIGPIO2
SPI MISOGPIO41
SPI CSGPIO42
InterruptGPIO43
ResetGPIO44

The W5500 is valuable in automation projects because it offloads network communication from the MCU and provides stable wired connectivity.

For a smart dimmer controller, Ethernet has several advantages:

  • More stable than Wi-Fi in control panels
  • Easier to assign static IP addresses
  • Better for long-term installation
  • Suitable for industrial and commercial systems
  • Compatible with MQTT, HTTP, TCP, and local automation servers

4.3 I2C Bus

The DM8 uses an I2C bus for several onboard peripheral chips.

I2C FunctionGPIO / AddressPurpose
SDAGPIO8I2C data
SCLGPIO18I2C clock
PCF85740x248-channel dry contact input
ADS11150x484-channel analog input
24C02 EEPROM0x50Parameter storage
DS3231 RTC0x68Real-time clock
SSD1306 OLED0x3CStatus display

Using I2C makes the design expandable. Multiple devices can share the same two signal lines, as long as each device has a unique address.


4.4 0–10V Dimming Output

The main function of the DM8 is 8-channel 0–10V dimming output.

Each channel can be controlled as an analog brightness output. In an ESPHome configuration, each dimming channel can be exposed as a monochromatic light entity in Home Assistant.

A typical brightness mapping is:

Brightness PercentageDAC ValueApprox. Output
0%00V
25%10242.5V
50%20485V
75%30717.5V
100%409510V

The DM8 internal dimming control can be handled through Modbus registers.

ChannelRegister HexRegister Decimal
CH10x0FA04000
CH20x0FA14001
CH30x0FA24002
CH40x0FA34003
CH50x0FA44004
CH60x0FA54005
CH70x0FA64006
CH80x0FA74007

4.5 RS485 Interface

The ESP32-side RS485 interface uses:

RS485 FunctionESP32-S3 GPIO
RXDGPIO38
TXDGPIO39

RS485 is useful when the DM8 needs to communicate with external Modbus RTU devices.

Example applications:

  • Reading energy meter data
  • Receiving temperature and humidity values
  • Connecting to PLC systems
  • Controlling HVAC equipment
  • Building a lighting controller with external sensor feedback

4.6 SD Card Interface

The DM8 includes an SPI SD card interface.

SD Card FunctionESP32-S3 GPIO
MOSIGPIO10
SCKGPIO11
MISOGPIO12
CSGPIO9
DetectGPIO5

The SD card can be used for:

  • Lighting event logs
  • Sensor data logging
  • Error logs
  • Schedule files
  • Offline configuration backup

4.7 Tuya UART Interface

The DM8 also supports a Tuya module interface.

Tuya FunctionESP32-S3 GPIO
RXDGPIO15
TXDGPIO16

This enables integration with Tuya-based smart home systems when the correct firmware is used.


5) Wiring Table

5.1 External Wiring Table

DM8 Terminal / InterfaceConnect ToDescription
DC Power Input12–24V DC power supplyMain power input
RJ45 EthernetRouter or Ethernet switchW5500 wired LAN connection
0–10V CH1LED Driver 1 DIM inputBrightness control for light zone 1
0–10V CH2LED Driver 2 DIM inputBrightness control for light zone 2
0–10V CH3LED Driver 3 DIM inputBrightness control for light zone 3
0–10V CH4LED Driver 4 DIM inputBrightness control for light zone 4
0–10V CH5LED Driver 5 DIM inputBrightness control for light zone 5
0–10V CH6LED Driver 6 DIM inputBrightness control for light zone 6
0–10V CH7LED Driver 7 DIM inputBrightness control for light zone 7
0–10V CH8LED Driver 8 DIM inputBrightness control for light zone 8
DI1–DI8Dry contact switchesWall switch or relay input
A1, A20–5V sensorsAnalog voltage sensors
A3, A44–20mA sensorsIndustrial current-loop sensors
RS485 A/BModbus RTU deviceIndustrial communication
USB-CPCFirmware upload and serial debugging
SD Card SlotMicroSD cardData logging
RTC Battery SocketCR1220 batteryRTC backup power

5.2 ESP32-S3 Internal Pin Table

FunctionGPIO / AddressDescription
I2C SDAGPIO8I2C data line
I2C SCLGPIO18I2C clock line
PCF85740x24Dry contact input expander
ADS11150x4816-bit ADC
EEPROM 24C020x50Configuration storage
DS3231 RTC0x68Real-time clock
OLED SSD13060x3CDisplay module
W5500 CLKGPIO1Ethernet SPI clock
W5500 MOSIGPIO2Ethernet SPI MOSI
W5500 MISOGPIO41Ethernet SPI MISO
W5500 CSGPIO42Ethernet chip select
W5500 INTGPIO43Ethernet interrupt
W5500 RSTGPIO44Ethernet reset
RS485 RXDGPIO38ESP32 RS485 receive
RS485 TXDGPIO39ESP32 RS485 transmit
Tuya RXDGPIO15Tuya UART receive
Tuya TXDGPIO16Tuya UART transmit
SD MOSIGPIO10SD card SPI MOSI
SD SCKGPIO11SD card SPI clock
SD MISOGPIO12SD card SPI MISO
SD CSGPIO9SD card chip select
SD DetectGPIO5SD card detection
Internal DAC RXGPIO4ESP32 receives from internal controller
Internal DAC TXGPIO6ESP32 transmits to internal controller

6) Software Environment Setup

The DM8 can be used in several different ways depending on the project goal.


6.1 Option 1: KCS v3 Firmware

KCS v3 is KinCony’s ready-to-use firmware platform. It is useful when users want a web-based configuration interface without writing code.

With KCS v3, the DM8 can be used with:

  • Web UI
  • MQTT
  • TCP commands
  • HTTP control
  • RS485 Modbus
  • Tuya app
  • Home Assistant MQTT auto discovery
  • IFTTT
  • Loxone integration

This is the fastest option for users who want to deploy the controller quickly.

Typical setup process:

  1. Download the correct KCS v3 firmware for the ESP32-S3 DM8 board.
  2. Connect the DM8 to the PC through USB-C.
  3. Flash the firmware using the recommended download tool.
  4. Connect Ethernet or use Wi-Fi AP mode.
  5. Open the device web interface.
  6. Configure network, MQTT, I/O, dimmer channels, and automation rules.
  7. Change the default password before final installation.

6.2 Option 2: ESPHome

ESPHome is a good choice for Home Assistant users.

With ESPHome, the DM8 can be configured through YAML. Each 0–10V output channel can appear in Home Assistant as a light entity. Dry contact inputs can appear as binary sensors. Analog inputs can appear as sensor entities.

ESPHome is recommended when:

  • Home Assistant is the main automation platform.
  • The user wants simple YAML-based configuration.
  • OTA updates are required.
  • Lighting channels should be controlled from Home Assistant dashboards.
  • Inputs and sensors should be used in Home Assistant automations.

6.3 Option 3: Arduino IDE

Arduino IDE is suitable when custom firmware is required.

Use Arduino IDE when the project needs:

  • A custom TCP server
  • A custom HTTP API
  • Modbus gateway logic
  • Local automation independent from Home Assistant
  • Sensor-based dimming algorithms
  • SD card logging
  • Integration with third-party systems

Recommended Arduino setup:

ItemRecommended Setting
IDEArduino IDE 2.x
Board PackageESP32 by Espressif
BoardESP32S3 Dev Module or ESP32-S3-DevKitC-1
USB CDC On BootEnabled
Upload PortUSB serial port
LibrariesEthernet, SPI, Wire, ADS1115, PCF8574, RTC libraries

7) Full Code Examples

This section provides two practical examples:

  1. ESPHome YAML for Home Assistant integration
  2. Arduino TCP server for Ethernet-based 0–10V dimming control

Example 1. ESPHome YAML: 8-Channel 0–10V Dimmer with Ethernet

This ESPHome example exposes the DM8 as an 8-channel lighting controller in Home Assistant.

Each dimmer channel appears as a monochromatic light entity. When the brightness slider is changed in Home Assistant, ESPHome writes the corresponding value to the internal dimming register.

 
esphome:
  name: dm8
  friendly_name: KinCony DM8 8CH Dimmer

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

logger:

api:

ota:
  - platform: esphome

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

# UART for external RS485 and internal dimmer control
uart:
  - id: rs485_uart
    baud_rate: 9600
    tx_pin: GPIO39
    rx_pin: GPIO38

  - id: dac_uart
    baud_rate: 115200
    tx_pin: GPIO6
    rx_pin: GPIO4
    stop_bits: 1
    data_bits: 8
    parity: NONE

modbus:
  uart_id: dac_uart

modbus_controller:
  - id: dm8_dac
    address: 1
    update_interval: 5s

# I2C bus
i2c:
  sda: GPIO8
  scl: GPIO18
  scan: true
  frequency: 400kHz

# OLED display
font:
  - file: "gfonts://Roboto"
    id: roboto_15
    size: 15

text_sensor:
  - platform: ethernet_info
    ip_address:
      name: "DM8 Ethernet IP"
      id: dm8_eth_ip
    mac_address:
      name: "DM8 Ethernet MAC"

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.printf(0, 0, id(roboto_15), "KinCony DM8");
      it.printf(0, 20, id(roboto_15), "IP:");
      it.printf(0, 40, id(roboto_15), "%s", id(dm8_eth_ip).state.c_str());

# 0-10V DAC outputs
# Brightness 0.0-1.0 is mapped to DAC value 0-4095
output:
  - platform: modbus_controller
    id: dac_ch1
    address: 0x0FA0
    value_type: U_WORD
    write_lambda: |-
      return (uint16_t) round(x * 4095.0);

  - platform: modbus_controller
    id: dac_ch2
    address: 0x0FA1
    value_type: U_WORD
    write_lambda: |-
      return (uint16_t) round(x * 4095.0);

  - platform: modbus_controller
    id: dac_ch3
    address: 0x0FA2
    value_type: U_WORD
    write_lambda: |-
      return (uint16_t) round(x * 4095.0);

  - platform: modbus_controller
    id: dac_ch4
    address: 0x0FA3
    value_type: U_WORD
    write_lambda: |-
      return (uint16_t) round(x * 4095.0);

  - platform: modbus_controller
    id: dac_ch5
    address: 0x0FA4
    value_type: U_WORD
    write_lambda: |-
      return (uint16_t) round(x * 4095.0);

  - platform: modbus_controller
    id: dac_ch6
    address: 0x0FA5
    value_type: U_WORD
    write_lambda: |-
      return (uint16_t) round(x * 4095.0);

  - platform: modbus_controller
    id: dac_ch7
    address: 0x0FA6
    value_type: U_WORD
    write_lambda: |-
      return (uint16_t) round(x * 4095.0);

  - platform: modbus_controller
    id: dac_ch8
    address: 0x0FA7
    value_type: U_WORD
    write_lambda: |-
      return (uint16_t) round(x * 4095.0);

light:
  - platform: monochromatic
    name: "DM8 Dimmer CH1"
    output: dac_ch1
    default_transition_length: 0s

  - platform: monochromatic
    name: "DM8 Dimmer CH2"
    output: dac_ch2
    default_transition_length: 0s

  - platform: monochromatic
    name: "DM8 Dimmer CH3"
    output: dac_ch3
    default_transition_length: 0s

  - platform: monochromatic
    name: "DM8 Dimmer CH4"
    output: dac_ch4
    default_transition_length: 0s

  - platform: monochromatic
    name: "DM8 Dimmer CH5"
    output: dac_ch5
    default_transition_length: 0s

  - platform: monochromatic
    name: "DM8 Dimmer CH6"
    output: dac_ch6
    default_transition_length: 0s

  - platform: monochromatic
    name: "DM8 Dimmer CH7"
    output: dac_ch7
    default_transition_length: 0s

  - platform: monochromatic
    name: "DM8 Dimmer CH8"
    output: dac_ch8
    default_transition_length: 0s

# Dry contact input expander
pcf8574:
  - id: pcf8574_inputs
    address: 0x24

binary_sensor:
  - platform: gpio
    name: "DM8 Input 1"
    pin:
      pcf8574: pcf8574_inputs
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "DM8 Input 2"
    pin:
      pcf8574: pcf8574_inputs
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "DM8 Input 3"
    pin:
      pcf8574: pcf8574_inputs
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "DM8 Input 4"
    pin:
      pcf8574: pcf8574_inputs
      number: 3
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "DM8 Input 5"
    pin:
      pcf8574: pcf8574_inputs
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "DM8 Input 6"
    pin:
      pcf8574: pcf8574_inputs
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "DM8 Input 7"
    pin:
      pcf8574: pcf8574_inputs
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "DM8 Input 8"
    pin:
      pcf8574: pcf8574_inputs
      number: 7
      mode: INPUT
      inverted: true

# ADS1115 analog inputs
ads1115:
  - address: 0x48

sensor:
  - platform: ads1115
    name: "DM8 Analog A1 0-5V"
    multiplexer: A0_GND
    gain: 6.144
    resolution: 16_BITS
    update_interval: 5s

  - platform: ads1115
    name: "DM8 Analog A2 0-5V"
    multiplexer: A1_GND
    gain: 6.144
    resolution: 16_BITS
    update_interval: 5s

  - platform: ads1115
    name: "DM8 Analog A3 4-20mA"
    multiplexer: A2_GND
    gain: 6.144
    resolution: 16_BITS
    update_interval: 5s

  - platform: ads1115
    name: "DM8 Analog A4 4-20mA"
    multiplexer: A3_GND
    gain: 6.144
    resolution: 16_BITS
    update_interval: 5s

web_server:
  port: 80
 

Example 2. Arduino IDE: W5500 TCP Server for 8-Channel 0–10V Control

This example turns the DM8 into a TCP-based Ethernet dimmer controller.

A PC, server, PLC gateway, or Node-RED flow can connect to the DM8 over TCP and send simple commands.

Command format:

 
SET,<channel>,<percent>
 

Examples:

 
SET,1,50
SET,8,100
SET,3,0
 

Command parameters:

ParameterDescription
channel1 to 8
percentBrightness percentage from 0 to 100
output valueConverted internally to 0–4095
register rangeCH1 = 4000, CH8 = 4007
 
#include <Arduino.h>
#include <SPI.h>
#include <Ethernet.h>

// =========================
// DM8 W5500 pin definition
// =========================
#define W5500_CLK_PIN   1
#define W5500_MOSI_PIN  2
#define W5500_MISO_PIN  41
#define W5500_CS_PIN    42
#define W5500_INT_PIN   43
#define W5500_RST_PIN   44

// =========================
// DM8 internal DAC UART
// ESP32 RX <- internal controller TX : GPIO4
// ESP32 TX -> internal controller RX : GPIO6
// =========================
#define DAC_RX_PIN 4
#define DAC_TX_PIN 6

HardwareSerial dacSerial(1);

// Change this MAC address if multiple boards are used on the same network.
byte mac[] = { 0x02, 0x57, 0x49, 0x5A, 0x44, 0x38 };

// Static IP example. Change it according to your LAN.
IPAddress ip(192, 168, 1, 88);
IPAddress dns(192, 168, 1, 1);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);

EthernetServer server(4196);

// -------------------------
// Modbus RTU CRC16
// -------------------------
uint16_t modbusCRC16(const uint8_t *data, size_t length) {
  uint16_t crc = 0xFFFF;

  for (size_t i = 0; i < length; i++) {
    crc ^= data[i];

    for (uint8_t bit = 0; bit < 8; bit++) {
      if (crc & 0x0001) {
        crc = (crc >> 1) ^ 0xA001;
      } else {
        crc >>= 1;
      }
    }
  }

  return crc;
}

// -------------------------
// Write one DAC register
// Slave ID: 1
// Function: 0x06 Write Single Register
// Register: 4000-4007
// Value: 0-4095
// -------------------------
void writeDimmerRegister(uint8_t channel, uint16_t value) {
  if (channel < 1 || channel > 8) return;
  if (value > 4095) value = 4095;

  uint16_t reg = 4000 + (channel - 1);

  uint8_t frame[8];
  frame[0] = 0x01;                 // Modbus slave address
  frame[1] = 0x06;                 // Write single register
  frame[2] = highByte(reg);
  frame[3] = lowByte(reg);
  frame[4] = highByte(value);
  frame[5] = lowByte(value);

  uint16_t crc = modbusCRC16(frame, 6);
  frame[6] = lowByte(crc);
  frame[7] = highByte(crc);

  dacSerial.write(frame, sizeof(frame));
  dacSerial.flush();

  Serial.printf("CH%u -> register %u, value %u\r\n", channel, reg, value);
}

// -------------------------
// Parse command: SET,ch,percent
// Example: SET,1,75
// -------------------------
String handleCommand(String cmd) {
  cmd.trim();
  cmd.toUpperCase();

  if (!cmd.startsWith("SET,")) {
    return "ERR,USE SET,<CH 1-8>,<PERCENT 0-100>\r\n";
  }

  int firstComma = cmd.indexOf(',');
  int secondComma = cmd.indexOf(',', firstComma + 1);

  if (firstComma < 0 || secondComma < 0) {
    return "ERR,BAD_FORMAT\r\n";
  }

  int channel = cmd.substring(firstComma + 1, secondComma).toInt();
  int percent = cmd.substring(secondComma + 1).toInt();

  if (channel < 1 || channel > 8) {
    return "ERR,CHANNEL_RANGE\r\n";
  }

  if (percent < 0) percent = 0;
  if (percent > 100) percent = 100;

  uint16_t dacValue = map(percent, 0, 100, 0, 4095);
  writeDimmerRegister((uint8_t)channel, dacValue);

  String reply = "OK,CH";
  reply += channel;
  reply += ",";
  reply += percent;
  reply += "%,DAC=";
  reply += dacValue;
  reply += "\r\n";

  return reply;
}

void resetW5500() {
  pinMode(W5500_RST_PIN, OUTPUT);
  digitalWrite(W5500_RST_PIN, LOW);
  delay(100);
  digitalWrite(W5500_RST_PIN, HIGH);
  delay(300);
}

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

  Serial.println();
  Serial.println("KinCony DM8 - W5500 TCP 0-10V Dimmer Controller");

  // Internal DAC UART
  dacSerial.begin(115200, SERIAL_8N1, DAC_RX_PIN, DAC_TX_PIN);

  // W5500 Ethernet
  pinMode(W5500_INT_PIN, INPUT);
  resetW5500();

  SPI.begin(W5500_CLK_PIN, W5500_MISO_PIN, W5500_MOSI_PIN);
  Ethernet.init(W5500_CS_PIN);
  Ethernet.begin(mac, ip, dns, gateway, subnet);

  delay(500);

  Serial.print("Ethernet IP: ");
  Serial.println(Ethernet.localIP());

  server.begin();
  Serial.println("TCP server started on port 4196");

  // Safe startup: set all dimmer channels to 0%
  for (uint8_t ch = 1; ch <= 8; ch++) {
    writeDimmerRegister(ch, 0);
    delay(50);
  }
}

void loop() {
  EthernetClient client = server.available();

  if (!client) {
    return;
  }

  Serial.println("Client connected");
  client.println("KinCony DM8 TCP Dimmer");
  client.println("Command: SET,<CH 1-8>,<PERCENT 0-100>");
  client.println("Example: SET,1,50");

  String buffer = "";

  while (client.connected()) {
    while (client.available()) {
      char c = client.read();

      if (c == '\n' || c == '\r') {
        if (buffer.length() > 0) {
          String reply = handleCommand(buffer);
          client.print(reply);
          buffer = "";
        }
      } else {
        buffer += c;
        if (buffer.length() > 64) {
          buffer = "";
          client.println("ERR,COMMAND_TOO_LONG");
        }
      }
    }
  }

  client.stop();
  Serial.println("Client disconnected");
}
 

8) Testing Steps

Test 1. Power-On Check

Apply 12–24V DC power to the DM8.

Check the following:

  • Power LED or status indicator is active.
  • OLED display turns on if supported by the firmware.
  • No component becomes unusually hot.
  • USB serial output is available when connected to a PC.

Test 2. Ethernet Connection Test

Connect the DM8 to the local network using Ethernet.

For the Arduino example above, the static IP address is:

 
192.168.1.88
 

From a PC on the same network, run:

 
ping 192.168.1.88
 

A successful ping means the W5500 Ethernet interface is working.

When using a different LAN subnet, change the IP address in the Arduino code before uploading.


Test 3. TCP Command Test

Use a TCP client such as netcat.

 
nc 192.168.1.88 4196
 

Send commands:

 
SET,1,50
SET,2,100
SET,1,0
 

Expected responses:

 
OK,CH1,50%,DAC=2047
OK,CH2,100%,DAC=4095
OK,CH1,0%,DAC=0
 

The exact DAC value may differ slightly depending on integer rounding.


Test 4. 0–10V Voltage Output Test

Use a multimeter to measure the output voltage of each channel.

TCP CommandExpected CH1 Output
SET,1,0About 0V
SET,1,25About 2.5V
SET,1,50About 5V
SET,1,75About 7.5V
SET,1,100About 10V

Test the voltage before connecting the LED driver. This makes troubleshooting easier and reduces the risk of damaging external equipment.


Test 5. LED Driver Dimming Test

After confirming the 0–10V output with a multimeter, connect the output to a compatible LED driver.

Then send commands again:

 
SET,1,10
SET,1,50
SET,1,100
 

The brightness of the connected light should change gradually.

If the light does not turn completely off at 0%, check the LED driver specification. Some 0–10V drivers require a separate relay or power control circuit for complete shutoff.


Test 6. ESPHome and Home Assistant Test

After uploading the ESPHome YAML:

  1. Open Home Assistant.
  2. Go to the ESPHome device page.
  3. Confirm that the DM8 is online.
  4. Check that 8 dimmer light entities are created.
  5. Move each brightness slider.
  6. Measure the corresponding 0–10V output.
  7. Confirm that the LED driver follows the brightness value.

This test verifies both Ethernet communication and dimmer control.


Test 7. Dry Contact Input Test

Connect a push button or wall switch to one of the dry contact inputs.

In Home Assistant or serial logs, check whether the input state changes when the switch is pressed.

If the logic appears reversed, change the inverted setting in ESPHome.


Test 8. Analog Input Test

Connect a known analog signal to A1 or A2.

For example:

Input VoltageExpected Result
0VLow ADC value
2.5VMid-scale value
5VHigh ADC value

For A3/A4, use a proper 4–20mA sensor or current source. Do not apply a voltage signal directly to a current-loop input unless the hardware design supports it.


9) Troubleshooting

Problem 1. Ethernet IP Is Not Available

Possible causes:

  • Wrong W5500 SPI pin configuration
  • Ethernet cable problem
  • Router or switch port issue
  • Static IP address outside the LAN subnet
  • MAC address conflict
  • W5500 reset pin not controlled correctly

Solutions:

  • Check that W5500 pins are configured as GPIO1, GPIO2, GPIO41, GPIO42, GPIO43, and GPIO44.
  • Try another Ethernet cable.
  • Try another router or switch port.
  • Change the static IP to match your network.
  • Use a unique MAC address for each controller.
  • Check serial monitor output for Ethernet initialization messages.

Problem 2. 0–10V Output Does Not Change

Possible causes:

  • Wrong internal UART pin configuration
  • Wrong Modbus register address
  • Incorrect LED driver wiring
  • LED driver does not support 0–10V dimming
  • Output channel is not initialized
  • Firmware is not sending the correct command

Solutions:

  • Use GPIO4 as RX and GPIO6 as TX for the internal DAC UART.
  • Use register 4000 for CH1 and 4007 for CH8.
  • Test the output with a multimeter before connecting the LED driver.
  • Confirm the LED driver’s DIM+ and DIM- polarity.
  • Check whether the driver requires a separate enable signal.

Problem 3. Dry Contact Input Works in Reverse

Some dry contact input circuits are active-low.

For ESPHome, change:

 
inverted: true
 

to:

 
inverted: false
 

or the opposite, depending on the observed behavior.


Problem 4. ADS1115 Analog Value Is Incorrect

Possible causes:

  • Wrong input channel selected
  • Wrong input type used
  • Sensor ground is not connected correctly
  • Input voltage exceeds the supported range
  • 4–20mA sensor wiring is incorrect
  • I2C address is wrong

Solutions:

  • Use A1/A2 for 0–5V signals.
  • Use A3/A4 for 4–20mA signals.
  • Check the common ground for voltage-output sensors.
  • Confirm ADS1115 address 0x48.
  • Use a known test voltage first.
  • Verify the sensor wiring diagram.

Problem 5. RS485 Communication Fails

Possible causes:

  • A/B lines are reversed
  • Baud rate mismatch
  • Wrong Modbus slave ID
  • Parity or stop bit mismatch
  • Missing termination resistor
  • Long cable without proper shielding

Solutions:

  • Swap A and B lines.
  • Start with 9600 baud, 8N1.
  • Confirm the slave ID of the Modbus device.
  • Check parity and stop bit settings.
  • Add termination if the cable is long.
  • Use twisted-pair cable for RS485.

Problem 6. Home Assistant Does Not Detect the Device

Possible causes:

  • ESPHome API not enabled
  • Ethernet network issue
  • Firewall or VLAN isolation
  • Wrong board configuration
  • OTA upload failed

Solutions:

  • Confirm that api: is enabled in the YAML file.
  • Check whether the DM8 receives an IP address.
  • Make sure Home Assistant and DM8 are on the same network.
  • Check ESPHome logs.
  • Use USB upload first, then switch to OTA updates.

10) Use Cases & Market Potential

Smart Home Lighting Control

The DM8 can be used as a central lighting controller for a smart home.

Example configuration:

ChannelLighting Area
CH1Living room main light
CH2Living room indirect light
CH3Kitchen light
CH4Dining light
CH5Bedroom light
CH6Hallway light
CH7Bathroom light
CH8Outdoor light

With Home Assistant, users can create scenes such as:

  • Movie mode
  • Dinner mode
  • Night mode
  • Wake-up lighting
  • Away mode
  • Energy-saving mode

Commercial Lighting

In commercial spaces, lighting control is directly related to user experience and energy cost.

The DM8 can be used in:

  • Meeting rooms
  • Restaurants
  • Cafes
  • Hotels
  • Retail shops
  • Exhibition spaces
  • Office floors

A single DM8 can manage up to 8 lighting zones, making it suitable for small and medium-size lighting control systems.


Building Automation

Because the DM8 supports Ethernet, RS485, MQTT, HTTP, and TCP-based control depending on firmware, it can be integrated into building automation systems.

Possible integrations include:

  • Home Assistant
  • Node-RED
  • MQTT broker
  • PLC gateway
  • BMS software
  • Custom TCP server
  • Web dashboard
  • Modbus RTU devices

Ethernet is especially important in building automation because fixed wiring is usually preferred over wireless control.


Industrial Lighting and Sensor-Based Control

The DM8 can also be used in industrial environments where lighting must respond to sensor data.

Example applications:

  • Factory workbench lighting
  • Warehouse aisle lighting
  • Machine area lighting
  • Sensor-based daylight compensation
  • Scheduled lighting control
  • Energy-saving lighting automation

The 4–20mA input channels are suitable for industrial sensors, while RS485 can be used to communicate with power meters, PLCs, and environmental sensors.


Energy Saving Automation

Lighting is one of the easiest systems to optimize for energy saving.

The DM8 can reduce energy consumption by combining:

  • Time schedules
  • Occupancy detection
  • Ambient light sensing
  • Zone-based dimming
  • Manual override switches
  • Network-based control policies

For example, a corridor can run at 20% brightness when empty and increase to 80% when motion is detected. Office lighting can automatically dim when enough daylight is available.


11) Module/Chip Technical Overview

KinCony DM8

The KinCony DM8 is an ESP32-S3-based smart dimmer module designed for 0–10V lighting control.

Main features include:

  • ESP32-S3-WROOM-1U module
  • 8-channel 0–10V dimming output
  • 8-channel dry contact input
  • 4-channel analog input
  • WIZnet W5500 Ethernet
  • Wi-Fi
  • RS485
  • USB-C
  • OLED display
  • SD card interface
  • DS3231 RTC
  • Tuya module support
  • DIN rail enclosure

This combination makes the DM8 suitable for both maker projects and practical automation installations.


ESP32-S3-WROOM-1U

The ESP32-S3-WROOM-1U is a Wi-Fi and Bluetooth LE MCU module based on the ESP32-S3.

In the DM8, the ESP32-S3 is responsible for:

  • Running application firmware
  • Managing Ethernet communication
  • Reading sensor inputs
  • Sending dimmer output commands
  • Handling local automation logic
  • Communicating with Home Assistant or cloud platforms

Its combination of wireless connectivity, GPIO capability, and embedded processing makes it suitable for smart control systems.


WIZnet W5500

The WIZnet W5500 is a hardware TCP/IP Ethernet controller.

It supports SPI communication with the host MCU and provides wired Ethernet connectivity. In the DM8, the W5500 enables stable LAN-based control, which is important for lighting automation and building control systems.

Key advantages of using W5500:

  • Reliable wired communication
  • Hardware TCP/IP processing
  • Reduced network stack burden on the MCU
  • Good compatibility with embedded systems
  • Suitable for local TCP, HTTP, MQTT, and control applications

For smart dimming systems, Ethernet is often preferred when the controller is installed permanently.


ADS1115

The ADS1115 is a 16-bit ADC with I2C communication.

In the DM8, it is used to read the analog input channels. This allows the controller to work with sensors such as:

  • Ambient light sensors
  • Pressure sensors
  • Level sensors
  • Temperature transmitters
  • 4–20mA industrial sensors

Analog input is important because it allows lighting control to become responsive to real-world conditions.


PCF8574

The PCF8574 is an I2C I/O expander.

In the DM8, it expands the ESP32-S3 input capability and is used for dry contact input reading.

This is useful because the ESP32-S3 can monitor multiple switch or contact inputs without using many direct GPIO pins.


DS3231 RTC

The DS3231 is a real-time clock module.

It allows the DM8 to keep time even when network time is unavailable. With a backup battery, it can continue maintaining time when the main power is disconnected.

RTC support is useful for:

  • Scheduled lighting scenes
  • Offline automation
  • Time-based dimming
  • Daily or weekly control rules
  • Event logging with timestamps

SSD1306 OLED

The SSD1306 OLED display is used to show basic system information.

Typical displayed information may include:

  • Ethernet IP address
  • Wi-Fi IP address
  • Device status
  • Tuya connection status
  • Firmware status
  • Debug information

A local display is helpful during installation because the installer can confirm the network status without connecting to a serial monitor.


12) Conclusion

The KinCony DM8 is a practical and powerful platform for building a professional 8-channel 0–10V smart lighting controller. By combining ESP32-S3 processing, WIZnet W5500 Ethernet, RS485, analog input, dry contact input, RTC, OLED, and multiple firmware options, it provides much more than simple dimming output.

For maker projects, the DM8 is attractive because it can be used in several ways. Beginners can start with KCS v3 firmware or ESPHome. Advanced users can write custom Arduino or ESP-IDF firmware to implement TCP control, MQTT integration, Modbus logic, sensor-based dimming, and local automation rules.

The W5500 Ethernet interface is especially valuable for reliable installations. In smart homes, offices, factories, and commercial buildings, wired Ethernet gives the controller a stable communication path and makes it suitable for long-term deployment.

With the DM8, makers and integrators can build systems such as:

  • Home Assistant-based 8-channel lighting panels
  • Ethernet-based 0–10V commercial lighting controllers
  • Sensor-driven daylight compensation systems
  • RS485-connected industrial lighting controllers
  • Scheduled lighting automation systems
  • MQTT/TCP/HTTP-enabled building control nodes

Overall, the KinCony DM8 is a strong example of how ESP32-S3 and WIZnet W5500 can be combined to create a reliable, network-connected smart lighting controller for real-world automation projects.

 
 
 
Documents
Comments Write