I am trying to get my Arduino to talk to some Heatmiser Thermostats via rs485 and the Heatmiser Protocol.
I have got as far as purchasing a MAX485 rs485>rs232 converter and wiring it up as follows:
N.B. The Heatmiser Thermostat is powered by an external 12v DC power source.
It comes with a blue cable and a yellow cable; these are the two data comms cables that we wire into the MAX485′s A & B pins.
The MAX485 has 8 pins:
- RO – Receiver out – Connected to Arduino Serial RX pin 0
- RE – Receiver enable (enabled when this pin is LOW) – Connected to Arduino Pin 7
- DE – Driver enable (enabled when this pin is HIGH) – Connected to Arduino Pin 7
- DI – Driver in (the transmitter pin) – Connected to Arduino Serial TX Pin 1
- GND – Connect to Arduino GND pin
- A – Connect to Yellow wire of the Thermostat
- B – Connect to Blue Wire of the Thermostat
- Vcc – Power, Connect to Arduino 5v pin
Now for the sketch:
// Arduino's Pin 7 Connected to Pins 2 & 3 (RE/DE) on MAX485
int switchPin = 7;
// Our Serial RX pin connected to RO- Receiver Output Pin on Max485- we receive on
#define rxPin 0
// Our Serial TX pin connected to DI- Driver Output Pin on Max485 - we send on
#define txPin 1
// here we insert the paramaters of our read request
byte req[]= {0x02, 0x04, 0x00, 0x06};
// for incoming serial data
byte incomingByte = 0;
void setup() {
// opens serial port, sets data rate to 4800 bps(Heatmiser baud rate)
Serial.begin(4800);
//sets our Arduino's serial TX pin to send data
pinMode(txPin, OUTPUT);
//sets our Arduino's serial RX pin to receive data
pinMode(rxPin, INPUT);
// set the MAX485 to 'Driver Output Enable' by switching its pin 3 to HIGH
digitalWrite(switchPin, HIGH);
// send command string that requests the reading from the Heatmiser Thermostat
Serial.write(req, 4);
// set the MAX485 to 'Receiver Output Enable' by switching its pin 2 to LOW
digitalWrite(switchPin, LOW);
}
void loop() {
// kick in only when we receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what we got:
Serial.println(incomingByte);
}
}
According to the Heatmiser Protocol I need to initiate communications by sending a command string from the Master (Arduino) to the slave (Thermostat) before it will respond with the data I want to read from it.
Now all I need to do is figure out how to formulate this command string?
The Heatmiser Protocol instructions show an example for sending a command string as follows:
To query no.2 thermostat:
Send(Hex): 02H, 04H, 00H, 06H
The first unit(02H) is the address of the thermostat, the second(04H) is the request code asking the thermostat for its stats. I don’t know what the third one is so we will leave it as it is in the example. Finally, the last unit(06H) is the checksum of all the preceding units.
I have set my thermostat to use the Comms address 02 as in the example and am going to use the following code to send the command string listed in the example(02H, 04H, 00H, 06H) from the arduino to the thermostat:
byte req[]= {0×02, 0×04, 0×00, 0×06};
Serial.write(req, 4);
Alas, there is no reply from the thermostat. All i see on the serial monitor is this: [][][][]
Am I sending the correct values in the command string request?
The Heatmiser Thermostats are the vesion 2 protocol but the documentation for version 2 is sparse, and very different from the documentation for the version 3 protocol…
There is an example here on how to poll a version 3 thermostat for its readings:
The command to read back all the data from a PRT-N V3 set to address 01 is:- 01 0A 81 00 00 00 FF FF 2C 09
This is very different from the format specified in the example for the V. 2 protocol: 02H 04H 00H 06H
Confusing..
Am I sending these bytes correctly?
I have contacted Heatmiser to see if they could offer me any more documentation on the heatmiser protocol, but they haven’t been very helpful.
Damian suggested that I get my hands on an oscilloscope, and that you really need one of these in order to be able to debug RS485 comms. So I am looking out on ebay to see if I can pick one up cheapish..
Update 13th July 2010: I have decided to try and look for an alternative to Heatmiser. They have been unhelpful and their protocol is clearly not open. If anyone knows of a programmable thermostat that can be made to talk to an Arduino please let me know..


