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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 10,712
» Latest member: Edulift
» Forum threads: 4,360
» Forum posts: 21,417

Full Statistics

Online Users
There are currently 176 online users.
» 0 Member(s) | 157 Guest(s)
Amazonbot, Applebot, Baidu, Bing, Bytespider, Crawl, Google, PetalBot, Sogou web, bot

Latest Threads
KC868-A16v3 MQTT TLS/SSL ...
Forum: "KCS" v3 firmware
Last Post: admin
2 hours 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: 110
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: 45
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: 104
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: 121
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: 118

  INCREMENTAL ENCODER
Posted by: fabuena - 06-08-2026, 10:04 PM - Forum: KC868-A8 - Replies (3)

Hello, 
I want to connect a CALT GHW38 incremental encoder with a built-in measuring wheel to my KC 868-A8 in the simplest way possible. 
Should I get an NPN, PNP, or 5V line driver encoder? 
Dispositivo de Medición de Longitud CALT GHW38, Codificador Rotatorio con Salida de Pulso, con Rueda Antideslizante de 200 mm/300 mm de Circunferencia - AliExpress

Which inputs do I connect signals A and B to?

Thanks

Print this item

  "KCS" v3 Nx energy meter RS485 TCP/IP Modbus protocol document
Posted by: admin - 06-07-2026, 01:39 AM - Forum: "KCS" v3 firmware - No Replies

"KCS" v3 Nx energy meter RS485 TCP/IP Modbus protocol document:



Attached Files
.txt   n10_energy_modbus_protocol_20260324.txt (Size: 11.98 KB / Downloads: 237)
.txt   n20_energy_modbus_protocol_20260324.txt (Size: 13.6 KB / Downloads: 224)
.txt   n30_energy_modbus_protocol_20260324.txt (Size: 15.9 KB / Downloads: 219)
.txt   n60_energy_modbus_protocol_20260324.txt (Size: 12.18 KB / Downloads: 208)
Print this item

  "KCS" v3 TCP/IP Standard Modbus protocol document
Posted by: admin - 06-07-2026, 01:36 AM - Forum: "KCS" v3 firmware - No Replies

KCS protocol webpage, "TCP Server" = "Modbus TCP". it's a standard modbus protocol.

Code:
KCSv3 Modbus TCP Protocol Specification
=======================================

1. Overview
-----------

This document specifies the standard Modbus TCP protocol exposed by the
KCSv3 firmware TCP server.

This mode uses the standard Modbus TCP ADU with an MBAP header. It does not use
the RTU CRC field.

2. Communication Parameters
---------------------------

- Protocol: Standard Modbus TCP
- TCP port: configured by tcp_server_port
- Unit ID: configured by tcp_server_protocol_modbus_local_addr
- Register addressing: 0-based Modbus protocol address
- Frame format: [MBAP Header][PDU]
- Protocol ID in MBAP: 0x0000
- CRC: not used

MBAP header format:

+--------+----------------+----------------------------------------------+
| Bytes  | Field          | Description                                  |
+--------+----------------+----------------------------------------------+
| 0..1   | Transaction ID | Echoed in the response                       |
| 2..3   | Protocol ID    | Must be 0x0000                               |
| 4..5   | Length         | Unit ID byte + PDU length                    |
| 6      | Unit ID        | Must match tcp_server_protocol_modbus_local_addr |
+--------+----------------+----------------------------------------------+

The firmware validates the MBAP Protocol ID, Length, and Unit ID before
processing the PDU. Responses are sent only to the requesting TCP client.

3. Supported Function Codes
---------------------------

+---------------+---------------------------+-------------------------------+
| Function Code | Name                      | Usage                         |
+---------------+---------------------------+-------------------------------+
| 0x01          | Read Coils                | Read DO output state          |
| 0x02          | Read Discrete Inputs      | Read DI input state           |
| 0x03          | Read Holding Registers    | Read DAC/IR/RF/energy data    |
| 0x04          | Read Input Registers      | Read ADC/temperature/humidity |
| 0x05          | Write Single Coil         | Set one DO or trigger toggle  |
| 0x06          | Write Single Register     | Set DAC or trigger IR/RF      |
| 0x0F          | Write Multiple Coils      | Set multiple DO channels      |
| 0x10          | Write Multiple Registers  | Set multiple DAC channels     |
+---------------+---------------------------+-------------------------------+

4. Addressing Notes
-------------------

All addresses in this document are 0-based Modbus protocol addresses.

Examples:

- Holding register address 100 is sent as 0x0064 in the Modbus PDU.
- In pymodbus, use read_holding_registers(100, count=2, slave=<unit_id>).
- Some Modbus tools display holding register 100 as 40101 or similar. Use the
  tool's 0-based/1-based setting carefully.

5. Coils (Function Codes 0x01, 0x05, 0x0F)
-------------------------------------------

5.1 DO Output State and Control
-------------------------------

+------------------------+----------------------+-----------------------------+
| Address Range          | Description          | Access                      |
+------------------------+----------------------+-----------------------------+
| 0 .. DO_NUM-1          | DO output channels   | 0x01 read, 0x05/0x0F write  |
+------------------------+----------------------+-----------------------------+

