OK so here we go.. of course the chinese manufacturer wont tell me their communications language.. so really i just have to Geek it up and figure it out my damn self...
I figured my main interest is in controlling the heater remotely so I want to read what the control device sends to the heater and see if I can re-create the records..
while the chinese are known for making really cool devices, they REALLY tend to stick to old-school USA communications protocols and electronics conventions..
my heater has 4 wires in the control harness. its easy to guess that 2 will be power and ground, in some the 3rd wire will be a On / Off. meaning when it has 12 volts the heater turns on, when it has 0 the heater turns off... and then 1 wire would be communications..
in the case of this heater it turns out there are 2 communications lines.. a send and a receive.. one wire sends data from the control to the heater and the other sends data from the heaster to the controller.
Red - +12
Brown/green - Ground
Blue - TX from control
Green - TX from heater.
when I stuck a meter on blue or green to ground I saw a basically +5 volt signals that fluctuated slightly I surmised that these were communications wires.
+5 volts is perfect for a nice Logic analyzer.. holding at positive voltage indicated typical TTL level communications from a micro controller . ther wire is held high by a pullup resistor and then each bit is produce by bring the wire down to 0 for a specified time then raising it back up.. this produces 1s and 0s. in the waveform.
when I looked at the timings it seemed to me to be standard single wire serial data.. I figured I should be able to make something out of it if I were to run an analyzer across it.. my Saleae logic analyzer has protocol recognition.. so I told it to go to it. and it came back with 8 data bits, 9600 baud serial data..
after I took a few samples I realized that a record was easy to read humanly at least to get its numbers..
Code:
S T 2 0 0 0 3 0 0 0 0 2 2 0 2 9 0 0 0 0 4 7 2 0 6 O V
starts with an ST and is 'over' with an OV
watching the heater side it starts with an ST1
so right out of the box you can say the heater is address '1' and the controller is address '2'
so I captured more records and I set the heater from 71c to 75c. and I could see a change in the record.
see the 75 in there? yep one can assume thats the field where the temperature belongs.
Code:
S T 2 0 0 0 8 7 5 6 0 2 2 0 2 9 0 0 0 0 6 0 4 0 3 O V
the last 5 digits always change with any change in the other data.. so its assumed that this would be an error checking mechanism.
serial data like this is very prone to errors.. sometimes you add up the ASCII or hex values of all the prior digits and it would be a checksum
so i did that and no-dice didnt get 60403. then i thought well the largest 16 bit number in the universe is 65535 which just happens to be 5 digits long
and ive never seen anything larger in that field no matter how much data I captured.
that was a tip-off that they may be using a CRC method.. so I took all of the digits after the 'ST' and before that 60403, cheated and ran them through an online CRC calculator
200087560220290000
and it came back with a hex number of EBF3 when i ran it through a CRC-CCITT seeded with 0xFFFF.. oh I got a hit!! when i converted it to Decimal i got.. you guessed it 60403.
so now im well on my way to cracking the chinese code for the heater control.. this will be rather easy to control with an arduino or raspberry pi device.
Dark Green - Start sequence
Light Green - unit Address
Light Blue - Temperature setpoint
yellow - 16 bit CRC-CCITT seeded with 0xFFFF
red - End Sequence..
and thats how I geek out with espresso when i get bored..
-Christopher