8 May 2011
Arduino Electricity Monitor
I wanted to monitor the electrical usage in my new house. I also wanted to learn more about circuits, electronics, etc.. So I decided to build my own.
This first post is going to describe the hardware side of things. I’ll post more about the server side software later.
The design I used was based off this design. The circuit was pretty simple, and it used an Arduino, something I always wanted to start playing with.
Immediately I decided to add an improvement: I wanted the unit to be entirely wireless. If my meter is outside, I don’t want to have to run cables all the way to my server. I checked out the Arduino website and came accross the Fio. Which is a small, wireless version. My parts list included:
- 1 x Arduino Fio
- 1 x 2000mAh 3.7V Lithium Polymer battery
- 1 x 1/8″ solar cell (BPW-34) (used as a photo detector)
- 2 x XBee Wireless Radios
- 1 x 3.3v FTDI / USB Cable
- 1 x XBee Explorer (USB to XBee converter)
- 1 x plastic bottle cap (from a coke zero)
- 1 x container (to house the components)
- Wire, solder, and patience.
The Fio came pre-installed with the “blink” code. All it does is flash its on-board LED once a second.
The first thing I did was prototype it all out using a bread board. This was my first ever project so I had to learn (and remember) about building circuits, resistors, etc..
I wanted to keep the parts-list as small as possible, so I decided to use the built in 20kΩ resistor on the Fio as a pull-down resistor.
Why did I use a solar cell? Because its response rate is really fast. When it detects light (or a flash of light), it generates a current, and brings the voltage up high enough to indicate a “binary 1″ on the digital pin. This change of state is noted and increments a counter.
The black wire you see from digital pin 6 to DTR will wake the XBee radio (which is under the unit) when it’s time to transmit data.
After a few hours of tweaking the code a bit, I got the unit working properly. Every time it detects a flash, it lights the on-board LED. After 10 flashes, it wakes the XBee radio and transmits a “1″ over the serial line.
When it came time to packaging the unit. I didn’t want to hardwire leads to the Arduino. Just so that I could re-purpose it, or move things to different pins without having to re solder. I decided to solder a header to the pins. This way I can just stick in bare wires to connect to the pins on the Fio.
I did decide to hard wire the wire to the DTR pin.
I was able to find a great little box (that was originally used to store safety pins) that fit all the components perfectly. I created two holes for the leads and taped the battery to the lid.
There are two main problems with my case. Firstly, it is not water proof. I will need to seal the holes used for the leads to the solar cell. As well as find a way to seal the lid while still being able to open it. Secondly, there is no easy way to charge the battery. I would have to open the case and attach a USB cable to the Fio to charge it.
At idle the unit draws a current of ~110 μA. This really small current is due to the fact that everything is turned off. The radio, circuitry, and even the analog to digital converter (since we don’t use it). At full power, with the unit on and the radio transmitting, this jumps up to ~ 50mA. I wonder, how often will I need to charge the battery?
The battery is rated for 2000mAh and with a natural discharge rate of 8% per month. Time to make some assumptions:
- I will use approx 500kWh of electricity per month.
- The full power current of 50mA will last 1 second every time we use 0.01 kWh of electricity.
- The battery will discharge 8% per month in addition to any current being used.
- Ambient temperature will not be a factor.
Using 50mA in one second, results in a discharge rate of 0.01389 mAh.
The full power on time (per month) will be: 500 / 0.01 or 50,000 seconds (13.9 hours). 0.01389mAh * 50,000 seconds = 694 mAh.
The idle power on time (per month) will be 2,629,743 seconds – 50,000 seconds or: 716.6 hours. 110 μA * 716.6 hours = 0.000078826 mAh.
Total power consumption per month will be 694.000078826 mAh. Let’s just toss out the idle power consumption (assume it’s zero) and assume a monthly power consumption of 700mAh.
2000mAh / 700mAh = 2.8 months of battery capacity. This does not account for the natural discharge rate of 8% per month for the battery.
(If my math is off please let me know)
I was hoping to get closer to 6 months for battery life between recharges. Perhaps version 2.0 will improve the battery life. Any way…
The other end of the unit connects to the electrical meter. I decided to use a black bottle cap to block out as much light as possible.
I will then affix this cap to the meter using tape.
Here is unit in action. Apologies for the poor focus, my phone doesn’t auto-focus when shooting video.
I have yet to install the unit at my actual house (I don’t move in until the end of May). I’ll be sure to provide an update when I do.
The source code that runs the Arduino is also available. Please let me know if you make any improvements.