Monday, July 4, 2011

OpenTherm success

I have been waiting for someone to connect an arduino to a boiler using OpenTherm. Someone has managed to use some circuit and an arduino to listen, but I want to be able to send messages as well.

So, I read and reread the OpenTherm standard which is available, v2.2, and have been cooking a solution.

The thing is a current loop, so to read it, one doesn't need more then an optocoupler. to control it, one has to vary the voltage between around 5V and 17V, but the boiler provides a fixed current. So, if the current is fixed and you want (have) to change the voltage, you need to change the resistance.

My plan was then to use two optocouplers, one to read, and one to write the messages. Here is my circuit:
I used a 4N27 and not a 4N35 as in the diagram. The boiler connects at the terminals at the right, and the bridge is also an integrated bridge. The boiler side resistor is 2.2K and 1W, so not the normal low power resistors!! The arduino resistor is a 220 to drive the led.

I haven't yet connected the output of the other optocoupler, the receiver one, but that should not be much work, the worse is to detect and decode the pulses, but for that someone also wrote a library (see link above).

And the good news, works! or at least I think it does...

I tried first doing a PWM control, corresponding to OpenTherm lite (OT-) as defined in the standard, but my boiler doesn't seem to support that, so I wrote a manchester encoder, and sent a message to the boiler, and the boiler replied. It uses interrupt driven code to deliver the pulses with the proper timing.

I haven't actually decoded the reply yet, or sent any real commands to the boiler, I only saw the reply from the boiler in the oscilloscope. Images and code will follow soon...the camera had no battery to take a picture of the oscilloscope in that moment of glory!