Page 1 of 1

Can OpenTherm help in my specific case? --newbie question--

PostPosted: Wed Mar 14, 2018 7:31 pm
by thewall
Hi all,

Reading for a long while this forum it seems that most of the contributors are far more advanced than I am. I still hope someone can point me in the right direction for my newbie question at hand.

My situation is that I have 7 (room)thermostats in my house that communicates with a central unit from Uponor. When a room requires a higher temperature the thermostat sends a signal to the central unit which controls a valve specific to that room and it starts the boiler. As of now, it doesn't modulate, it just starts the boiler at full throttle. The Uponor isn't any good so I started to write and build my own system, based on node/c on a Pi.

I've build some sensors for the rooms using ESP8266 and MQTT, which send temp signals to the pi. All good.

My boiler is an Itho/daalderop Base Cube that is supposed to support OpenTherm.

What I'm struggling with is how to communicate from my Pi to my boiler over OpenTherm? I see a lot of posts on OT Gateway but it looks like a gateway to me (hehe), not so much to actually control the boiler...

What do I need to buy or build to have my Pi control the boiler over OpenTherm?

Many thanks!


Re: Can OpenTherm help in my specific case? --newbie question--

PostPosted: Fri Mar 16, 2018 10:15 pm
by daveh
I hope the answer is yes as this is very much the use case that I have in mind.
I have *most* of the solution built using node-red and mqtt connected sonof units and openenergymonitor emonth units.
What I am trying to find out is if the a mqtt topic for the openthermgw either exists or can be written.
I was hoping to have a command set similar to:
taking inspiration from the ... vse-build/ project that exposes the functionality

Re: Can OpenTherm help in my specific case? --newbie question--

PostPosted: Sat Mar 17, 2018 12:09 am
by thewall
I hope the answer is yes as well, but until now it has been a bit quiet on this topic. That makes me feel that there is no such thing as a raspberry and/or arduino setup to communicate with Opentherm. Yet.
I found this website: in which the owner developed a small project how to control a boiler from an arduino.

Once that is in place, an MQTT interface should not be extremely difficult...

Re: Can OpenTherm help in my specific case? --newbie question--

PostPosted: Sat Mar 17, 2018 12:16 am
by hvxl
The standard firmware of the gateway can communicate autonomously to the boiler. However, it won't request the boiler to start heating unless instructed via the CS serial command.
To make use of this feature you need to develop your own program that determines the desired control setpoint and sends it to the gateway.

Re: Can OpenTherm help in my specific case? --newbie question--

PostPosted: Sun Mar 18, 2018 3:40 pm
by thewall
OK thanks, I reckon it can be done, yet not sure how. I've added a drawing reflecting my setup.

Sensors reports plain temperature. The code in the Pi checks with desired value in the database and if needed opens the valve to the room and starts the boiler.

I understand that I need to write my own code, question would be if I should use the gateway to start the boiler or would it be better/advisable to leave out the otgw and directly communicate with the boiler?

Or is the code that I need to write exactly the same in both cases and it the gateway 'only' for reporting/graphs?

For me, it is not yet clear how to tackle this. Any advise is very much appreciated!


Re: Can OpenTherm help in my specific case? --newbie question--

PostPosted: Sun Mar 18, 2018 5:11 pm
by hvxl
I think you are a bit confused about the terminology. The OTGW is the hardware interface that will allow your Pi to talk to the boiler. It's basically an Opentherm <-> RS232 converter (with a few extra features). You will need that, unless you have some other way to talk to the boiler. The part that does the reporting/graphs is OTmonitor. That just a piece of software. In your case I definitely wouldn't put that in between. It only adds more possibilities for failure.

It might be useful for your program to provide a server socket that echoes the communication with the OTGW. Then you can connect OTmonitor to that when you want to do some debugging.

Re: Can OpenTherm help in my specific case? --newbie question--

PostPosted: Mon Mar 19, 2018 4:03 pm
by thewall
Right, yes, I might have been confused, and you helped me a lot by stating that the proposed set-up (pi <-> otgw <-> boiler) will be the proper one.

I've read that the otgw is now able to receive a simple on/off signal (from pi or thermostat) as well, so I can proceed with that for the moment.

The next step would be, however, to have the pi talk OT-protocol to the boiler so that I can modulate the temperature etc.

Any examples or pointers how to do that?

Many thanks,__Frank

Re: Can OpenTherm help in my specific case? --newbie question--

PostPosted: Mon Mar 19, 2018 5:47 pm
by hvxl
The on/off control of the gateway is very simplistic. Since the gateway doesn't know the room temperature when used this way, it can not determine how much heat is needed, so it just turns the boiler on at full blast. But as I understand it, that is no worse than what your current control is doing.

