Create project Need help?
Show more (2)
JN
  • Labs project

Heating System Monitor (090328)

Status: Finished
9066
10
votes
April 16, 2012
PUBLISHED
in Elektor magazine | December 2010 | Find it here

Usually you can tell how much energy your heating system has consumed by checking your utilities bill, but what if you want to know how much heat it actually delivered? This clever design from one of our readers measures the actual heat output and doesn’t require any modifications to your central heating system. It also has a built-in control function for the circulation pump, which helps you reduce your environmental impact and keep your bank balance healthy.

 
 
 

By Falko Bilz

Heating bills often present unpleasant surprises. Despite your best efforts to economise on heating, they list tidy sums for electricity or gas consumption. In this article we describe a relatively easy way to check these values and monitor your consumption almost continuously. All you need in order to determine how much heat your system delivers is four temperature sensors, a bit of wiring, and a microcontroller. There’s no need to delve into the electrical or hydraulic components of your system or modify any of them.

A bit of theory
As many readers probably remember from their physics lessons, it’s easy to calculate the amount of heat transferred to a medium such as water. It is given by the product of the temperature change ΔT, the volume V of the medium, and the specific heat capacity CV of the medium. The power P, which is amount of energy transferred per unit time, is:

P= ΔT × CV × V // Δt

With a fluid medium, the term V // Δt can be interpreted as a volumetric flow Vt. This value can be calculated directly from the flow velocity v of the medium and the inner diameter r of the pipe. In a central heating system, the temperature difference ΔT is simply the difference between the supply (S) and return (R) temperatures. This yields the formula:

P = (TS – TR) × CV × v × pr2

The temperatures can easily be measured with suitable sensors. Flow transducers are available for measuring the flow velocity, but installing a flow transducer always requires drilling a hole in a pipe or opening up the piping to insert a fitting.

Measuring principle
Here we used a different method to determine the flow velocity. We make use of the fact that the supply and return temperatures always vary by at least one to two degrees due to the operation of the control system. If pairs of temperature sensors separated by a few metres are mounted on the supply and return lines, the flow velocity can be determined from the time offset of the variations measured by the two sensors.

Figure 1 illustrates the measuring principle, using a temperature increase as an example.As the water flows through the pipe with a speed of only a few metres per second, the temperature at sensor position S2 rises somewhat later than the temperature at sensor position S, which is closer to the boiler.

An ATmega microcontroller constantly acquires temperature data from the two sensors. The time delay between the signals from a pair of sensors is determined by a correlation algorithm in the signal processing software, which shifts the signal waveforms from the two supply line sensors relative to each other until they virtually overlap.The temperature signals from the sensors on the return line are correlated in the same manner, and ideally the time offsets obtained for the supply and return lines should be the same.

To increase the sensitivity of the system, the return line sensor signals are applied to the inputs of a differential amplifier, and the resulting difference signal is amplified. This difference signal is also logged as a function of time. The area under the curve of the difference signal is a measure of the time offset of the temperature variations.

Various means can be used to attach the temperature sensors to the heating pipes (see the ‘Sensors’ inset), including cable ties (see Figure 2). The accuracy of the measurements can be improved by applying some thermal paste between the sensor and the heating pipe. When you relocate, the system can be removed without leaving any traces behind.

Hot water please
If the heating system is also used to supply hot water for domestic use, additional pipes are used for this purpose. For this reason, the PCB designed by the author includes inputs for additional temperature sensors. It also has a switched output for driving a relay that can control a circulation pump.

Under certain conditions, controlling the circulation pump can save you a lot of money and significantly reduce CO2 emissions. This is because some systems have constant hot water circulation so users can draw hot water from the tap immediately. This costs electricity to power the pump, and energy is also lost through the pipe walls. This can be remedied by the author’s circuit, which switches on the circulation pump for only a short time after the hot water tap is opened. This is detected by the temperature difference between the hot water and cold water supply lines.

Figure 3 shows where the six temperature sensors should be fitted.It is important to ensure that there are no active branches between sensors S and S2 on the supply line or between sensors R and R2 on the return line. By contrast, three-way valves between the two sensor locations are not a problem as long as they are closed while measurements are being made.

