Same Opentherm Gateway, different approach

Yep, I’m going to build a 3rd Opentherm Gateway 😉
The first one was built on perfboard and became a mess; I never finished it, because before I could the Opentherm Gateway PCB became available, which looked much better. The first PCB version was built somewhere in February 2012 and is in use since August after I replaced the Proliphix NT20e with a Honeywell modulating thermostat.

There’s only one thing I don’t really like that much about the Opentherm Gateway and that’s the serial interface. I like to have all my hardware network-attached, but I’d also like to keep the number of Serial to Ethernet servers to a minimum – right now, I have 6 Serial ports in the meter cabinet (PLCBUS, X10, GSM modem, etcetera) connected to a Serial to Ethernet server. In total, I think I have around 10 serial devices connected that way.

For the third Opentherm Gateway I’m going to try something else; I’m going to leave the MAX232 IC off the PCB and directly connect a Simplecortex to the TTL level output of the PIC that’s on the OT Gateway PCB. This approach has some benefits, like

  • The Opentherm Gateway becomes Ethernet enabled;
  • Programmable TTL to Ethernet conversion;
  • Less €€€;
  • Big reduction on network traffic;
  • more fun!

Yesterday I started with the Simplecortex firmware for the OT Gateway. I want the firmware to be versatile, meaning that it should not only support the Data ID’s that I see going back and forth between my thermostat and boiler. Fortunately the Opentherm Protocol is documented well enough to be able to write code for Data ID’s I’ve never seen in my life. In fact, the definition of how the firmware should deal with all the Data ID’s found in the OT protocol 2.2, comes down to the following:

typedef enum {Read, Write, Both} CommandType;
typedef enum {both, highbyte, lowbyte} ByteType;
typedef enum {flag8, u8, s8, f8_8, u16, s16, dowtod} PayloadType;

typedef struct{
	uint8_t ID;
	CommandType rw;
	ByteType whichbyte;
	PayloadType format;
	uint8_t bitpos;
	char* topic;

} OTInformation;

OTInformation OTInfos[] = {
{0x00,	Read, 	highbyte, flag8, 0, "ch_enable"},
{0x00,	Read, 	highbyte, flag8, 1, "dhw_enable"},
{0x00,	Read, 	highbyte, flag8, 2, "cooling_enable"},
{0x00,	Read, 	highbyte, flag8, 3, "otc_active"},
{0x00, 	Read, 	highbyte, flag8, 4, "ch2_enable"},
...
...
{0x7f, 	Read, 	highbyte, u8,    0,  "slaveproducttype"},
{0x7f, 	Read, 	lowbyte,  u8,    0,  "slaveproductversion"}
};

That’s all there is to it… add about 150 lines of code and the complete set of Data ID’s defined in the OT Protocol 2.2 documentation is supported – no more switch (DataID) with a long list of cases and repeating code…

But I wanted more – I really don’t need to be told that CH is still enabled twice a second; just a report of a change will do. For that I’m going to add a filter that will only report changes. That filter will reduce the network traffic immensely. And of course this Opentherm Gateway will be transformed into a MQTT Publisher, just like my smart meter. And last but not least, this implies that the Opentherm Gateway will act as a MQTT subscriber too, so that I can control the behavior of the OT Gateway and override the thermostat’s temperature setpoint.

Right now, I’m watching the OT Gateway information  on my screen as it is being published:

Opentherm Gateway publishing information

There’s still a lot to do, but considering the fact that I managed to get this far in only a few hours makes me confident that I can finish this project before it starts to get really cold.

Another good thing is that once this project is finished I can shut down the Remeha Calenta driver which has been running for 2 years.

The biggest disadvantage of that driver was that I had to constantly poll the Calenta and that it was based on a protocol specifically targeted at Remeha boilers.

So it all gets much, much better this way!

 

Tagged , , , . Bookmark the permalink.

11 Responses to Same Opentherm Gateway, different approach

  1. jwestra says:

    Very nice!

  2. blb says:

    Afraid to have a too short todo list ;-)?

    • Hmm, now that you mention it, maybe I am…
      Walking into the living room, saying “honey, I’m finished!“, and having plenty of time to watch TV shows like GTST, DWDD … gives me the shivers!! 😉

  3. Anton says:

    Very interesting! I’m currently looking for a solution to control my CH and also prefer Ethernet. I’d like to keep it affordable and am kind of surprised about the lack of solutions (or my google skills are terrible).

    So I understand that you will combine the Simplecortex with a modfied version of the opentherm gateway. Are you planning on publishing the schematics and software? This seems like a really interesting solution that is hard to find out there. Nice work!

    • The schematics for the Opentherm Gateway can be found here, I just soldered it together…
      The Simplecortex part is my own idea; and once the software is finished I’ll publish it.

      • Anton says:

        Thanks. I found the schematics before and would be able to solder it together. However, my knowledge of electronics is too little to understand how to omit or bypass the max232 chip.

        • It’s not that hard actually. First thing you need to realize is that the MCU (the PIC 16F88P) is responsible for supplying the TTL. There are 2 wires going from the PIC to the MAX232, so that means you’ll only need pin 11 and 12 of the MAX232. Earlier this evening I saw a picture that can help you; it’s the 2 wires on the right side 😉

  4. Pingback: Putting it all together - Digits Domotica Blog

  5. Gertjan says:

    Very interesting! I’m currently looking for a solution to control my CH and also prefer Ethernet. I am thinking about replacing the PIC with the PIC18F66J60.
    Why did you choose the simplecortex for connecting the gateway to ethernet?

    • Robert Hekkers says:

      I used a Simplecortex because I wanted to reduce network traffic.
      There was no particular reason to use a Simplecortex, I could have used an Arduino or Raspberry Pi just as well. (it’s a Raspberry now ;-))

Leave a Reply

Your email address will not be published. Required fields are marked *