Write value for function code 0x05:

- 0xFF00: turn ON
- 0x0000: turn OFF

Function code 0x0F supports only the normal DO output range starting at address
0.

5.2 DO Toggle Control
---------------------

+-----------------------------+----------------------+--------------------------+
| Address Range               | Description          | Access                   |
+-----------------------------+----------------------+--------------------------+
| 0x0100 .. 0x0100+DO_NUM-1   | Toggle DO channels   | 0x05 write only          |
+-----------------------------+----------------------+--------------------------+

Write 0xFF00 to address 0x0100 + channel_index to toggle that output channel.
Writing 0x0000 is accepted but does not toggle the output.

6. Discrete Inputs (Function Code 0x02)
---------------------------------------

+------------------------+----------------------+-----------------------------+
| Address Range          | Description          | Access                      |
+------------------------+----------------------+-----------------------------+
| 0 .. DI_NUM-1          | DI input channels    | 0x02 read                   |
+------------------------+----------------------+-----------------------------+

DI inputs are active-low in the firmware mapping:

- Hardware low / active input returns 1
- Hardware high / inactive input returns 0

7. Holding Registers (Function Codes 0x03, 0x06, 0x10)
------------------------------------------------------

7.1 DAC Output Registers
------------------------

+------------------------+----------------------+-----------------------------+
| Address Range          | Description          | Access                      |
+------------------------+----------------------+-----------------------------+
| 0 .. DAC_NUM-1         | DAC output channels  | 0x03 read, 0x06/0x10 write  |
+------------------------+----------------------+-----------------------------+

DAC write value range: 0 .. 255.

Function code 0x10 supports only this DAC register range.

7.2 IR/RF Control Registers
---------------------------

+----------+-------------+----------------------+-----------------------------+
| Address  | Name        | Description          | Access                      |
+----------+-------------+----------------------+-----------------------------+
| 0x0040   | IR_SEND     | Send learned IR slot | 0x03 read, 0x06 write       |
| 0x0041   | IR_LEARN    | Learn IR slot/port   | 0x03 read, 0x06 write       |
| 0x0042   | IR_DELETE   | Delete IR slot       | 0x03 read, 0x06 write       |
| 0x0050   | RF_SEND     | Send learned RF slot | 0x03 read, 0x06 write       |
+----------+-------------+----------------------+-----------------------------+

IR_SEND:

- Value: IR memory slot index
- Valid range: 0 .. IR_MEM_NUM-1

IR_LEARN:

- High byte: IR memory slot index
- Low byte: IR send port number, starting from 1

IR_DELETE:

- Value: IR memory slot index
- Valid range: 0 .. IR_MEM_NUM-1

RF_SEND:

- Value: RF memory slot index
- The selected RF slot must exist and be learned

These registers exist only on board variants with the corresponding IR/RF
feature enabled. Otherwise accesses return an illegal data address exception.

7.3 Energy Measurement Registers
--------------------------------

Energy data is exposed as read-only Holding Registers and is read with function
code 0x03.

Each energy chip uses 68 holding registers. The base address is:

  base = 100 + chip_index * 100

where chip_index starts from 0.

+--------------+----------------+----------------+--------------------------+
| Offset Range | Parameter      | Format         | Resolution / Notes       |
+--------------+----------------+----------------+--------------------------+
| 0 .. 19      | RMS_1..RMS_10  | uint32 CDAB    | Current in A * 1000      |
| 20 .. 39     | WATT_1..WATT_10| int32 CDAB     | Power in W * 10          |
| 40 .. 59     | Energy_1..10   | float32 CDAB   | Energy in kWh            |
| 60 .. 61     | Energy_Sum     | float32 CDAB   | Total energy in kWh      |
| 62           | RMS_V          | uint16         | Voltage in V * 100       |
| 63           | Period         | uint16         | Frequency in Hz * 100    |
| 64 .. 65     | TPS1           | float32 CDAB   | Temperature in deg C     |
| 66 .. 67     | PF             | float32 CDAB   | Power factor             |
+--------------+----------------+----------------+--------------------------+

Per-channel offsets:

+----------------+----------------+----------------+--------------------------+
| Channel        | Current Offset | Power Offset   | Energy Offset            |
+----------------+----------------+----------------+--------------------------+
| 1              | 0              | 20             | 40                       |
| 2              | 2              | 22             | 42                       |
| 3              | 4              | 24             | 44                       |
| 4              | 6              | 26             | 46                       |
| 5              | 8              | 28             | 48                       |
| 6              | 10             | 30             | 50                       |
| 7              | 12             | 32             | 52                       |
| 8              | 14             | 34             | 54                       |
| 9              | 16             | 36             | 56                       |
| 10             | 18             | 38             | 58                       |
+----------------+----------------+----------------+--------------------------+

For 32-bit integer and float values, read two consecutive registers. The lower
16-bit word is returned first, followed by the upper 16-bit word.

Examples:

