Skip to main content

Troubleshooting our Buderus Logamatic 4000 based heating system, part III (KNX thermostats)

As described in the previous incarnations of this series (part I: introduction, part II: heating manifolds), the heating in our new house wasn't working very well, and I was working on finding out the root cause, as someone without too much proficiency in mechanical engineering, but with a software engineer background.

This installment is about our smart thermostats connected to a KNX (aka EIB) based backbone, that control the valves (turn on/off) on our heating manifolds for per-room temperature control.

I described in the previous post, I was suspicious of the thermostats, as some of our rooms were set to the same temperature, and one was warm while the other was cold.

These thermostats have a couple of parameters that can be adjusted that would significantly change their behavior. The most important ones from my perspective are
  1. the temperature adjustment: to offset to be added/substracted to the measured temperature to counter potential sensor errors
  2. the base setpoint: to set the mid-value on the thermostat, that can be increased/decreased locally with +/- 3 degrees.
First, I needed to establish access to the KNX bus.

KNX access

KNX is a ~30 years old standard for building automation, spearheaded by the likes of Siemens and actually standardised as ISO 14543.

KNX uses a twisted pair cable, organized in a bus topology, to which all smart devices are connected to. Typical KNX devices are bus powered, e.g. they only need the bus cable to operate.

The bus offers an 9600 bit per seconds connection (e.g. 1200 bytes per sec),  and can support roughly 50 datagrams per second. This is not very fast, but the delivery of these messages is very reliable over long distances. And usually everything you need is a couple of bytes per message.

The bus itself is organized into lines, which are grouped into areas which are grouped into domains, supporting a total of 57600 devices (256 * 15 * 15 per line, area and domain respectively), which can be extended further by using ethernet gateways (and filtering of datagrams so we stay below the bus limits).

Each device connected to the bus is "smart", in the sense they usually have some kind of program they execute, which involves communication with other devices on the bus. For instance, the thermostats are such smart devices, which perform temperature measurements and send valve open/shut signals to the  valve motors. A light switch would similarly send a datagram when it is pressed. Producers and consumers of these messages are addressed using logical addresses (e.g. group addresses in KNX speak). In KNX, there's no central role, like an automation server. If something fails, only the respective functions of the house will be affected.

There are multiple connection options if you wanted to connect a computer to KNX. There are
  1. serial (RS232), 
  2. USB and 
  3. ethernet based gateways.
The house initially had the first two installed, but I wanted to be less constrained on where I have access to the bus, so I acquired a Weinzierl 731 KNXnet/IP tunneling gateway that I connected to my ethernet switch. This gateway fills a similar role to an ethernet switch: any KNX datagram is sent to the ethernet side as a multicast packet. Any ethernet packets sent to the proper multicast address are delivered to the twisted pair KNX bus (of course bearing mind in the difference in bus speed, the excess will probably be dropped).

I have to tell, that I was initially sceptical about KNX (the house was built ~20 years ago, so it seemed a bit old-school), but eventually I started to like it. The implementation of functions is pretty straightforward, ETS (the tool to configure it is Windows based, but works), and most importantly: Homeassistant worked out-of-the-box: the gateway was automatically discovered and after configuring a KNX based actor, I could flip it on and off easily from the Homeassistant interface.

Thermostats

I mentioned that the thermostats I had have a view parameters that affect how they operate, here's a screenshot to demonstrate, but there are a lot more, believe me (sorry, for this being German):


The boring part was to make sure the important settings are set to the same value: I made sure the base setpoint was set to 21 degrees everywhere. I also used a temperature sensor from Xiaomi to calibrate each of the thermostats and set their temperature adjustment properly. Some of the rooms had as much as 1.5C deviation in measurement, which can be a lot if you are around the comfort zone (20.5C feels cold, while 22C is comfy). Another potential issue solved. Unfortunately this was not the root cause.

I also set up Homeassistant to monitor the thermostats and display a card like below for each of the thermostats. The turquoise line is the "set" temperature, the red line is the measured one. The green/red bar on top shows when the valve to the specific room was open or shut.



You can immediately notice that our heating system is not "fast", it takes hours for heat to increase or decrease, which is because the relatively low water temperature used in under-floor-heating.

But what was more interesting is that the opening of the valves follows a rhythm: they are opened even though the temperature is above setpoint and closed shut even if the temperature is below setpoint. Why? It's as if someone applied PWM (aka pulse width modulation) to heating. PWM is used for "dimming" a led, turn on-off a led 50 times a second, with half the time on and half the time off, and you'll perceive a continuous light but with half the power. Increase "on" time vs  "off" time within the same timespan, and you have precise control on the amount of light emitted.

This is exactly what my thermostats are doing with the valves, although at a much lower pace. Let me explain this a bit more in the upcoming episode, together with PI and PID regulation and how to tune the related parameters.


Comments

Popular posts from this blog

syslog-ng fun with performance

I like christmas for a number of reasons: in addition to the traditional "meet and have fun with your family", eat lots of delicious food and so on, I like it because this is the season of the year when I have some time to do whatever I feel like. This year I felt like doing some syslog-ng performance analysis. After reading Ulrich Deppert's series about stuff "What every programmer should know about memory" on LWN, I thought I'm more than prepared to improve syslog-ng performance. Before going any further, I'd recommend this reading to any programmer, it's a bit long but every second reading it is worth it. As you need to measure performance in order to improve it, I wrote a tool called "loggen". This program generates messages messages at a user-specifyable rate. Apart from the git repository you can get this tool from the latest syslog-ng snapshots. Loggen supports TCP, UDP and UNIX domain sockets, so really almost everything can be me...

syslog-ng roadmap 2.1 & 2.2

We had a meeting on the syslog-ng roadmap today where we decided some important things, and I thought I'd use this channel to tell you about it. The Open Source Edition will see a 2.1 release incorporating all core changes currently in the Premium Edition and additionally the SQL destination driver. We are going to start development on the 2.2 PE features, but some of those will also be incorporated in the open source version: support for the latest work of IETF syslog protocols unique sequence numbering for messages support for parsing message contents Previously syslog-ng followed the odd/even version numbering to denote development/stable releases. I'm going to abandon this numbering now: the next syslog-ng OSE release is going to have a 2.1 version number and will basically come out with tested code changes only. The current feature set in PE were developed in a closed manner and I don't want to repeat this mistake. The features that were decided to be part of the Open ...

An introduction to db-parser()

As promised on the mailing list here comes a short description of the new db-parser functionality of syslog-ng. For an introduction to parsers in general see my previous blog post here . The aim for db-parser is two-fold: extract interesting information from a log message attach tags to a log message for later classification. For instance here's a log sample (lines broken for readability): Feb 24 11:55:22 bzorp sshd[4376]: Accepted password for bazsi \ from 10.50.0.247 port 42156 ssh2 This message states that a user named "bazsi" has logged into the host named "bzorp" using SSH2 from the quoted IP and port. When you read this message as a human, the event that happened is perfectly clear. However if it is not a human, but a piece of software that has to make out the meaning of the message, you need to identify the event (e.g. that a user login has happened) and the additional information associated with the event (e.g. that he used 10.50.0.247 as the cl...