Tuesday, March 20, 2012

Temperature Triggered Light Switch

The idea for this project came to me 3-4 years ago late one cold winter night when I was called by my father-in-law.  Some rural homes running on well water will have the water pump above ground and in a small building.  Many of these pump houses, like the one at the house I rented from my father-in-law, can really ruin your day or week if a pipe bursts due to below freezing conditions.  While I was appreciative of the call to save repair costs, fumbling around in a small building near mid-night looking for a lightswitch wasn't something I cared to do.

I could have hired someone, drawn an electrical line with a switch to the home, or created a wireless switch, but what if I hadn't gotten the call or what if I were out of town?  I've always wanted a smart home and this was a start to doing it cheaply.

This first photo is a prototype board with an ATmega328 flashed with Arduino.  A transformer to get power from AC is just below the picture in the box.  The relay is triggered on pin 8 when the temp sensor reads 0 degrees C or below.  The standard light switch can be used as a bypass and is mounted to the box cover.  The LM75, temp sensor shown in the second photo, was scavenges from a 2004 iMac being sent to the recycler at work.  The sensor is on a nice breakout board with connector.  I've soldered these wires to an RJ11 socket at both the base unit and for the sensor.  This will allow the sensor to be connected by a standard telephone wire.  Between power and the I2C protocol all four wires of the telephone line are being used and cheaper wire with only two wires can't be used.  To help keep the sensor weather resistent I used a clear christmas tree ornament from Michaels and sealed it with super glue.  It survived 30 seconds under a running faucette so I'm gong to attempt to hang it under the roof's over hang.

The total cost of the project was under $15 with most of the compnents repurposed from tossed electronics.  I hope to follow up with a photo of the box and switch installed in the pump house; conveniently after we've moved out of the rental house and just after another winter season.  Of course, it's always the first frost that's hardest to remember!