Before I can get into the actual topic, I have to give some background.
TL;DR: I have some free electric power that I wanted to put to good use. You can skip to How to put the power to good use?
Background: Fuel cell produces more power than we need at times
We have a pretty fancy heating system that doesn’t just burn domestic gas to generate heat as most heating systems do, but instead it reforms the gas to hydrogen and uses it in a fuel cell to generate ~750 watts of electric power. The fuel cell’s “waste heat” is what’s used to warm the house and domestic hot water most of the time. On cold days, when the 1.1 kW thermal power are not enough, there is also still a traditional gas condensing boiler built in, which just burns as much gas as necessary. Another important component of the system is a 220 liters hot water tank which serves as a kind of energy storage over time. If you’re interested in this technology, here are some links:
- https://de.wikipedia.org/wiki/Brennstoffzellenheizung (German)
- https://en.wikipedia.org/wiki/Proton-exchange_membrane_fuel_cell (PEMFC details – this is the type of fuel cell that’s in my heating system)
- https://www.viessmann.co.uk/en/products/fuel-cell/vitovalor-pt2.html (that’s the specific model in my house)
Now 750 watts doesn’t sound like a lot, and often we need much more than that for short periods of time, e.g. while cooking or baking, when the washing machine is running, etc.. But then again, there are sometimes many hours where the whole house needs less than 300 watts:
The blue graph is power production, yellow is what we don’t use, red is what’s drawn from the grid. I’ve highlighted the area (green) where power was available from the fuel cell that we didn’t use.
The price we get for power exported to the grid (yellow graph) is very low – from an economic perspective it makes no sense to “waste” power by sending it to the grid. Which is weird, as everyone is talking about “Energiewende” (“turnaround in energy policy”), decentralizing power production and so on. But that’s how it is right now, not much I can do about it. Hopefully policies will improve soon and make it more attractive for anyone to send power to the grid, so that more coal-powered plants can be switched off.
How to put the power to good use?
So I was thinking about how I could put the electric power to good use, instead of “wasting it”. First I thought of a big battery, but these are rather expensive, heavy, degrade over time and will probably never pay off. A big battery in the form of a battery electric vehicle would make a lot of sense, but that’s also not an option right now. Then, one evening, sitting next to my beast of a computer and playing a 3D game, I noticed that the room was getting pretty warm, even though the floor heating was switched off for that room. That’s when it occurred to me: Why don’t I transform the surplus power to heat, and let the computer do something useful while generating it?
I remembered how – at the beginning of the COVID-19 pandemic – I had donated my old laptop’s meager CPU + GPU power to participate in the search for a vaccine by running the BOINC client. What is a BOINC client you ask? It stands for “Berkeley Open Infrastructure for Network Computing” client, and basically turns your computer into a part of a distributed super computer that scientists can use to solve computation-intensive problems. See this Wikipedia article for more info.
So I installed BOINC on my desktop machine, connected it to Science United and the machine started to hum. However when I checked the power meter, even though it was late evening and there were no big power consumers running, the house was drawing power from the grid. Turns out this beast – when all 12 cores and the GPU are crunching numbers as hard as they can – draws about 550 watts. Add on top the fridges and other infrastructure (home server, WiFi router/APs, switches, smart home stuff etc.) and ~750 watts from the fuel cell weren’t enough. So I had to come up with a plan to limit power usage of the computer somehow. I wanted to regulate the power consumption in a way so that BOINC would only run when it makes sense. I came up with the following criteria for running BOINC:
- Currently unused fuel cell power must be greater than what the computer needs when it runs BOINC without GPU (more about GPU later), i.e. >180 watts
- Outside temperature must be “cold” (I defined that as less than ~10 degrees Celsius for now) – for the simple reason that otherwise the small room would get uncomfortably warm and I would have to open a window, which I would consider a waste of energy.
I put these in code and tried it out. But something wasn’t right: BOINC would always run for two to four minutes, and then stop, only to start up again after two to four minutes. Thinking back how much power the machine was actually using at full CPU+GPU load, I realized I would have to regulate the power consumption in a more fine-grained way. As the GPU alone can use up to 350 watts, that’s where I saw the biggest leverage. I then (re)discovered the
nvidia-smi tool, which allows to set a limit on how much power the GPU can use. So I enhanced my program to first start BOINC on CPU only. If after the next cycle there was still sufficient fuel cell power, I would switch on the GPU with its lowest possible wattage (100 watts). Then, every cycle, if there was still more than >50 watts available, I would increase GPU power further. I designed these control cycles to be two minutes long. The data to base the decisions on comes from InfluxDB and is averaged (mean) over these two minutes, so that short bursts of power consumption are flattened. Whenever hitting 0 watts of available fuel cell power, the GPU would first be suspended, and in the next cycle also the CPU.
There are a few more elaborate details I added after a few days, but I can say it’s rather smooth now. The room is warm and I’m contributing valuable computing power to science – at zero cost 😄