Saving energy with a netduino – results

Bamboo Leaf Collage

Back in February 2011, I built an automated gas water heater regulator using a netduino micro-controller to save some energy with our old gas water heater. There was much debate among Hack A Day and Channel 9 readers about the effectiveness of this hack and its ability to actually save energy.  As promised, I am now reporting the results of the experiment.

Puget Sound Energy, our energy provider, is kind enough to track our energy consumption and makes the data available through their web site. I ran two reports to compare our natural gas usage between March and April 2010 and the same time period in 2011, including the outside temperatures.

Puget Sound Energy Charts – Natural Gas Consumption

March-April 2010

March - April 2010

March-April 2011

March - April 2011: With Hot Water Heater Controller


Compared to 2010, the netduino-powered Water Heater Controller saved 20 therms between March and April 2011 even with lower outdoor temperatures than the previous year. In WA a therm costs ~$1.19. So this represents a $23.80 saving. Not bad for a weekend project 🙂 I wish I had more data to show, unfortunately, the water heater died on us the second week of April with a completely rusted out bottom. C’est la vie…

Death by "rusted out bottom"

Saving energy with a netduino

Bamboo leaf

Our home is equipped with a relatively old gas heater, built in 1996. It still works great, has been serviced regularly since it was installed and there is no good reason to replace it yet. However, it isn’t as energy efficient as more recent models.

The other aspect of this gas water heater is that it keeps the water hot 24/7, 365 days a year whether we need it or not. In my home, we generally only need hot water in the morning between 7 and 9 AM and in the evening, from 5 to 9 PM. On weekends, our schedule is a bit whacky and we need hot water from 8 AM to 9PM.

So, 30 hours for week days + 26 hours for weekends, that’s 56 hours / week where hot water is actually needed, as opposed to 168 hours / week when the heater is just left alone. In order words, in our house, we only really need a third of the water heater energy that we normally consume.

To make matters worse, the water heater was installed in the garage by the builder and it gets pretty cold during the winter time.

Considering that ~25% of our heating bill goes into heating water, I felt compelled to stop this senseless waste.

The idea that I came up with was to design a scheduler, configured to follow our weekly hot water usage pattern and capable of lowering the water heater temperature down to a minimum during off-hours.

I wanted it to be cheap to build with easy-to-find parts and very reliable as my wife does not appreciate cold showers: I decided to use a netduino-mini micro-controller, an AdaFruit DS1307 real-time clock and a servo to adjust the temperature of the water heater.

Here’s what the end result looks like in action:

Startup Sequence

Manual Override

The slow moving speed of the servo is intentional in the application in order to minimize wear and tear on the servo’s gears and the overall assembly.

The configuration of the clock and the schedule is done over a serial interface. Here’s a sample output:

[02/19/2011 19:29:40]
Water Heater Controller v1.0

[02/19/2011 19:29:40] Initializing...
[02/19/2011 19:29:40] Loading schedule
[02/19/2011 19:29:40] Centering servo
[02/19/2011 19:29:41] Setting heater on high heat by default
[02/19/2011 19:29:51] Running...
Time: Saturday, 19 February 2011 19:29:51
Heater Schedule Today: Sat [8-21] [0-0] [0-0] [0-0]
Heater Status: ON [scheduled]

Main Menu:
1 : Show Schedule
2 : Set Schedule
3 : Set Clock
4 : Swith Heater ON / Resume Schedule
X : Shutdown

[02/19/2011 19:29:52] Heater state change
[02/19/2011 19:29:52] Setting heater on high
Heater Weekly Schedule:

Sun [8-21] [0-0] [0-0] [0-0]
Mon [6-9] [17-21] [0-0] [0-0]
Tue [6-9] [17-21] [0-0] [0-0]
Wed [6-9] [17-21] [0-0] [0-0]
Thu [6-9] [17-21] [0-0] [0-0]
Fri [6-9] [17-21] [0-0] [0-0]
Sat [8-21] [0-0] [0-0] [0-0]

You can find the C# code for this project at
Look for the “/Samples/WaterHeaterController (netduino)” folder.

The rest of this post documents the implementation details of the system you should be inclined to build your own.

Actuating the water temperature knob

Our gas water heater is equipped with a thermostat control like this one The knob has a large dial, with a fairly flat hand-grip surface.

I needed to figure out how much torque was required to turn the dial in order to buy an appropriate servo. The method I used was simple: mount a lever on the knob, attach a light container to the lever, pour water into the container until the knob turns, measure the amount of water poured and derive the appromixate amount of torque based on the length of the lever and the amount of water.

Using various Internet resources to calculate torque, I determined that I needed an absolute minimum of 12 oz-inch of torque to get the knob to turn. To be on the safe side, I selected a servo with nearly 6 times as much torque and purchased a HiTech HS-6635HB servo for about $30.

Why de-rate the servo requirements so much? A few reasons:

    The servo needs to be robust and reliable for many years and must not strain moving the load.
    Having too much torque is better than not enough and it is easy to control in software.
    High-torque servos have better ball bearing systems and stronger gears made of metal or heavy duty resin.

Mounting the servo on the water heater

