My original intent was that it would have the following features:
- Measure the collector differential temperature.
- Infer the water flow rate from pump speed.
- Calculate the instantaneous power being collected.
- Calculate hourly and daily average powers.
- Log this information to an SD card.
- To achieve (5) easily, derive the time from an external Real-Time-Clock (RTC).
Now, features 1-3 are working, phew. Feature 5 is implemented, but I need to think about what I really want (is daily average power useful? Or should I just integrate total heat collected in a day?
Features 5 and 6 are proving troublesome, as I think I am starting to get to the limit of a single Arduino board (or more precisely the ATMega 328 controller on the board).
The main problem is that I am running out of RAM, and am going to have to give some serious thought to how to manage it better (just like old times programming a Zilog Z80A.....).
One problem is the number of different interfaces (and hence libraries) that I am having to use to achieve this. The base software uses:
- OneWire.h and DallasTemperature.h to do the temperature monitoring, using a One-Wire bus.
- LiquidCrystal.h to drive the LCD display, using parallel data transfer
To add SD card support and a real time clock, I will need:
- Wire.h and DS1307RTC.h to access the real time clock from an I2C interface.
- SD.h to access the SD card from a SPI interface.
Each library uses a bit of ram , and there is only 2k of ram on the chip, so I am running out of it rapidly. When I tried to add the RTC code, the board re-booted every few seconds, which I think was an out of memory issue.
So, the de-scoped system is not going to do SD card logging. As compensation I have added switches to the two spare digital lines to use to provide a simple user interface so you can scroll between instantaneous, hourly and daily data, and maybe even set the clock (but I do worry about running out of RAM again if I get too adventurous!
Given this, I have put the 'Version 1' hardware together, and mounted it in a cheap 2 gang socket pattress box with a blank cover cut out to hold the board:
The toggle switch on the front is for the display back-light - I thought that would be easier than a push-button if you were trying to use buttons for the interface - the new buttons are facing the bottom of the picture on the side of the front panel, so you can't see them on this photo (and I made a mess of cutting the holes for them, so it looks a bit ugly...).
Right, just got to sort out the software now. Current version is on github.