I think the next step would be to tell the gateway the water temperature you want the boiler to produce. So, probably on a regular basis, you calculate that value and send a CS command to the gateway. If you only need a little bit of heating when one room is falling below the setpoint, that would be a low value, 35⁰C or so. If you want to increase the temperature by several degrees in multiple rooms, it could be 80⁰ or even more. If no heating is required, you send CS=0. That will also switch off the CH enable bit, which will usually cause the pump to stop running after a while in most systems.

For even more control, you can also use the MM command. But I have only ever seen 2 values from existing thermostats: 0% and 100%. 0% means minimal heating (but heating nonetheless). This may seem strange at first glance, but the MM command applies to the parameter called "Maximum Relative Modulation". It specifies a point between the minimum and maximum modulation a boiler can do. A relative value of 0% may translate to something like 30% absolute modulation. Generally speaking you would normally set either MM or CS to its maximum value and then control the temperature with the other parameter. You can switch between the two methods depending on the circumstances.

Using the method described above, the gateway will send OT messages to the boiler every second, as prescribed by the specs. Your program only has to send a CS command whenever a new value has been calculated. Every 30 seconds would be frequently enough. It doesn't even have to be on a regular basis.

It is possible for your Pi to be in complete control of the OT messages that are sent to the boiler. But then you need to load different firmware: interface.hex. I would not advise to do that unless you run into limitations with the CS command.

Now the difficult part is calculating the desired water temperature. With one input (thermostat) that's already complicated enough (suggested search term: PID controller). I really have no idea how to do it with 7, especially if each room can have a different setpoint. Maybe just calculate a desired water temperature for each room and let the highest one win. But the number of open valves will probably also affect the heating characteristics. I'm afraid I can't be of much help there.

Re: Can OpenTherm help in my specific case? --newbie question--

PostPosted: Mon Mar 19, 2018 7:39 pm
by thewall
Well, this is *excellent* information, Thanks very much. I will start to work on it, and keep it simple in the beginning.

I can work with a temperature sensor on the return to the boiler to create a closed loop. But perhaps it doesn't need to be. I guess your suggestions is great to just lower the water temperature when the room is near its setpoint, but in the morning when there is a larger gap, just go for the higher temperature. I can even log the settings for a while and find a mean value for it. ( It doens't need to be calculated with the highest of accuracy)

Still, if I may, one question,

What would be (in pseudo code) a command for CS to send from the pi to OTGW?

I saw the general format of the data to be sent should be:

//0 000 0000 00000000 00000000 00000000

In this case the MSG-TYPE would be 'CS' etc?

May thanks!

Re: Can OpenTherm help in my specific case? --newbie question--

PostPosted: Mon Mar 19, 2018 8:27 pm
by hvxl
The data format you describe is what is used on the Opentherm interface between the OTGW and the boiler. Between the Pi and the OTGW, communication happens on a higher level. So an example of the CS command your program would send to the OTGW is: CS=32.48\r (where \r is the carriage return character). That will lead to the OTGW sending the Opentherm message 0x1001207A to the boiler or, in binary: 0 001 0000 00000001 00100000 01111010. But you don't have to worry about that.

Re: Can OpenTherm help in my specific case? --newbie question--

PostPosted: Fri Mar 23, 2018 4:36 pm
by thewall
Ah! OK, it begin to sink in now! This is *great* info.

The only question I would have is how to send the CS=32.48\r info from Pi to OTGW. Is it a serial communication (do I have to set up a baudrate for example) or is there a pointer where I can find that specific info?

Many thanks and have a great wekend!

Re: Can OpenTherm help in my specific case? --newbie question--

PostPosted: Fri Mar 23, 2018 10:07 pm
by hvxl
Unless you use the wifi version of the OTGW, the communication between the Pi (or other computer) and the OTGW is via a serial device, either a real serial port or a USB-serial adapter. The serial interface uses 8-bit data words with no parity and 1 stop bit at 9600 baud. This information is actually mentioned on the web site.

Now, how to do serial communication using node/c, I can't tell you. I don't even know what node/c is, unless you mean node.js or C. In C it is quite a bit of work. In Tcl it is simple, which is why I used Tcl for OTmonitor 8)

Re: Can OpenTherm help in my specific case? --newbie question--

PostPosted: Fri Mar 23, 2018 11:11 pm
by thewall
Right! Now its clear! And again kudos for the info and answers.

I meant indeed node.js and C. In my HomeAutomation for controlling the lights by means of X10 commands I use a Pi to communicate over serial to the PMIX controller This is a USB-serial interface between a PC and the powerlines to transport the control signals.

I use Minicom to configure the serial setting (like parity, baudrate etc) and then just open the USB as a file with fopen() and use fwrite() to write to the serial.

But I’ve ordered the WiFi-serial ESP12 adapter and the upgrade for the transformer to have the otgw accessable via tcp/ip as well.

OK< I think I’m all set, will need some time to develop some code, looking forward to it, but clearly, without your help it would heve taken me much, much longer!