- Chip 1 current channel 1: read holding registers 100 and 101
- Chip 2 power channel 1: read holding registers 220 and 221
- Chip 1 voltage: read holding register 162
- Chip 1 frequency: read holding register 163

8. Input Registers (Function Code 0x04)
---------------------------------------

+-------------------------------+----------------------+--------------------------+
| Address Range                 | Description          | Format                   |
+-------------------------------+----------------------+--------------------------+
| 0 .. ADC_NUM-1                | ADC input channels   | uint16 raw ADC value     |
| 0x0100 .. 0x0100+SENSOR_NUM-1 | Temperature sensors  | int16, deg C * 10        |
| 0x0120 .. 0x0120+SENSOR_NUM-1 | Humidity sensors     | int16, %RH * 10          |
+-------------------------------+----------------------+--------------------------+

If a temperature or humidity sensor is invalid or not present, the returned
value is 0x7FFF.

9. Board-Dependent Limits
-------------------------

The following symbols depend on the compiled board model:

- DO_NUM: number of digital outputs
- DI_NUM: number of digital inputs
- DAC_NUM: number of DAC outputs
- ADC_NUM: number of ADC inputs
- SENSOR_NUM: maximum temperature/humidity sensor slots
- ENERGY_NUM: number of energy measurement chips

N-series energy chip bases:

+-------+------------+--------------------------------------+
| Board | ENERGY_NUM | Energy Holding Register Bases        |
+-------+------------+--------------------------------------+
| N10   | 1          | 100                                  |
| N20   | 2          | 100, 200                             |
| N30   | 3          | 100, 200, 300                        |
| N60   | 6          | 100, 200, 300, 400, 500, 600         |
+-------+------------+--------------------------------------+

10. Exception Codes
-------------------

+----------------+----------------------------+-------------------------------+
| Exception Code | Name                       | Meaning                       |
+----------------+----------------------------+-------------------------------+
| 0x01           | Illegal Function           | Unsupported function code     |
| 0x02           | Illegal Data Address       | Unsupported address/range     |
| 0x03           | Illegal Data Value         | Invalid value or quantity     |
| 0x04           | Slave Device Failure       | Runtime failure or overflow   |
+----------------+----------------------------+-------------------------------+

11. Request Size Limits
-----------------------

- Read coils/discrete inputs: quantity 1 .. 2000
- Read holding/input registers: quantity 1 .. 125
- Write multiple coils: quantity 1 .. 1968
- Write multiple registers: quantity 1 .. 123
download protocol:

.txt   Modbus_TCP_Protocol.txt (Size: 11.59 KB / Downloads: 288)

Print this item

  "KCS" v3 Modbus RTU over TCP/IP protocol document
Posted by: admin - 06-07-2026, 01:33 AM - Forum: "KCS" v3 firmware - No Replies

KCS protocol webpage, "TCP Server" = "Modbus-RTU-V2". Just RS485 modbus protocol over TCP/IP.

Code:
KCSv3 Modbus RTU over TCP Protocol Specification
================================================

1. Overview
-----------

This document specifies the Modbus RTU over TCP protocol exposed by the
KCSv3 firmware TCP server when the TCP protocol mode is configured for Modbus RTU
frames.

This mode transports a complete Modbus RTU ADU over a TCP socket. It does not use
the standard Modbus TCP MBAP header.

2. Communication Parameters
---------------------------

- Protocol: Modbus RTU ADU transported over TCP
- TCP port: configured by tcp_server_port
- Slave address: configured by tcp_server_protocol_modbus_local_addr
- Register addressing: 0-based Modbus protocol address
- Frame format: [Slave Address][PDU][CRC Lo][CRC Hi]
- CRC: Modbus CRC16, low byte first
- MBAP header: not used

Clients should send one complete RTU ADU frame per TCP request. The firmware
validates the RTU slave address and CRC before processing the PDU.

3. Supported Function Codes
---------------------------

+---------------+---------------------------+-------------------------------+
| Function Code | Name                      | Usage                         |
+---------------+---------------------------+-------------------------------+
| 0x01          | Read Coils                | Read DO output state          |
| 0x02          | Read Discrete Inputs      | Read DI input state           |
| 0x03          | Read Holding Registers    | Read DAC/IR/RF/energy data    |
| 0x04          | Read Input Registers      | Read ADC/temperature/humidity |
| 0x05          | Write Single Coil         | Set one DO or trigger toggle  |
| 0x06          | Write Single Register     | Set DAC or trigger IR/RF      |
| 0x0F          | Write Multiple Coils      | Set multiple DO channels      |
| 0x10          | Write Multiple Registers  | Set multiple DAC channels     |
+---------------+---------------------------+-------------------------------+

4. Addressing Notes
-------------------

All addresses in this document are 0-based Modbus protocol addresses.

Examples:

- Holding register address 100 is sent as 0x0064 in the Modbus PDU.
- Some Modbus tools display holding register 100 as 40101 or similar. Use the
  tool's 0-based/1-based setting carefully.

