It looks like the OpenTherm gateway is sensitive to noise and wiring lengths. All my attempts to move the gateway upstairs, next to the boiler/heater, failed. Somehow, this:
THERMOSTAT <=> GATEWAY <=> 10 m wire <=> HEATER
… is not the same as this!
THERMOSTAT <=> 10 m wire <=> GATEWAY <=> HEATER
The OpenTherm documentation (PDF) specifically allows up to 50 meters of untwisted wiring, but I’m clearly running into some issue here.
Time to drag the scope downstairs and hook it up between gateway and heater:
The yellow trace is the voltage between the two wires, while the blue trace is the current through those wires. I used a 1 Ω resistor and measured the voltage drop, but had to switch to the most sensitive scale (since I’m using the standard x10 probe), hence all that noise.
Still, you can see the magic of the way the OpenTherm protocol works:
- in rest, there’s 6V between the wires and about 6 mA of current flowing (a 1 kΩ load)
- this is used by the thermostat to power itself (by keeping a capacitor charged)
- when the thermostat sends data, it briefly reduces its current draw
- since the boiler (or gateway) is feeding a constant current, this makes voltage go up
- that voltage change is then detected and decoded by the boiler / gateway
- about 40 ms later, the boiler / gateway then sends a reply
- it does this by briefly forcing more current down the wire
- this in turn can be detected by the thermostat, which then decodes that reply
- there’s a small residual ripple, as the thermostat tries to maintain its 7V idle level
I was going to perform the same measurement on the other side of the gateway, i.e. the connection to the thermostat, but for some reason the gateway really doesn’t like me touching anything or connecting any wires to it (let alone a grounded scope probe). Maybe some noise is picked up and feeding back into one of the PIC’s I/O pins, and completely throwing it off. Luckily, the whole gateway always resets properly when left alone again.
I also sometimes see the thermostat indicating a fault (even just by touching the wire with the scope probe) – so it seems to be getting some power, but it’s definitely not happy.
Maybe the gateway’s output circuit is too sensitive, due to some high-impedance parts in the circuit? That would explain why even just using some long wires two floors down prevents the gateway from working.
Hm, not good – especially since I only wish to monitor the wire, not control it…
Update – these problems are caused by a floating ground. More on this once I get it all sorted out. With many thanks to Schelte Bron for dropping by and helping analyse this!
I was about to say, floating ground or floating pin of some sort. When you touch stuff and its acts weird – that’s your clue that there is a floating voltage somewhere.
If its not a floating ground – try putting a 100k ohm resistor between the pin you are testing and ground (or the 6v source maybe, hard to say) – a pull-down/up resistor of some sort. Sometimes that fixes these weird problems. Been there. Done that.
Hi JC, also remember where you live: Very close to those ‘tallest in the world xmas trees’. Those transmitters do create all kinds of havoc in your wiring. I would consider adding loads of ferrite chokes on the wires, to see if things change (for the better). (This probably ties in with your ground issues?)
Ah, that would indeed explain things. Hmmm… those thermostat wires running down the house might make a nice aerial for AM radio reception? Energy harvesting would be a bit silly, since it’s not where the energy is needed :)
Any progress or details about the floating ground issue?
I’m getting data out when the OTG/thermostat loop is grounded, and not when disconnected. But there are still occasional hick-ups – might be due to the sketch I’m using, so for now no conclusions yet. The packets sometimes stop coming in, but it always resumes by itself after a while.
Hmmm, any correlation between the boiler firing up and the temporary loss of communication?
Don’t think so, but I’m collecting data to be able to explore such questions.
Hi JC, I’ve discussed the gateway problem and the solution with Schelte a bit. Can the thermostat cable pickup noise, more specific an induction caused voltage, because it runs parallel to power lines? Beware of switched conductors. I don’t know if the malfunction always occurred or sporadic. Perhaps you can measure the potential difference between earth/protective ground and the loose end of the thermostat cable at the boiler side.
Jeroen, it’s not impossible, although I don’t think there are power lines in parallel anywhere. The wires do run 2 levels down in the house. I’ve now removed the 1.5 MΩ resistor between the OTG-thermostat loop and ground, and have tied that loop directly to ground. Will let lit run for a few days again and then I’ll look at the packet arrivals to see if there are any patterns emerging. Time of day or something.