Tuesday, June 7, 2011

Smarter Water Heater Timer

In Los Angeles, we have the "Time-of-Use Program" option from the power company.  From their FAQ:
The prices are based on the time of day when the electricity is actually used, unlike the standard rate when the price for electricity is always the same. 
A higher price is charged during “high peak” hours, which are between 1:00 p.m. and 5:00 p.m., Monday through Friday. The price for electricity during these hours is about twice the cost of the standard rate price.
Surrounding these “high peak” hours, are the “low peak” hours. “Low peak" hours are from 10:00 a.m. to 1:00 p.m. and again from 5:00 p.m. to 8:00 p.m., Monday through Friday. The price for electricity during these hours is slightly higher than the price charged on the standard rate. 
During all of the remaining hours, Monday through Friday, and all weekend long, the price for the electricity you use is about one-half of the price for electricity on the standard rate. These hours are called “base” hours.
 I was lucky in that my house came with a mechanical timer (as part of some Frankenstein solar system). It was easy to set it to turn off the hot water heater from 1 to 5pm. Don't forget about daylight saving time, oh how I hate daylight saving time.

This worked fine except for the most weekends we would forget to reach into the box and turn on the hot water before during laundry or grabbing that all important weekend noon shower. Even the ridiculous note didn't help.

Besides, sticking your finger in there with the 240V always seemed a little sketchy even with that cardboard protecting you.

So, I decided to over-engineer a solution. How about an Arduino powered server following a real time clock?  How about adding a "vacation switch" which will keep the hot water off until it is moved back? How about a "next cycle override" button for those times when money is no object and you need how water now? How about a pulsing blue led to let you know it is thinking?

Parts list:

  • Arduino
  • 9V power supply
  • ProtoShield
  • Servo
  • Some piano wire
  • DS1307 RTC
  • Battery for RTC
  • Switch
  • Push button
  • Add LEDs to taste
  • Enclosure Never mind, I like seeing it naked!

First problem is that the clown who mounted the current timer used those expanding drywall anchors which are designed to hold up a small photo. The "manual" override switch requires quite a bit of force to slam into the off position and over time (and I'm sure a few earthquakes) the thing was barely being held up by the last of three anchors. After pulling it off the whole way (yes, the power was shut off at the breaker), I added an old shelf to become the new mount. It matches the decor nicely. 

And, mount the mechanical switch.

Now, it is time to build the world's most expensive 240V relay. Simply drill a small hole on the manual lever, a small hole out the side and mount up an old servo from an R/C car. It looks like this when using things found in my garage.

It took exactly three tries to find the correct distance from the center of the servo to get the correct amount of movement and force. I ended up using like 20 degress and 140 degrees for off and on in the code.

I wanted an excuse to use these surplus ProtoShield PCBs I got from ebay. When finished it looks like this:

Nothing too impressive. Start with the fully assembled ProtoShield. I used blue on the bottom and yellow on the left. The LED at the top is interesting in that you can change it between green and red by reversing the leads. That little switch is the vacation switch. A DS1307 RTC with a lovely battery from a 1994 Shiva LanRover. Don't forget your current limiting resistors and pull-up resistors.  I didn't use the stacking headers because... well, there isn't anything to stack on top of this. Besides, that battery is beast.  I don't know what a bluesmirf is, but JP7 (upper right corner) was perfect for a servo header. Power and Gnd where already there.

Solder job... I'd give it a 7 out of 10.

I disabled the mechanical timer by disconnecting the two white wires on the 240V. Hey, every little mW counts! So upload a sketch and you are done.  I'll post the code if anyone wants to see it, but be aware, it is much worse than my soldering.

The green and red led at the top is red when the hot water heater is on and green when it is off. It is connected between pin 12 and 13 with a current limiting resistor. Make one pin high and the other low to make it green, reverse the high and low to get red.  The yellow led on the left lights solid when vacation mode is on and flashes when the next 24 hours will always get hot water using the override push button at the top left. And finally, the blue led pulses from off to about half brightness (which is actually very bright) for absolutely no reason. However, for that split second I open the door from my house to the garage, the faint blue glow makes me think I might have accidentally stepped into the grid from TRON. But only for a split second.