Monday, February 1, 2010

Water Pipe Anti-Freeze Heating


Check out V2 of this project here. Simpler and much less overkill :)

We have 2 buildings on our property: the house and an office building. Between the two is a semi-open garage. Through this garage runs the water pipe to the office building which is exposed to outside temperatures.
The usual procedure for this pipe during winter was to completely drain and disconnect it so that it doesn't freeze in. This has become somewhat of a pain as I needed the water during winter so solving this has become a project of mine.
I managed to acquire a bit of heating cable that I could run in pair along the length of the pipe.
One "channel" at 12volts came out to about 47ish Watts for the entire length of the cable.
I wasn't sure at first if this would suffice, but I gave it a try. The heating cable was taped to the underside of the pipe with PVC tape and copper tape where I assumed it would matter (I would've done it with copper tape along the entire length but it's expensive :) ) The pipe was then covered in foam insulation.

A DS1621 temp. probe was installed (marked with yellow tape on the picture) on the top of the pipe. (The heating cable running at the bottom should ensure that the probe isn't being heated directly by the cable, which would make measurements useless.)
Both the cable for the probe and the heating cable go into the boiler room that is accessible from the garage.
I designed a controller from what I had on hand. An old ATX PSU and an ATMega8(overkill). The AtMega is powered by the standby voltage of the PSU (5VSB). PSON is connected to PORTB.0 so the AtMega can switch the ATX PSU ON or OFF depending on temperature. (The PSU turns on when PSON is pulled low). The heating cables are hooked up to a 4pin Molex Connector.

I admit I didn't make exact measurements of the pipe temperature with the heating on, but the day after I finished this project we had -16 degrees Celsius and the pipe didn't freeze in. Good enough test for me, as we didn't have anything colder in the past 10 years. The controller sits on top of the ATX psu
in a cheap electrical box. 2 LEDs were installed, one shows that there's standby voltage, the other is a heating status / error led.

I use only 1 channel for now, since it seems to have been enough to keep the pipe from freezing in at -16C. The other channel is used as a load for the 5v rail of the PSU (at 5V it doesn't provide much in terms of heating) As it turns out, the 5V rail has to be loaded to stabilize the 12V rail, otherwise there will be huge voltage drop.

The DS1621 was actually a thermostat IC and I was considering using it in a standalone configuration but sadly that can't be done as the thermostat
functionality doesn't start until a "Start Convert" command is sent to the chip through I2c. That meant a microcontroller was mandatory, so instead of
relying on the internal functionality of the chip I just implemented the thermostat function in code. This also meant I only had to run 4 wires from the
temp probe instead of 5, and I had 4 wire telephone cable lying around.

One could use an Arduino for this, or any other dev board. Since I had an ATmega8 lying around, and my 2051 programmer was out of commission I used that. If I need the Mega8 in the future I'll probably end up replacing the controller with a 2051.

Update Feb. 01:

A few days ago I noticed some weirdness while running the tap, so I checked on the controller. The LED was flashing meaning there was an error condition, and the heating was off. The pipe was beginning to freeze in. There were 2 possible places in the code that could produce that. Either the temp. probe didn't respond or a measurement returned a value greater than 25C (which would be a bad measurement as temperatures were mostly sub-zero that day). It was probably a random hiccup as it continued to work fine after a power cycle. This however convinced me that the code needed to be more resilient. So now it retries if the temp. probe doesn't answer or if the measurement is out of bounds. Only after 3 subsequent failures does it go into the error condition. I also added a speaker that beeps out an error code if that happens, making it easier to notice. I took a picture of the controller after I reflashed it with the new version. It has become somewhat of wiring chaos, especially now that the speaker was added. The board design is a modification of this project. I didn't intend to use it here. It just happened to be the easiest solution at the time.

And the speaker on a strip of mounting tape:

You can find the controller code here. (BASCOM/AVR)


  1. Perhaps you should consider a "failsafe" mode the supplies some minimal degree of heating to limit any damage should the temp probe chip fail? Maybe default to 30% duty cycle on the heater strip if the temp probe chip can't be read after the 3 cycle failure.


  2. Good thinking. I was considering something similar then laziness got the best of me :) For now I just keeping checking it from time to time. But I'm pretty sure someone would notice it beeping before the pipe freezes if it shut down again. That said I'll probably add this if I have to take it offline again for some reason. Or after the winter, if I don't.


Moderation temporarily re-enabled due to increased spam