5. Coils (Function Codes 0x01, 0x05, 0x0F)
-------------------------------------------

5.1 DO Output State and Control
-------------------------------

+------------------------+----------------------+-----------------------------+
| Address Range          | Description          | Access                      |
+------------------------+----------------------+-----------------------------+
| 0 .. DO_NUM-1          | DO output channels   | 0x01 read, 0x05/0x0F write  |
+------------------------+----------------------+-----------------------------+

Write value for function code 0x05:

- 0xFF00: turn ON
- 0x0000: turn OFF

Function code 0x0F supports only the normal DO output range starting at address
0.

5.2 DO Toggle Control
---------------------

+-----------------------------+----------------------+--------------------------+
| Address Range               | Description          | Access                   |
+-----------------------------+----------------------+--------------------------+
| 0x0100 .. 0x0100+DO_NUM-1   | Toggle DO channels   | 0x05 write only          |
+-----------------------------+----------------------+--------------------------+

Write 0xFF00 to address 0x0100 + channel_index to toggle that output channel.
Writing 0x0000 is accepted but does not toggle the output.

6. Discrete Inputs (Function Code 0x02)
---------------------------------------

+------------------------+----------------------+-----------------------------+
| Address Range          | Description          | Access                      |
+------------------------+----------------------+-----------------------------+
| 0 .. DI_NUM-1          | DI input channels    | 0x02 read                   |
+------------------------+----------------------+-----------------------------+

DI inputs are active-low in the firmware mapping:

- Hardware low / active input returns 1
- Hardware high / inactive input returns 0

7. Holding Registers (Function Codes 0x03, 0x06, 0x10)
------------------------------------------------------

7.1 DAC Output Registers
------------------------

+------------------------+----------------------+-----------------------------+
| Address Range          | Description          | Access                      |
+------------------------+----------------------+-----------------------------+
| 0 .. DAC_NUM-1         | DAC output channels  | 0x03 read, 0x06/0x10 write  |
+------------------------+----------------------+-----------------------------+

DAC write value range: 0 .. 255.

Function code 0x10 supports only this DAC register range.

7.2 IR/RF Control Registers
---------------------------

+----------+-------------+----------------------+-----------------------------+
| Address  | Name        | Description          | Access                      |
+----------+-------------+----------------------+-----------------------------+
| 0x0040   | IR_SEND     | Send learned IR slot | 0x03 read, 0x06 write       |
| 0x0041   | IR_LEARN    | Learn IR slot/port   | 0x03 read, 0x06 write       |
| 0x0042   | IR_DELETE   | Delete IR slot       | 0x03 read, 0x06 write       |
| 0x0050   | RF_SEND     | Send learned RF slot | 0x03 read, 0x06 write       |
+----------+-------------+----------------------+-----------------------------+

IR_SEND:

- Value: IR memory slot index
- Valid range: 0 .. IR_MEM_NUM-1

IR_LEARN:

- High byte: IR memory slot index
- Low byte: IR send port number, starting from 1

IR_DELETE:

- Value: IR memory slot index
- Valid range: 0 .. IR_MEM_NUM-1

RF_SEND:

- Value: RF memory slot index
- The selected RF slot must exist and be learned

These registers exist only on board variants with the corresponding IR/RF
feature enabled. Otherwise accesses return an illegal data address exception.

7.3 Energy Measurement Registers
--------------------------------

Energy data is exposed as read-only Holding Registers and is read with function
code 0x03.

Each energy chip uses 68 holding registers. The base address is:

  base = 100 + chip_index * 100

where chip_index starts from 0.

+--------------+----------------+----------------+--------------------------+
| Offset Range | Parameter      | Format         | Resolution / Notes       |
+--------------+----------------+----------------+--------------------------+
| 0 .. 19      | RMS_1..RMS_10  | uint32 CDAB    | Current in A * 1000      |
| 20 .. 39     | WATT_1..WATT_10| int32 CDAB     | Power in W * 10          |
| 40 .. 59     | Energy_1..10   | float32 CDAB   | Energy in kWh            |
| 60 .. 61     | Energy_Sum     | float32 CDAB   | Total energy in kWh      |
| 62           | RMS_V          | uint16         | Voltage in V * 100       |
| 63           | Period         | uint16         | Frequency in Hz * 100    |
| 64 .. 65     | TPS1           | float32 CDAB   | Temperature in deg C     |
| 66 .. 67     | PF             | float32 CDAB   | Power factor             |
+--------------+----------------+----------------+--------------------------+

Per-channel offsets:

+----------------+----------------+----------------+--------------------------+
| Channel        | Current Offset | Power Offset   | Energy Offset            |
+----------------+----------------+----------------+--------------------------+
| 1              | 0              | 20             | 40                       |
| 2              | 2              | 22             | 42                       |
| 3              | 4              | 24             | 44                       |
| 4              | 6              | 26             | 46                       |
| 5              | 8              | 28             | 48                       |
| 6              | 10             | 30             | 50                       |
| 7              | 12             | 32             | 52                       |
| 8              | 14             | 34             | 54                       |
| 9              | 16             | 36             | 56                       |
| 10             | 18             | 38             | 58                       |
+----------------+----------------+----------------+--------------------------+

