Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to send command and debug with KC868-COLB by yourself
#1
KC868-COLB support use by MQTT or TCP Server or TCP Client work mode. When using MQTT, use Json format send command. When using TCP by HEX format command. KC868-COLB's PC software support "DEBUG" mode for programmer developing.
   
open your KC868-COLB PC software, use mouse left button quick click > 5 times will enable "DEBUG" mode.


   
this page for debug relay


   
this page for read digital input, analog input and DS18B20 temperature sensor data.

   
this page for debug set temperature and analog input threshold and RTC clock

   
This is write RTC clock example.

for example, set RTC clock:
we set 2022-03-08  21:38:00 to KC868-COLB

send command is:
5E 01 32 C0 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 03 08 15 26 00

0x5E 01 : begin byte, never change it.
0x32 C0: command type
0x06 00: message length  now the message is "16 03 08 15 26 00"  total 6 bytes
0x00 ... ... 00  38 of 0x00 retain bytes, not chang it.
0x16 03 08 15 26 00 is year,month,date, hour,minute,second
0x16=22 use two last number of year, default begin with20 so year=2022
0x03=03
0x08=08
0x15=21
0x26=38
0x00=00
Reply
#2
how to send RS485 command to KC868-COLB. 
Let's see an example: How to read data of electric energy meter by KC868-COLB via RS485 ModBus


1. Read power consumption:
Example:
Send:
5E 01 03 C0 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 03 00 00 00 02 CE 40

5E 01 03 C0 is fixed, never change. 5E 01 is begin byte, 03 C0 is command for RS485.
08 00 is message command length, now it's 8 bytes.
38pcs of "00" is reserved area for furture.
7A 03 00 00 00 02 CE 40  is send for power meter, this is ModBus protocol
7A hex->dec is 122.  122 is power meter address ID.

Feedback:
5E 01 03 C0 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 03 04 42 53 33 33 81 B8

7A 03 04 42 53 33 33 81 B8

7A hex->dec is 122.  122 is power meter address ID.
03 is Modbus function: read    04 is length of data      81 B8 is CRC code
42 53 33 33 is float , need convert to dec, 0x42533333 is 52.8 Kwh

          

2. Read power voltage:
Example:
Send:
5E 01 03 C0 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 03 00 64 00 02 8F 9F

Feedback:
5E 01 03 C0 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 03 04 43 5C 00 00 E4 A2


7A 03 04 43 5C 00 00 E4 A2
43 5C 00 00 is float , need convert to dec, 0x435C0000 is 220V

3. Read power current:
Example:
Send:
5E 01 03 C0 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 03 00 6A 00 02 EE 5C

Feedback:
5E 01 03 C0 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 03 04 3F 99 99 9A 07 34


7A 03 04 3F 99 99 9A 07 34
3F 99 99 9A is float , need convert to dec, is 1.2A

4. Read power:
Example:
Send:
5E 01 03 C0 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 03 00 76 00 02 2F 9A

Feedback:
5E 01 03 C0 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 03 04 3F 5C 28 F6 63 74

7A 03 04 3F 5C 28 F6 63 74
3F 5C 28 F6 is float , need convert to dec, is 0.86kw

5. Read power factor:
Example:
Send:
5E 01 03 C0 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 03 00 8E 00 02 AE 6B

Feedback:
5E 01 03 C0 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 03 04 3F 73 33 33 98 1E


7A 03 04 3F 73 33 33 98 1E
3F 73 33 33 is float , need convert to dec, is 0.95Q

6. Read power frequency:
Example:
Send:
5E 01 03 C0 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 03 00 90 00 02 CE 6D

Feedback:
5E 01 03 C0 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7A 03 04 42 48 0A 3D 62 2B


7A 03 04 42 48 0A 3D 62 2B
42 48 0A 3D is float , need convert to dec, is 50.01Hz
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)