I chose to anchor the servo to the gas pipe of the water heater, using the section of the pipe to the left of the gas valve. To do so, I cut a piece of wood from left-over hardwood flooring material to fit the lower left area of the pipe. I drilled holes on the top and left sides of the board so that it could be secured to the gas pipe using zip ties. I also drilled 4 holes to secure the servo to the board with long thin screws and locking nuts.

Connecting the servo to the control knob

The parts for this phase are easy to come by at hardware stores and craft stores:


    2 popsicle sticks
    A spool of thin metal wire
    A thin but sturdy brass rod
    A section of rubber gasket long enough to fit around the circumference of the water heater knob. Make sure that the width of the rubber gasket doesn’t exceed the width of the knob’s hand-grip
    An adjustable metal ring
    Hand-craft a bracket the length of the popsicle stick from a thin strip of brass


    Drill two holes near the end of the popsicle sticks.
    Make sure that the thin brass rod fits easily through the holes but doesn’t have wiggle room either.
    Secure one of the popsicle sticks to the brass bracket with some tape then with the metal wire wrapped tightly around it.
    Insert the brass bracket between the rubber gasket strip and the metal ring
    Tighten the metal ring around the water heater knob.

The final assembly should feel tight and strong while turning the knob.

To secure the other popsicle stick to the arm of the servo, drill a few holes into the stick, matching the holes in the servo’s arm. Then weave the thin metal wire through the holes, then wrap the metal wire tightly around the stick and the servo’s arm. The final assembly should also be tight and strong while turning the servo’s arm.

Connect the popsicle sticks together with the brass rod and secure it by bending it carefully around the ends of the sticks. It’s easier to do this while the servo’s arm is not attached to the servo.

Finally, re-attach the arm to the servo and test the assembly by moving the servo’s arm slowly.

The knob should turn in sync with the servo with ease.

Building the Water Heater Controller board

This controller board is built around a netduino-mini, a DS1307 real-time clock by AdaFruit Industries and a few other components:

    2 1N4001 rectifier diodes
    4 LEDs of different colors
    4 ~220 Ohm resistors (for the LEDs)
    1 2N2222 transistor
    1 300 Ohm resistor
    1 momentary switch
    1 100 Ohm resistor (to be used with the switch)
    1 10K resistor (to be used with the switch)
    1 9 volt / 1A power wall-wart supply
    1 generic proto board
    straight and angled pin headers
    1 barrel jack connector for the power supply

Simple Wiring diagram

To further increase the life of the servo, I decided to control the power supply to the servo through a 2N2222A transistor. It works well because the servo doesn’t need to hold the water heater knob into place all the time: once positioned, the knob stays where it is and the servo no longer needs power to maintain its position.

The base of the transistor is connected to the ‘Servo Power Enable’ (pin 16 of the netduino mini) through a 300 Ohm resistor in series with a 1N4001 rectifier diode. The diode is there to eliminate 0.7 volts present on the pin even when it is turned off.

Here’s the thread on the netduino forums discussing the 0.7 volts issue which seems specific to the netduino mini.

To be on the safe side, I also added a 1N4001 rectifier diode on pin 23 (power ground) of the netduino mini to prevent any potential damage to the micro-controller if the power were connected backwards. I did not see such protection on the schematics of the mini.

Building the board:

The final board:


Connect a dumb-terminal to COM2 on the netduino mini (or to COM1 on the regular netduino).

Using the serial interface:

Set the clock’s date and time and define a schedule when the heater should turn ON.

The schedule tracks 7 days, with 4 timeslots for each day. Each timeslot has a begin time defining when the heater should turn itself ON and an end time, defining when the heater should turn itself OFF.

Setting a timeslot to 0 resets the timeslot and the heater stays OFF.

Keep in mind that the heater timeslots and the clock expect to work on a 24 hour schedule.

Heater Weekly Schedule:

Sun [8-21] [0-0] [0-0] [0-0]
Mon [6-9] [17-21] [0-0] [0-0]
Tue [6-9] [17-21] [0-0] [0-0]
Wed [6-9] [17-21] [0-0] [0-0]
Thu [6-9] [17-21] [0-0] [0-0]
Fri [6-9] [17-21] [0-0] [0-0]
Sat [8-21] [0-0] [0-0] [0-0]

The schedule data takes 56 bytes, which happens to fit perfectly into the 56 bytes of battery-backed user-memory in the DS1307 clock. Funny how this worked out 😉

The push button (High heat override) on the board forces the water heater into high heat, overriding the pre-defined schedule settings.

Meaning of the LEDs

    High heat LED: ON indicates that the water heater is set to high heat.
    Low heat LED: ON indicates that the water heater is set to low heat.
    Servo Active LED: ON indicates that the servo is changing position.
    High heat override LED: ON indicates that the push button was used to override the schedule.

Starting the water heater controller the first time

Before you apply power to the board, make sure that the arm of the servo is centered (vertical position). This will ensure that the startup sequence is smooth. From there, the controller will slowly set the water heater knob on high heat before tracking to the schedule.

I’ve been running the controller on the gas water heater for a few weeks now and I’m anxious to see what our next water heating bill will look like 🙂

Happy Hacking!

PS: a number of readers have mentioned the potential risk of Legionellae bacteria development in the water. While this bacteria is more of a concern with cooling systems, to be on the safe side make sure that you tune the system so that the water temperature reaches at least ~130 degrees Fahrenheit when the system is ON.