Circuit description
The easiest way to understand the schematic diagram (Figure 4) is to follow the signal path. It starts at the temperature sensors connected to the circuit board, which are NTC silicon devices. Their resistance varies by around 0.7–0.8% per degree K change in temperature. For example, the resistance of a KT110 sensor is approximately 1.7 kΩ at 5 °C and approximately 2.8 kΩ at 70 °C.

The sensor for supply temperature S forms a voltage divider with resistor R37. This is followed by a simple low-pass filter formed by R36 and C20, which filters out induced AC hum. U4a amplifies the sensor signal by a factor of approximately 8. The TL2264 used here is a rail-to-rail opamp, so the output voltage can assume almost any value within the supply voltage range. This increases the absolute measurement accuracy, since the full output signal amplitude is used. U4a naturally needs a reference voltage on its inverting input. This is provided by the combination of R20, R26 and R27. U5b acts as an impedance converter to minimise the load on the voltage divider.

The input stages for the other temperature sensors have a similar structure. The component values have been chosen to yield a measuring range of approximately 8 to 70 °C for five of the sensors. The reference voltage for the sixth sensor, which is attached to the cold domestic water line (cold-cold, CC), is somewhat lower and is buffered by U5a. The measuring range of this temperature sensor is approximately 2 to 70 °C.

The analogue signals are fed to the A/D converter of the ATmega328. The converter’s reference input is connected internally to AVCC, which means that all analogue signals are reference directly to the supply voltage. Consequently, the supply voltage does not require elaborate stabilisation. If you want to know more about factors that may affect the measurement accuracy, you will find a worksheet in the download file for this project.

The R and R2 sensor signals are also applied to the inputs of a differential amplifier built around U7a, and the resulting difference signal is amplified by a factor of 10. This allows temperature differences as small as approximately 10 mK to be measured.

Opamp U7d is wired as a comparator and triggers an interrupt in the ATmega microcontroller via pin PB1 when the supply line temperature rises. Here C28 and R61 form a high-pass filter that more or less allows only changes in the signal level to pass. R47 is necessary to stabilise U4a with a capacitive load. Schottky diode D9 prevents unallowable negative input levels on U7d when the circuit is not connected to a power source.

U6a and U6b are also wired as comparators for signals from the temperature sensors for hot and cold domestic water. The maximum output level of the inexpensive LM358 opamps is always approximately 1.5 V below the supply voltage. These two opamps can pull port pin PD7 or PB0 (respectively) to approximately 0.8 V (corresponding to a logic low level) via D13 or D14. Internal pull-up resistors in the microcontroller generate the high level.

The advantage of this approach is that the microcontroller does need to constantly sample the signal levels, but instead only has to examine them when something ‘interesting’ happens. This means that the ATmega can spend most of its time in power-down mode. This is also beneficial in terms of EMC because the clock is stopped in this mode.

The bistable relay K1 is driven by T1 and T2. It is rated for only relatively low voltages and currents. If you want to switch a circulation pump, you will need a suitable power relay or contactor, which in turn is driven by K1. In case of circuits connected to the AC powerline, the usual safety regulations must be observed. Never allow this circuit to come in direct contact with the AC power voltage.

PC connection
The circuit does not have its own display unit, but instead delivers its readings to a PC via an RS485 bus. Its functions can also be controlled from the PC. IC U8 looks after signal level conversion between the TTL transmit and receive lines of the ATmega microcontroller’s integrated UART and the differential RS485 bus. As the bus protocol allows several connected (peer) devices to transmit data on the bus, transmit mode must be selected actively via pin 3. Jumper JP3 must be fitted if the circuit is connected to the end of the RS485 bus. This causes the bus to be terminated in 120 Ω, which matches the characteristic impedance of a twisted-pair line.

The advantages of the RS485 bus system are its robustness and immunity to interference. A twisted-pair cable (preferably shielded) is all that is needed to transmit data over distances up to 1,000 metres at a rate of 1 kbaud. An RS485 to USB converter can be used to connect the bus to the PC.

