frozenpipe

Winter is coming. It is time to make preparations. If you live in a colder climate, you need to be concerned about the possibility of your pipes freezing. There are a lot of preventive measures that you can take, such as insulating your pipes and leaving the water dripping. But for a little extra peace of mind, I designed a simple alarm that will notify me if the pipes are getting too cold and are in danger of freezing.

YouTube player

Project Steps

Construct the Temperature Sensor

The temperature sensor is made by connecting a thermistor (temperature-dependent resistor) and a fixed resistor in series. These two resistors form a voltage divider. As the temperature changes, so does the resistance of the thermistor. This causes the voltage between the two resistors to change, which can be measured by a microcontroller such as an Arduino.

Connect one lead of the fixed resistor to the GND pin on the Arduino. Then connect the other lead to an analog input pin. Connect one lead of the thermistor to the 5V pin. Then connect the other lead of the thermistor to the same analog input pin. You can now use the AnalogRead function to measure the voltage changes.

In order to insert the thermistor into the wall were the pipes are, I connected the thermistor with a pair of long jumper wires.

Arduino Code

//Here is some sample code that you can use for your sensor

int AlarmOneInputPin = 0; // sensor connected to analog pin 0

int AlarmOneOutputPin = 9; // Alarm connected to digital pin 9 int AlarmOneInputValue = 0; // variable to store the value read int AlarmOneTriggerValue = 350; // alarm set value

void setup() { pinMode(AlarmOneOutputPin, OUTPUT); // sets the digital pin as output Serial.begin(9600); // setup serial }

void loop() {

AlarmOneInputValue = analogRead(AlarmOneInputPin); // read the input pin Serial.println(AlarmOneInputValue); // debug value

if(AlarmOneInputValue < AlarmOneTriggerValue) //flash the alarm if the sensor value is below the trigger value { digitalWrite(AlarmOneOutputPin, HIGH); // turns the alarm on delay(1000); // waits for a second digitalWrite(AlarmOneOutputPin, LOW); // turns the alarm off delay(1000); // waits for a second } else { digitalWrite(AlarmOneOutputPin, LOW); // turns the alarm off delay(1000); // waits for a second }

}

Calibrate the Sensor

Before you can use the sensor, you need to calibrate it. You can do this with a simple glass of ice water. Insert the thermistor into a small plastic bag and submerge it in the ice water. The water should be just above the freezing point.

Now use the AnalogRead function on the Arduino to measure the voltage at the connection between the two resistors. The result will be displayed on a scale between 0 and 1023 (which represents the range of 0V to 5V). With my sensor it measured at about 300 — so I know that the sensor will read about 300 when it is almost freezing. This will be the value that we set to activate the alarm.

To set the alarm temperature, open up the code file and set the value of the “AlarmOneTriggerValue” variable to 300 (or your chosen value).

Construct the Alarm

For the alarm, I am using a simple LED and piezo buzzer. I connected them in parallel so that I could activate both of them with a single digital pin from the Arduino. Whatever kind of alarm you decide to use, be sure that you don’t exceed the 40ma maximum output of the digital pins. If you need more power than that, you should set up a driver circuit with a relay or a power transistor.

First, I prototyped the alarm on a breadboard. Then I soldered it to a small piece of perf board. I connected the negative terminal of the alarm to the GND pin on the Arduino. I connected the positive terminal of the alarm to digital pin 9.

Once, I had the alarm working on its own circuit board I mounted it inside a small project enclosure. To fit the parts inside, I drilled a hole in the center for the LED and I cut a slot in the side for the wires.

Insert the Temperature Sensor into the Wall

Now you need to insert the temperature sensor into the wall near the pipes. If there is already a hole in the wall around your pipes, you can just slide the sensor in there. If not, then you will need to drill a small hole.

Select a drill bit that is just big enough for your sensor. Drill the hole as close as possible to the middle of the pipe. Then insert the temperature sensor into the wall and try to position it close to the pipes. If necessary, place a piece of tape over the hole to help hold it in place.

Use the Sensor to Monitor Your Pipes

The last thing that you have to do is mount the alarm someplace noticeable. You can now use your sensor to help you monitor your pipes in the winter.

You can add as many sensors as you have analog input pins on your microcontroller. This would allow a single Arduino Uno to monitor up to six sensors.

You can also use this kind of a sensor to automatically control an electric pipe heater. All you need is a relay driver or a PowerSwitch Tail.