For 32-bit integer and float values, read two consecutive registers. The lower
16-bit word is returned first, followed by the upper 16-bit word.

Examples:

- Chip 1 current channel 1: read holding registers 100 and 101
- Chip 2 power channel 1: read holding registers 220 and 221
- Chip 1 voltage: read holding register 162
- Chip 1 frequency: read holding register 163

8. Input Registers (Function Code 0x04)
---------------------------------------

+-------------------------------+----------------------+--------------------------+
| Address Range                 | Description          | Format                   |
+-------------------------------+----------------------+--------------------------+
| 0 .. ADC_NUM-1                | ADC input channels   | uint16 raw ADC value     |
| 0x0100 .. 0x0100+SENSOR_NUM-1 | Temperature sensors  | int16, deg C * 10        |
| 0x0120 .. 0x0120+SENSOR_NUM-1 | Humidity sensors     | int16, %RH * 10          |
+-------------------------------+----------------------+--------------------------+

If a temperature or humidity sensor is invalid or not present, the returned
value is 0x7FFF.

9. Board-Dependent Limits
-------------------------

The following symbols depend on the compiled board model:

- DO_NUM: number of digital outputs
- DI_NUM: number of digital inputs
- DAC_NUM: number of DAC outputs
- ADC_NUM: number of ADC inputs
- SENSOR_NUM: maximum temperature/humidity sensor slots
- ENERGY_NUM: number of energy measurement chips

N-series energy chip bases:

+-------+------------+--------------------------------------+
| Board | ENERGY_NUM | Energy Holding Register Bases        |
+-------+------------+--------------------------------------+
| N10   | 1          | 100                                  |
| N20   | 2          | 100, 200                             |
| N30   | 3          | 100, 200, 300                        |
| N60   | 6          | 100, 200, 300, 400, 500, 600         |
+-------+------------+--------------------------------------+

10. Exception Codes
-------------------

+----------------+----------------------------+-------------------------------+
| Exception Code | Name                       | Meaning                       |
+----------------+----------------------------+-------------------------------+
| 0x01           | Illegal Function           | Unsupported function code     |
| 0x02           | Illegal Data Address       | Unsupported address/range     |
| 0x03           | Illegal Data Value         | Invalid value or quantity     |
| 0x04           | Slave Device Failure       | Runtime failure or overflow   |
+----------------+----------------------------+-------------------------------+

11. Request Size Limits
-----------------------

- Read coils/discrete inputs: quantity 1 .. 2000
- Read holding/input registers: quantity 1 .. 125
- Write multiple coils: quantity 1 .. 1968
- Write multiple registers: quantity 1 .. 123
download protocol:

.txt   Modbus_RTU_over_TCP_Protocol.txt (Size: 11.05 KB / Downloads: 253)

Print this item

  "KCS" v3 RS485 Standard Modbus protocol document
Posted by: admin - 06-07-2026, 01:28 AM - Forum: "KCS" v3 firmware - No Replies

KCS protocol webpage, set to "Modbus_RTU-v2" option. it's a standard modbus protocol.

Code:
KCSv3 Modbus RTU Protocol Specification
=======================================

1. Overview
-----------

This document specifies the Modbus RTU protocol exposed by the KCSv3
firmware on the RS485 interface.

2. Communication Parameters
---------------------------

- Protocol: Modbus RTU
- Physical interface: RS485
- Slave address: configured by rs485_local_addr
- Register addressing: 0-based Modbus protocol address
- Frame format: [Slave Address][PDU][CRC Lo][CRC Hi]
- CRC: Modbus CRC16, low byte first

Serial port parameters are configured by the firmware RS485 settings.

3. Supported Function Codes
---------------------------

+---------------+---------------------------+-------------------------------+
| Function Code | Name                      | Usage                         |
+---------------+---------------------------+-------------------------------+
| 0x01          | Read Coils                | Read DO output state          |
| 0x02          | Read Discrete Inputs      | Read DI input state           |
| 0x03          | Read Holding Registers    | Read DAC/IR/RF/energy data    |
| 0x04          | Read Input Registers      | Read ADC/temperature/humidity |
| 0x05          | Write Single Coil         | Set one DO or trigger toggle  |
| 0x06          | Write Single Register     | Set DAC or trigger IR/RF      |
| 0x0F          | Write Multiple Coils      | Set multiple DO channels      |
| 0x10          | Write Multiple Registers  | Set multiple DAC channels     |
+---------------+---------------------------+-------------------------------+

4. Addressing Notes
-------------------

All addresses in this document are 0-based Modbus protocol addresses.

Examples:

- Holding register address 100 is sent as 0x0064 in the Modbus PDU.
- Some Modbus tools display holding register 100 as 40101 or similar. Use the
  tool's 0-based/1-based setting carefully.

5. Coils (Function Codes 0x01, 0x05, 0x0F)
-------------------------------------------

5.1 DO Output State and Control
-------------------------------