The ATmega can be programmed via JP4, and if you have an ICE Mk 2, AVR Dragon or similar device available, you can also debug it via this port. JP4 has yet another function: one or more type DS18B20 digital temperature sensors can be connected to this port. These factory-calibrated sensors (absolute error ±0.5 °C) are ideal for aligning the circuit and calibrating the silicon sensors. However, these digital temperature sensors have a response time of approximately 700 ms, which is too slow for measuring the flow velocity.

Construction and initial use
Figure 6 shows the component layout (the PCB layout drawings can be downloaded below).Fit and solder the components according to the usual rule of ‘lowest profile first’. Soldering the microcontroller, which comes in a TQFP package, should also be possible with the aid of surgical/dental loupes. Use a soldering iron with a fine tip (approximately 1 mm) and — especially important — ESD protection. After all, you’re working with sensitive electronic components.

Always use headers with gold-plated contacts for the sensor connections, as otherwise the circuit will do a good job of measuring any significant mechanical vibration. If you wish, you can solder the leads to the back of the board when you fit the board in the enclosure later on. If you fit the board in the enclosure so the LED and the trimpots are visible or accessible through openings in the front, there will be enough room at the rear for the sensor cables.

The best technique for soldering the leads of the sensor cables is to clamp the cable somewhere and use tweezers to position the pre-tinned ends of the leads.

When applying the supply voltage for the first time, connect a resistor with a value of 100 Ω or so in series with the supply voltage. If the current consumption is around 21 mA, the board assembly can be assumed to be correct and you can connect a power supply (voltage range 10–12 V) directly to the board.

The next task is to load the boot loader software into the microcontroller via the ISP port. The boot loader can be downloaded from the Elektor website [2]; alternatively, you can purchase a pre-programmed microcontroller from the Elektor Shop. After this the LED should start blinking. Reprogramming a few fuses is necessary to enable the boot loader to work properly, but first you should study the microcontroller data sheet carefully. Up to now the author has always had good results with programming the fuses individually and in sequence. This way you can see exactly which function is involved if a problem arises.

Next connect a RS485 adapter to the two middle pins of four-way connector P24. Naturally, the corresponding driver must also be installed on the PC before you can use the adapter.

The next step is to launch the PC program termgui.exe (located in the wgui folder), which is also included in the download package (see below). If the Verify and Write buttons are not active after you press the Bootload button on the Maintenance tab, swap the two lines of the RS485 bus. After this you should able to download the application program code to the microcontroller’s flash memory by pressing the Write button.

The author wrote the software for the ATmega328-AU (boot loader and application program) in C, and the source text can also be downloaded. The author used C++ for the PC program. This requires Visual Studio 2008 SP1 for C++ to be installed on the PC.

After the sensors have been connected to the board, the initial temperature curves (as yet uncalibrated) should appear in the PC program. Now you need to attach the sensors to the heating system pipes as shown in Figure 3.

Alignment and calibration
The first task is to adjust the three trimpots that set the voltage thresholds for interrupt trigging.During this process the temperature of the heating system supply line should remain constant and no domestic water should be drawn from the taps.

The LED is lit constantly when an interrupt pin is active; otherwise it blinks or is dark. Start by rotating trimpot ‘KK’ (CC) fully anti-clockwise and trimpots ‘WW’ (warm warm; English: HH) and ‘Hzg’ (Heizung; English: heater) fully clockwise. The LED should go dark after 5 seconds.

Next rotate each of the trimpots in turn fully in the opposite direction; the LED should light up. Then rotate the trimpot back in the other direction until the LED starts blinking or goes dark.

You can follow all of this on the ‘Temperature Curves’ tab of the PC program (thermgui.exe) by means of corresponding messages shown the bottom left corner. A voltmeter connected to the input pins of U6a, U6b or U7d (respectively) is also helpful.

Use the PC software to calibrate the temperature sensors. A software user guide (with a brief description of the method) is available in the Zip file that can be downloaded below. If you wish to modify or extend the PC software, you will also find the source code and information on recompiling the code in the download.

 

 

Read the full post
Show less
Schematics
PCBs
Software

Loading comments...