Did a similar project with a DS18B20 sensor (with the Dallas Temperature Control Library), monitoring the temperature of central heating and hot tap water with succes. Attached the temperature sensors to the pipes with insulation foam!, which was used to prevent heat loss at places where no heating is needed. Especially near the boiler where the watertemperature is highest the heat loss can be substantial.
Measuring at the outside of the pipe does not differ much from the inside with insulation. The max delta I noted with the internal temp sensor of the boiler was 0.5C (within accuracy). For the heater we measured outgoing and incoming temperature of the water, and although we did not measure flow directly - used the spec of the pump - we got a good insight of the heat produced.
The formula:
Energy = volume * tempdifference * specific heat water
Specific heat water = 4186 J/(Kg.C) --
Note: liters/Kg differs by temperature. assumed 1 hereJoule = 1W/sec so for KWH we need /3600 and /1000
E = Volume * (Tout - Tin) * 4186 / 3600 / 1000; // E in KWH
Some notes:
- you have to sample temperature every second as heating up can go quite fast, a lower frequency may introduce substantial errors (my experience) .
- specific heat is temp dependant, I used a constant here
- if the pump is not running there is no energy sent into the system. => E = 0;
- the values must be summed to get the total energy produced. => advice: log individual samples on a SDcard or webserver
- volume must either be measured or expressed in L/sec
So, the core code will look something like:
if (pumpRunning() == true)
{
E = Volume * (Tout - Tin) * 4186 / 3600 / 1000;
Etotal += E;
}
]/code]
[i]As it was a commercial project I don't share actual code[/i]
Hopes this helpes you to get started
Rob