+------------------------+----------------------+-----------------------------+
| Address Range          | Description          | Access                      |
+------------------------+----------------------+-----------------------------+
| 0 .. DO_NUM-1          | DO output channels   | 0x01 read, 0x05/0x0F write  |
+------------------------+----------------------+-----------------------------+

Write value for function code 0x05:

- 0xFF00: turn ON
- 0x0000: turn OFF

Function code 0x0F supports only the normal DO output range starting at address
0.

5.2 DO Toggle Control
---------------------

+-----------------------------+----------------------+--------------------------+
| Address Range               | Description          | Access                   |
+-----------------------------+----------------------+--------------------------+
| 0x0100 .. 0x0100+DO_NUM-1   | Toggle DO channels   | 0x05 write only          |
+-----------------------------+----------------------+--------------------------+

Write 0xFF00 to address 0x0100 + channel_index to toggle that output channel.
Writing 0x0000 is accepted but does not toggle the output.

6. Discrete Inputs (Function Code 0x02)
---------------------------------------

+------------------------+----------------------+-----------------------------+
| Address Range          | Description          | Access                      |
+------------------------+----------------------+-----------------------------+
| 0 .. DI_NUM-1          | DI input channels    | 0x02 read                   |
+------------------------+----------------------+-----------------------------+

DI inputs are active-low in the firmware mapping:

- Hardware low / active input returns 1
- Hardware high / inactive input returns 0

7. Holding Registers (Function Codes 0x03, 0x06, 0x10)
------------------------------------------------------

7.1 DAC Output Registers
------------------------

+------------------------+----------------------+-----------------------------+
| Address Range          | Description          | Access                      |
+------------------------+----------------------+-----------------------------+
| 0 .. DAC_NUM-1         | DAC output channels  | 0x03 read, 0x06/0x10 write  |
+------------------------+----------------------+-----------------------------+

DAC write value range: 0 .. 255.

Function code 0x10 supports only this DAC register range.

7.2 IR/RF Control Registers
---------------------------

+----------+-------------+----------------------+-----------------------------+
| Address  | Name        | Description          | Access                      |
+----------+-------------+----------------------+-----------------------------+
| 0x0040   | IR_SEND     | Send learned IR slot | 0x03 read, 0x06 write       |
| 0x0041   | IR_LEARN    | Learn IR slot/port   | 0x03 read, 0x06 write       |
| 0x0042   | IR_DELETE   | Delete IR slot       | 0x03 read, 0x06 write       |
| 0x0050   | RF_SEND     | Send learned RF slot | 0x03 read, 0x06 write       |
+----------+-------------+----------------------+-----------------------------+

IR_SEND:

- Value: IR memory slot index
- Valid range: 0 .. IR_MEM_NUM-1

IR_LEARN:

- High byte: IR memory slot index
- Low byte: IR send port number, starting from 1

IR_DELETE:

- Value: IR memory slot index
- Valid range: 0 .. IR_MEM_NUM-1

RF_SEND:

- Value: RF memory slot index
- The selected RF slot must exist and be learned

These registers exist only on board variants with the corresponding IR/RF
feature enabled. Otherwise accesses return an illegal data address exception.

7.3 Energy Measurement Registers
--------------------------------

Energy data is exposed as read-only Holding Registers and is read with function
code 0x03.

Each energy chip uses 68 holding registers. The base address is:

  base = 100 + chip_index * 100

where chip_index starts from 0.

+--------------+----------------+----------------+--------------------------+
| Offset Range | Parameter      | Format         | Resolution / Notes       |
+--------------+----------------+----------------+--------------------------+
| 0 .. 19      | RMS_1..RMS_10  | uint32 CDAB    | Current in A * 1000      |
| 20 .. 39     | WATT_1..WATT_10| int32 CDAB     | Power in W * 10          |
| 40 .. 59     | Energy_1..10   | float32 CDAB   | Energy in kWh            |
| 60 .. 61     | Energy_Sum     | float32 CDAB   | Total energy in kWh      |
| 62           | RMS_V          | uint16         | Voltage in V * 100       |
| 63           | Period         | uint16         | Frequency in Hz * 100    |
| 64 .. 65     | TPS1           | float32 CDAB   | Temperature in deg C     |
| 66 .. 67     | PF             | float32 CDAB   | Power factor             |
+--------------+----------------+----------------+--------------------------+

Per-channel offsets:

+----------------+----------------+----------------+--------------------------+
| Channel        | Current Offset | Power Offset   | Energy Offset            |
+----------------+----------------+----------------+--------------------------+
| 1              | 0              | 20             | 40                       |
| 2              | 2              | 22             | 42                       |
| 3              | 4              | 24             | 44                       |
| 4              | 6              | 26             | 46                       |
| 5              | 8              | 28             | 48                       |
| 6              | 10             | 30             | 50                       |
| 7              | 12             | 32             | 52                       |
| 8              | 14             | 34             | 54                       |
| 9              | 16             | 36             | 56                       |
| 10             | 18             | 38             | 58                       |
+----------------+----------------+----------------+--------------------------+

