Electronics

PLEN

eBUS boiler controller, part 1: from listening in to ACK

The factory boiler controller kept losing its connection and would not let me change the hot water temperature. Between 28 October and 1 November I built my own interface to the eBUS, and the boiler answered “ACK” to a transmitter written from scratch.

Złącze szyny eBUS złożone na płytce stykowej: transoptory, rezystory i przewody zasilania na niebieskiej macie warsztatowej

Złącze eBUS na płytce stykowej, zaprojektowane ze specyfikacji i kart katalogowych.

My gas boiler, a Vaillant ecoTEC plus, came with the factory vSMART controller and a phone app. The controller kept losing its connection. Every change took between 25 and 50 seconds to travel through the manufacturer’s cloud. And when I tried to change the domestic hot water temperature, the cloud answered with a 403 error, which means “refused”. So I decided to build my own controller: a board with an ESP32-S3 hooked up to the two wires of the eBUS, the bus the boiler uses to talk to its controller.

This is the first of three parts about the controller itself. The wall panel and the room sensor, which were built alongside it, have posts of their own. The division of labour was the same as in my other projects: I solder, measure and decide, an AI agent does the design and writes the code.

42 hours of listening in

Before building anything of my own, I spent about 42 hours listening to the bus with an off-the-shelf adapter and the ebusd program. It turned out that the vSMART says very little to the boiler. Every 10 seconds it sends a single command: heat with water at this temperature, or do not heat. On top of that come status reads and an occasional frame with the hot water temperature. In those 42 hours there were 15,152 identical “heating blocked” commands.

Along the way it turned out that the “hot water boost” button in the app did not put a single new frame on the bus in 7 minutes. In my installation it changed nothing.

Rules first, soldering iron second

One day the controller is meant to be a product that can be shared. Meanwhile ebusd, the most popular eBUS tool, is licensed under GPL-3. So on day one, 28 October, we wrote down a clean-room rule: ebusd may be used as a black box for listening in and for comparisons, but its code, its frame definition files and the schematics of other people’s adapters must not be read or copied. We work out the meaning of the bytes from our own captures of the bus and describe it in our own words, with evidence.

The agent designed the interface between the bus and the ESP32 purely from the 2007 eBUS specification and from datasheets. The specification says the bus idles at 15–24 V, a logical zero is 9–12 V, the speed is 2400 baud and one bit lasts 416.7 µs. I ordered the parts from TME, with enough spare for two boards.

One design decision paid off many times over. The transmit optocoupler sits in a socket. Pull it out and the circuit is physically unable to transmit; it can only listen. With a live boiler, that is the simplest safety switch there is.

17.2 V at the terminals

I built the breadboard following the schematic and checked it with a multimeter. At the boiler’s eBUS terminals I measured 17.2 V. The receive threshold is set by an 11 V Zener diode, and a measurement on the bench power supply showed it switching at 13.5 V. That is exactly the middle of the 12–15 V range the specification leaves between a zero and a one. The design based on the specification and the datasheet worked without any tuning.

The checksum, settled by evidence

With the transmit optocoupler pulled out, the module started receiving the bus. The frames matched what ebusd saw, byte for byte. The trouble was the checksum. The specification describes it with a table that can be used in two ways, and only one of them agrees with the boiler. Without peeking into the ebusd code, the question was settled by three frames that differed only in the last byte: 00, 01 and 02. The received checksum changed by exactly that byte (88, 89, 8a), and that fits only one of the variants.

The second trap: the checksum covers the bytes as they travel down the wire, that is, before the special characters are decoded. Calculated from the decoded data, it came out wrong for the rare frames that happened to contain such a character. After the fix, 47 checksums out of 47 matched within 60 seconds. In a five-minute sample 212 frames were good and 2 were bad, both from the vSMART. To this day we have not found the cause of those two.

The third byte is the water temperature

To control the boiler, you need to know what the fields of the command sent every 10 seconds mean. I raised the room setpoint by 1 °C in the phone app and the third byte changed from 0x5e to 0x60, that is, from 47 to 48 °C water. That single byte is what the controller will later use to drive the boiler.

In the first test the command went back to the old value by itself after 11 seconds, which looked like a mistake in the interpretation. The culprit was my own Home Assistant automation, which was controlling the heating in parallel. Once I switched it off for the duration of the test, the change held for over a minute and worked in both directions.

An ACK from the boiler

On 1 November at 18:31 a separate test program put our first own frame on the bus: a read of a single register, as a new participant with the address 7f. The boiler acknowledged it (ACK) and replied with the number of hours the fan has run: 15,664. ebusd, on the old adapter, saw the same frame and the same value. A transmitter written from the specification, which had never seen anyone else’s code, was accepted by the boiler.

The first attempt failed. Reassigning the transmit pin at runtime silently disconnected the receive input, so the module was transmitting blind and could not hear its own echo from the boiler. After the fix, a series of 20 reads of 20 different registers went through in full.

Winning arbitration, which was an illusion

On the eBUS several devices may want to transmit at the same time. This is resolved by arbitration: whoever wants to speak starts in a defined window after the synchronisation character (SYN), about 4.3 ms after it. To measure our own timing we built two instruments: scripts that pull waveforms from my oscilloscope, and a small XIAO ESP32-S3 as a sniffer that timestamps every edge.

The first measurement showed that the module was not starting in the arbitration window at all, but 15–24 ms after the SYN character. The 20-out-of-20 series had succeeded only because nobody else happened to be transmitting. The cause sat in a single line of code: the read function waited for 128 bytes or 20 ms, so every byte from the bus reached the program late.

StageStart after the SYN character
before the fix15–24 ms
after removing the 20 ms wait4386.9 µs
after compensating for the fixed delay4299.5 µs (target: 4300)
factory vSMART, for comparison4325.3 µs

Three measurements took a quarter of an hour. The same bug was in three programs and was visible in none of them, because on the bus everything “worked”. In two simultaneous starts with the vSMART the module backed off correctly, so bit-by-bit arbitration is confirmed as well.

The controller at the boiler

That same day at 23:10 the test program on the module at the boiler made way for the real controller, for now in “monitoring only” mode, with command transmission switched off. The browser app had been built the day before and from the start it used the same API as everything else. Every request that could have sent something to the boiler got the reply “control disabled”.

I compared the boiler state from the controller with ebusd: flow 43.6 against 43.56 °C, return 43.2 against 43.25 °C, pressure 1.28 against 1.284 bar. The controller was reading the boiler just as accurately as the ebusd tool. It could not control it yet.

In part 2 I check what the boiler does when nobody tells it anything, and hand the controller its first night.

Related posts

Comments

No comments yet

Leave a comment

Your email address will not be published. Comments appear after approval.