We all use electricity. No surprise there, and you're burning power right now as you read this. Most likely, your computer is on, you have a light on, the heater or A/C may be running, the refrigerator, the coffee pot, the VCR, the TV, clock radios, doorbell transformer, wireless phone base stations, and much more. Have you ever looked back on the previous month when the bill arrives and wondered where it all went? There just hasn't been any easy way to monitor energy consumption within the month. Sure, you can buy a portable power meter to plug into one appliance or another, but what about the big picture - the whole house. Sure, there's a meter on the side of your house, but the feedback cycle is just too long between bills.
One way to close the loop a little tighter is to walk outside each day - about the same time, and write down the meter reading. Then, do the math or drop it into Excel and see if your energy needs change from day to day. I pondered this for about 8 seconds. The likelihood of being consistent is very low, and the resolution isn't good - at one reading per day. Most of us have to work away from home, so we can't take numerous samples each day for a better picture.
Let's cut to the chase. I found a better solution. Automate the monitoring, and with 5 minute resolution. I haven't done a calibration yet, so we'll see how it goes until I do that.
I pulled the plug on this house early April 2006. It took awhile to get the wires run in the new place (above).
Above is a snapshot of about 18 months of data - just before unplugging it in a relocation. That house was a standard gas/electric (gas for the furnace and the hot water heater).
[Dec 2003] WattWatcher has been online for about 4 months as I write this update. I now have good correlation between actual use and the bill. I can see the electric clothes dryer, that's easy. I can see the oven running. I can see when both are on. I can even see when there are a lot of lights running. One particularly watchful morning, I saw that the consumption didn't drop like I expected during the night. I wandered around looking for the energy drain, and found the door hanging open on the basement refrigerator (that we use for pop/juice/beer and frozen snacks).
Improvements - There are a couple of things to do different -
- The sensor I used is very unresponsive at low rate of consumption - below about 800 w/h rate. So, you still see dropouts in the graphs. It hasn't been at the top of my priority list - obviously, so I don't know if another one would work identically, or if I need to build my own more sensitive unit. Me theory is that the IR receiver is self-biasing, when the disk in the meter spins very slowly, it may be saturating the receiver, so it self-biases out of the useful range. This may happen since my IR emitter is a continuous signal, rather than an intermittent bit-stream.
- There is an always-on PC capturing the data. It is certainly within the realm of possibility to cache data with a low power device (EtherNut?) and then up-load it to the PC from time to time. Then, I could drop another 200 to 400 watts (I don't know what this old PC takes).
What is always plugged in and running - Cycling furnace blower, two refrigerators, microwave, stove, occasionally a ceiling fan, numerous clock radios, a telephone/answering machine, AVR, TVs, VCRs, DVDs on standby, doorbell transformer, garage door opener, network firewall, switch, hub, PantryPod, 2 and sometimes 3 PCs and their monitors. That's a lot of idle loads!
Now, if you want to know how I came up with this solution, here's how the story started -
How might we monitor our energy consumption? Power is calculated based on voltage and current measurements. We can even buy small power monitors for individual appliances. But how do we do this for the whole house? Current transformers are expensive, and even if they weren't, we'd have to get it into the main power coming into the electric box, or on every line coming out. I don't know about you, but I try to stay away from 240v, and I don't need the detail of monitoring every circuit. What else? Hmmm, there's already a power meter on the side of the house. How about monitoring the meter itself? If you look at it, most likely you have one with a spinning disk. Looking even closer, you'll see some black marks - perhaps we could sense those, oh, and there are two small holes in the disk. Watching those holes fly by seem reasonable.
Time for a little web research. Perhaps somebody else has done the same thing and will speed this project on its way... Somewhat surprisingly, it didn't take long to find a couple of good sites that already did most of the work for me:
http://www.seanadams.com/pge/ - This is for a meter like mine, and uses the small holes.
http://offog.org/code/electricity.html - This is for a different type of meter.With a much more extensive search, I didn't find any other sites with additional information. I guess these guys are the pioneers...
By building this, I can automatically monitor our usage with 5 minute resolution. But, there's a catch. We'll have to burn some energy to monitor it. This project, as detailed here, requires that you have a computer on 24 x 7 to do the monitoring. For me, this isn't a problem since that same computer is performing many other home automation tasks as well. But it is an important point if you don't have a server running 24 x 7.
Following Sean's design, it is basically a two-component design. The sensor, and the logging computer. The data logging is implemented with a program called MRTG, which I've used in the past to monitor various services at an ISP I helped found. Sean's design used a small left-over laser pointer, and beams it through the hole in the spinning disk. Let me tell you that I really like Sean's design because it is very easy to align the laser and the detector. Lasers are pretty cheap too, about $10 locally, so that is an option. However, I have a few of these little lasers, and they're not designed for long life, just very low cost. One is now barely visible, even with fresh batteries. Another has an intermittent in the circuit. I prefer to design so I don't have to service, and these two experiences shied me away from using a laser. But, I think I'll try to do the same thing with a slight twist. I'm going to use a modulated Infrared beam and companion detector/demodulator. Hopefully, the reasons will become clear in a minute.
As you'll see in the schematic below, I've used two 555 timers. The lower one simply generates a 38 kHz modulated IR beam with a simple IR LED. This will be mounted on one side of the meter. On the other side of the spinning disk, I'll have a standard IR receiver module which demodulates the 38 kHz signal. Unfortunately, the output of the receiver is a pretty high impedance logic signal, so I'm only using it to trigger another 555 timer, this one as a one-shot. The high drive capability from the 555 will send the signal 70 ft or so back into the house where the computer is.
Why the 38 kHz modulation?
My hope is that by using a detector that has a built-in band-pass at 38 kHz, I'll have great rejection of ambient visible and infrared lighting, of which there is plenty since the meter is outside. I don't know if this method solves a real or imagined problem, but these parts are very inexpensive... One other change over Sean's design is to physically reverse the two components. I will put the receiver above looking down, again hoping that it will help guard against the possibility of saturation of the IR detector due to all the ambient.
Click the on the schematic for a larger view.
O.k., would it work to use a simple IR signal source? To find out, I built a proof of concept, tested it in the basement, and then with a battery tested it on the watt meter by holding it in place. The detector, on the left, has a visible LED to provide easy feedback. I don't need a scope or meter to monitor the signal.
If you look closely, you'll see the IR detector on the left breadboard, and the IR Emitter on the right (it has a small black shroud to minimize the IR leakage in other directions).
With this breadboard, I did make a discovery that I don't quite understand. When the IR beam is continuously visible to the detector, the detector seems to integrate that level as its bias until it becomes a "non signal" bias. Then, it doesn't seem to work. If, on the other hand, the IR beam is only occasionally visible to the detector, then it will register the leading edge of that signal very accurately. This turns out to be the case when it is mounted on the watt meter, so the bench test seems to have been successful. [Update - this was a hint to the problem of the very low signaling rate, but I didn't recognized it as such]
This seemed like a good time to estimate the cost. I had to make a trip to the local RS for some parts, so I have a pretty good idea.
Qty Description Source Approx Cost Approx Total 2 Small Plastic Box Radio Shack 2.00 4.00 2 Small Perf Board .50 1.00 2 555 Timer IC Digikey .40 .80 1 IR LED Radio Shack 276-143 1.79 1.79 1 Visible LED .90 .90 1 IR Receiver Module Radio Shack 276-640 3.69 3.69 1 1k resistor .25 .25 1 100k resistor .25 .25 1 3.3k resistor .25 .25 2 5k resistor .25 .50 2 150 ohm resistor .25 .50 1 1.5k resistor .25 .25 1 39k resistor .25 .25 2 4.7uf capacitor .40 .80 2 .01uf capacitor .30 .60 1 300pf capacitor .30 .30 1 DB-9F connector 2.50 2.50 50ft CAT-5 or similar cable .05/ft 2.50 1 5v power supply 5.00 5.00 Total
$26.13 This doesn't account for the computer with a dedicated RS-232 port of course, or the time to fabricate it - but that's why it's a hobby, right?
And, if your computer is too new, and doesn't have a serial port, you can probably get a USB to RS-232 adapter online for about $20 to $40.
Proof of concept is one thing, putting it in service is another. There was a cautionary statement on the electric meter not to tamper with it. So, I used electrical tape as my fastener, which I figured was easy to yank off if there was a problem with this. Here it is, installed, and this is how I've been logging data for well over a year now. Yep, that's CAT-5 cable. It's what I had handy and long enough for the run I made - into the garage, up to the attic, across the top of the garage, down a conduit to the basement, half way across the basement to the lab where the home automation PC is. Another reason for CAT-5 is just in case I choose to put a network node on the end of that line, instead of the circuit you see above.
CAT-5 Pinout RS-232 Pinout
- Orn/wht - signal
- orn -
- grn/wht -
- blu -
- blu/wht -
- grn -
- brn/wht - +5v
- brn - ground
- DCD
- Rx
- Tx
- DTR
- ground
- DSR
- RTS
- CTS
- RING - signal
There are a few things that are a concern -
What about a lightning strike? I'm running 5-v signals into the computer from a cable wrapped around the electric meter. If I had 75 ft of fiber optic cable, I'd put a cheap calculator power supply out there and beam the data back. In fact, if I had that fiber cable, the laser beam idea looks a lot better. [The day after installation, we had very strong lightning in the area. The circuit didn't seem to notice, of which was thankful since I was at work... Also, our utilities are underground, which helps reduce the likelihood of a strike directly into the wires to the house]
The meter is quite a ways from the PC. I did string 5v signals that distance, and it does pick up some noise, but generally not noticeable.
[Interestingly, my 5v supply is near the computer. That 5v makes the run for about 75 ft to the meter. The 555 timer output drives the local LED, for easy installation tuning, and another LED back at the computer. It also feeds into the serial port on the PC. I cobbled this together to make the test, and it seems so reliable I left it that way]Can I gather data even when the PC is offline, then update it later? This would require an embedded system as the monitor to cache the data. This sounds reasonable, but presenting the cached data to the PC is problematic assuming MRTG is catching it. MRTG is also the scheduler used to acquire the data. So, if it is not running, then when it runs next it will flat-line fill in the gap. This could be quite a hack to fix it to consume 12 intervals once an hour - for instance. This is therefore outside the scope of this project.
Noise near the computer. I've noticed that if I kick in and out a very high emission device, like a grinder, or an intense fluorescent lamp, it can cause a false trigger. Pretty rare, but it does happen.
Here's my source code for the serial port on a Win2k system, or just grab the executable image. This is based on code from Sean. Sean's code was written for the parallel port on a linux system, and I have an open serial port on Win2k, so I'll have to make some mods, but at least I've captured it until I need it.
And the other applications you need (both of which are free)
- Perl - Go to the Active State site and get the software.
- MRTG - Go to MRTG's site and get the software. It is really not hard to setup.
Configuration -
There are two options here. First, MRTG can be programmed to load and go and automatically take a sample every 5 minutes, in which case you can't log off the computer. Second, you can have MRTG run once per pass, and then use Windows scheduler to automate the execution every 5 minutes. The advantage of the second method is a more graceful shutdown if you need to reboot, you won't have a console window always visible, and if you have it schedule properly, it will run the task even if you're logged off. I included a sample configuration file in the zip download of the executable image.
[Update - I had some problems where other family members would log off my account and into theirs. This stopped the program. Then a day later I'd see the gap in the data. I'm running Windows 2000, and used a resource kit program called "srvany". This allows you to create a service out of just about any program. So, WattWatcher now runs as a service. The advantage is that it now runs all the time when the computer is on, not just when I'm logged in. So, when other family members use the computer, I'm still collecting data.]
I configured both a web server, and I use Active Desktop, so I just post the image to the desktop for convenience, and the web server when I want to share...
I hope you enjoyed this article.
| If you feel you've acquired a $1 value, then please, send only a single dollar. If you feel it is worth more, then fill in the amount that matches the value you've received. |