For 32-bit integer and float values, read two consecutive registers. The lower
16-bit word is returned first, followed by the upper 16-bit word.

Examples:

- Chip 1 current channel 1: read holding registers 100 and 101
- Chip 2 power channel 1: read holding registers 220 and 221
- Chip 1 voltage: read holding register 162
- Chip 1 frequency: read holding register 163

8. Input Registers (Function Code 0x04)
---------------------------------------

+-------------------------------+----------------------+--------------------------+
| Address Range                 | Description          | Format                   |
+-------------------------------+----------------------+--------------------------+
| 0 .. ADC_NUM-1                | ADC input channels   | uint16 raw ADC value     |
| 0x0100 .. 0x0100+SENSOR_NUM-1 | Temperature sensors  | int16, deg C * 10        |
| 0x0120 .. 0x0120+SENSOR_NUM-1 | Humidity sensors     | int16, %RH * 10          |
+-------------------------------+----------------------+--------------------------+

If a temperature or humidity sensor is invalid or not present, the returned
value is 0x7FFF.

9. Board-Dependent Limits
-------------------------

The following symbols depend on the compiled board model:

- DO_NUM: number of digital outputs
- DI_NUM: number of digital inputs
- DAC_NUM: number of DAC outputs
- ADC_NUM: number of ADC inputs
- SENSOR_NUM: maximum temperature/humidity sensor slots
- ENERGY_NUM: number of energy measurement chips

N-series energy chip bases:

+-------+------------+--------------------------------------+
| Board | ENERGY_NUM | Energy Holding Register Bases        |
+-------+------------+--------------------------------------+
| N10   | 1          | 100                                  |
| N20   | 2          | 100, 200                             |
| N30   | 3          | 100, 200, 300                        |
| N60   | 6          | 100, 200, 300, 400, 500, 600         |
+-------+------------+--------------------------------------+

10. Exception Codes
-------------------

+----------------+----------------------------+-------------------------------+
| Exception Code | Name                       | Meaning                       |
+----------------+----------------------------+-------------------------------+
| 0x01           | Illegal Function           | Unsupported function code     |
| 0x02           | Illegal Data Address       | Unsupported address/range     |
| 0x03           | Illegal Data Value         | Invalid value or quantity     |
| 0x04           | Slave Device Failure       | Runtime failure or overflow   |
+----------------+----------------------------+-------------------------------+

11. Request Size Limits
-----------------------

- Read coils/discrete inputs: quantity 1 .. 2000
- Read holding/input registers: quantity 1 .. 125
- Write multiple coils: quantity 1 .. 1968
- Write multiple registers: quantity 1 .. 123
download protocol:

.txt   Modbus_RTU_Protocol.txt (Size: 10.7 KB / Downloads: 293)

Print this item

  KC868-A32 PCB layout CAD file
Posted by: admin - 06-05-2026, 11:44 AM - Forum: Schematic & diagram & Dimensions of KinCony PCB layout CAD file - No Replies

KC868-A32 PCB layout CAD file

.zip   KC868-A32-V1.4_DWG.zip (Size: 4.19 MB / Downloads: 435)

Print this item

  KC868-A8 OpenPLC Function Blocks for RELAY
Posted by: admin - 06-05-2026, 12:50 AM - Forum: KC868-A8 - No Replies

Code:
#include <Arduino.h>                // Core Arduino functions and definitions
#include <PCF8574.h>               // Library for PCF8574 I2C I/O expander

#define I2C_RELAYS_ADR 0x24          // I2C address of the PCF8574 module


PCF8574 pcf(I2C_RELAYS_ADR);        // Create PCF8574 object using the defined I2C address

void setup() {
    // Initialize I2C communication
    Wire.begin(4, 5);                 // Parameters: SDA pin = 4, SCL pin = 5
   
    pcf.begin();            // Initialize the PCF8574 device

    // Configure all PCF8574 pins (P0–P7) as outputs
    pcf.pinMode(P0, OUTPUT);
    pcf.pinMode(P1, OUTPUT);
    pcf.pinMode(P2, OUTPUT);
    pcf.pinMode(P3, OUTPUT);
    pcf.pinMode(P4, OUTPUT);
    pcf.pinMode(P5, OUTPUT);
    pcf.pinMode(P6, OUTPUT);
    pcf.pinMode(P7, OUTPUT);

    // Safe startup state
    pcf.digitalWrite(P0, HIGH);
    pcf.digitalWrite(P1, HIGH);
    pcf.digitalWrite(P2, HIGH);
    pcf.digitalWrite(P3, HIGH);
    pcf.digitalWrite(P4, HIGH);
    pcf.digitalWrite(P5, HIGH);
    pcf.digitalWrite(P6, HIGH);
    pcf.digitalWrite(P7, HIGH);
}

