Project BoilerLog: SD Datalogger with RTC

I needed to monitor my boilers activity as I thought something may not be quite right about its activity – gas usage is fairly high and our thermostat is fairly low – only 18 degrees C.

Our thermostat is programmed to become active twice a day, in the morning, and then in the late afternoon to evening. During this time the thermostat switches a wire to live (230v) to signal heat requested to the boiler, which is an older and not very efficient model.

I decided to build a quick and dirty datalogger based on an Arduino Nano and an SD card interface. There are various examples on the official Arduino portal about creating an SD card datalogger in this configuration. I realised however for my data to mean anything I’d need to have reliable timekeeping, which means I need to integrate a Real Time Clock (RTC) into the design.

schematic

I bought an SD card interface off ebay for £2 shipped which operates over SPI. I also bought an RTC for £4 shipped. It uses the popular DS1307 chip and is marketed as “Tiny RTC”. It operates over I2C and has a rechargable LIR2032 battery with charge circuit. There have been issues with this board, mainly due to people fitting the board with CR2032 batteries which is not a good thing to do. Ensure you use a LIR2032!

Using already existing SD and RTC libraries, the code was easy to get running quickly. I simply analogRead 4 inputs and log the raw values. An interesting point is that, every second, I open a file on the SD card, append to it, and close it. This is not efficient and probably not good for the SD card either, but for me I wanted to be able to power off and grab the data off the SD card quickly and reliably so opening/closing and not buffering is the best bet in my view. My schematics and firmware are available on github.

As for sensors, I had 3 10K thermistors and a 10K LDR. The LDR is placed over the burner on LED of the boiler, one thermistor for ambient, and the other two reading the flow and return pipes to the radiators via some good quality thermal paste for heat conductivity.

Assembled device made up of RTC, Arduino, SD Card interface and sensor interface.The device fully assembled with help of a small breadboard for the Arduino. Power is via the USB cable, which is connected to a high-quality USB power adapter.

The little board to the far right is simply a sensor breakout board with 4 10K resistors and +5V, GND, sense and then the sensor connectors. 3 of the sensor connectors are disconnected in the image. The sense values of the thermistors were quite disappointing resolution wise when I reviewed the logs, but they did the job.

The datalogger ran for several days unattended and I was happy to find a log file for each day saved to the SD card for me to analyze. I created a small c# application that gave me instant stats on the days boiler running, and also output a smaller selection of datapoints as to plot an easy to view chart of activity.

An average day resulted in the following:

dataAnd the output from my small c# program:

Burn: 06:41:38->07:28:41, Duration: 00:47:03
Burn: 07:32:54->07:38:52, Duration: 00:05:58
Burn: 07:43:15->07:48:27, Duration: 00:05:12
Burn: 07:52:47->07:57:23, Duration: 00:04:36
Burn: 08:01:27->08:05:17, Duration: 00:03:50
Burn: 08:09:15->08:12:31, Duration: 00:03:16
Burn: 08:16:03->08:18:57, Duration: 00:02:54
Burn: 08:22:30->08:25:15, Duration: 00:02:45
Burn: 08:28:53->08:31:31, Duration: 00:02:38
Burn: 08:35:11->08:37:43, Duration: 00:02:32
Burn: 08:41:23->08:43:52, Duration: 00:02:29
Burn: 15:31:23->15:53:45, Duration: 00:22:22
Burn: 15:58:05->16:03:44, Duration: 00:05:39
Burn: 16:08:15->16:13:22, Duration: 00:05:07
Burn: 16:17:55->16:22:32, Duration: 00:04:37
Burn: 16:27:01->16:31:23, Duration: 00:04:22
Burn: 16:35:41->16:39:25, Duration: 00:03:44
Burn: 16:43:34->16:46:46, Duration: 00:03:12
Burn: 16:50:51->16:53:47, Duration: 00:02:56
Burn: 18:11:29->18:15:25, Duration: 00:03:56
Burn: 18:20:41->18:22:55, Duration: 00:02:14
Burn: 18:31:10->18:33:12, Duration: 00:02:02
Burn: 18:48:38->18:50:36, Duration: 00:01:58
Burn: 19:51:10->20:09:02, Duration: 00:17:52
Burn: 20:13:25->20:18:05, Duration: 00:04:40
Burn: 20:22:37->20:23:30, Duration: 00:00:53
Time boiler burning: 02:48:47
Num of boiler fireups:26
Shortest time on: 00:00:53 at 20:22:37

So instantly I see a problem, which is oscillation of the boiler firing up for a short period and then turning off, only to turn on a short time later. It turns out our ‘fancy’ hall thermostat, despite looking the business is fairly poor in terms of features. It’s switching differential is so small it’s acting like it simply adheres to the following:

if TEMP > SET_TEMP then boiler_off() else boiler_on()

There does seem to be around 0.5C of differential but it’s not enough. If I could adjust this on the thermostat it would make things much better.

So I’m looking at a new thermostat and think Ive got a winner for that, which I may post up about next month.

While I was at it, I wanted to test the idea that keeping your boiler switched on 24/7 actually is more economic. So I tried it. This is on a day fairly similar in terms of outside temperature as the last graph.

boiler data for 24/7 runThe output from the analyzer:

Burn: 01:56:53->02:15:20, Duration: 00:18:27
Burn: 02:19:44->02:20:57, Duration: 00:01:13
Burn: 04:28:06->04:46:18, Duration: 00:18:12
Burn: 06:41:03->07:19:44, Duration: 00:38:41
Burn: 09:20:03->09:38:32, Duration: 00:18:29
Burn: 12:19:15->12:39:08, Duration: 00:19:53
Burn: 14:32:28->14:50:43, Duration: 00:18:15
Burn: 16:28:57->16:48:10, Duration: 00:19:13
Burn: 16:52:34->16:55:47, Duration: 00:03:13
Burn: 18:10:55->18:14:17, Duration: 00:03:22
Burn: 18:23:24->18:25:27, Duration: 00:02:03
Burn: 18:28:16->18:46:09, Duration: 00:17:53
Burn: 18:50:26->18:55:25, Duration: 00:04:59
Burn: 18:59:56->19:04:08, Duration: 00:04:12
Burn: 21:58:52->22:18:50, Duration: 00:19:58
Burn: 22:23:19->22:23:26, Duration: 00:00:07
Time boiler burning: 03:28:10
Num of boiler fireups:16

I think it’s quite clear cut that for my boiler it is not more economic, the boiler running for an additional 40 minutes during the whole day. Interesting though there are much less oscillation events, and therefore less boiler fireups.

Hope this post is of use to someone. The full schematic and firmware for the datalogger is available over at github. Let me know if you use any of it!

Update: Something is going funky between 10 and 11am each day, which you can see on the graphs as a spike in flow temp and a drastic drop in return. I don’t have a clue what it is. The boiler isn’t on, could be something to do with my unvented hot water cylinder.