void loop() {
    // Continuously update each PCF8574 output pin based on OpenPLC variables
    // OUT_0 to OUT_7 are boolean variables provided by OpenPLC

    // If OUT_x is true → set pin LOW (turn relay ON)
    // If OUT_x is false → set pin HIGH (turn relay OFF)

    pcf.digitalWrite(P0, OUT_0 ? LOW : HIGH);
    pcf.digitalWrite(P1, OUT_1 ? LOW : HIGH);
    pcf.digitalWrite(P2, OUT_2 ? LOW : HIGH);
    pcf.digitalWrite(P3, OUT_3 ? LOW : HIGH);
    pcf.digitalWrite(P4, OUT_4 ? LOW : HIGH);
    pcf.digitalWrite(P5, OUT_5 ? LOW : HIGH);
    pcf.digitalWrite(P6, OUT_6 ? LOW : HIGH);
    pcf.digitalWrite(P7, OUT_7 ? LOW : HIGH);
}
   

Print this item

  KinCony Pi5M16 – Raspberry Pi CM5 IoT Gateway released
Posted by: admin - 06-05-2026, 12:00 AM - Forum: News - No Replies

KinCony Pi5M16 – Raspberry Pi CM5 DIN Rail MOSFET Controller for Smart Home & Industrial Automation
[Image: Pi5M16-1.jpg]
Product Overview
KinCony Pi5M16 is a powerful Raspberry Pi-based IoT gateway designed for smart home automation and industrial control applications. Powered by the Raspberry Pi Compute Module 5 (CM5), it integrates 16-channel MOSFET outputs, optocoupler-isolated digital inputs, analog inputs, RS232/RS485 communication interfaces, PWM outputs, and multiple expansion interfaces into a compact DIN rail aluminum enclosure.
Pi5M16 is an ideal solution for automation projects requiring reliable DC load control. The CM5 directly manages MOSFET outputs, digital inputs, analog inputs, PWM outputs, and serial communication ports, making it easy to develop applications using Node-RED, Home Assistant, Python, MQTT, Modbus, and other Linux-based software platforms.
[Image: Pi5M16-5.jpg]


Key Features
  • Powered by Raspberry Pi Compute Module 5 (CM5)
  • 16-channel MOSFET outputs
  • 16-channel optocoupler-isolated digital inputs
  • Supports Home Assistant and Node-RED
  • RS232 and RS485 communication ports
  • 2-channel PWM outputs
  • 2 × DC 0-5V analog inputs
  • 2 × 4-20mA analog inputs
  • 20 free GPIO expansion ports
  • Gigabit Ethernet support
  • M.2 M-Key PCIe expansion socket
  • DIN rail installation
  • SSD1306 I2C OLED display
  • Industrial aluminum enclosure
  • Ideal for smart home and industrial automation projects

[Image: Pi5M16-7.jpg]

Print this item

  KinCony Pi5R16 – Raspberry Pi CM5 IoT Gateway released
Posted by: admin - 06-04-2026, 12:59 PM - Forum: News - No Replies

KinCony Pi5R16 – Raspberry Pi CM5 DIN Rail IoT Gateway for Smart Home & Industrial Automation
[Image: Pi5R16-1.jpg]
Product Overview
KinCony Pi5R16 is a powerful Raspberry Pi–based IoT gateway designed for smart home automation and industrial control applications. Built around the Raspberry Pi Compute Module 5 (CM5), it integrates relay outputs, opto-isolated digital inputs, analog inputs, RS232/RS485 communication, PWM outputs, and multiple expansion interfaces into a compact DIN rail aluminum enclosure.
Pi5R16 is ideal for users who want to build local automation systems using platforms such as Home Assistant, Node-RED, MQTT, Modbus, or custom Linux applications.
The CM5 module directly manages all relays, digital inputs, analog inputs, PWM outputs, and serial communication ports, making development and deployment simple and flexible.
[Image: Pi5R16-5.jpg]


Key Features
  • Raspberry Pi Compute Module 5 (CM5) integrated
  • 16-channel relay outputs
  • 16-channel optocoupler-isolated digital inputs
  • Supports Home Assistant and Node-RED
  • RS232 and RS485 communication ports
  • 2-channel PWM outputs
  • Analog input support:
    • 2 × DC 0–5V
    • 2 × 4–20mA
  • 20 free GPIO expansion ports
  • Gigabit Ethernet support
  • M.2 PCIe expansion socket
  • DIN rail aluminum enclosure design
  • SSD1306 I2C OLED display
  • Designed for industrial and smart home automation

[Image: Pi5R16-7.jpg]

Print this item

  Input real isolation
Posted by: teji - 06-03-2026, 08:31 PM - Forum: KC868-AI - Replies (3)

Hello. This board is exactly what i need... but....
is there a way to really isolate optocoupers input ? 
if same as (very good) 868-a16, the input are powered by same power supply as all the board.
then if someone put voltage (not contact) at input, it will burn all board.
is it possible to cut/separate/disconnect 12V and GND for optocoupers input ? (then use external power supply for this) ?
on a16, no jumper for this, but all 12V on opto in are on a single track. than you can Cut to isolate (and use own gnd)
is it also possible on 868-ai ? it depend of the routing (one track or different tracks, ...)
thanks for you help and you fantastics cards.

Print this item