<-- Home

An AVR-based power usage logger

This device monitors household power usage and logs it to an SD card. A simple analog front-end amplifies the signals from voltage and current detectors and an ATmega168 microcontroller computes the power consumption using the formula P=V*I. The voltage and current are each sampled at 9615 Hz so the integration should be fairly accurate even for highly non-sinusoidal loads such as computers or fluorescent bulbs. A graphical LCD shows the power usage as a strip chart and can also act as an oscilloscope to display the voltage and current waveforms. The current is amplified in three stages (1x, 10x, and 100x) so that different gains can be used giving accurate readings for both high and low power usage.

The current is measured using a pair of current transformers installed in the fusebox. The transformers are made from old TV flyback cores with 100 turns of magnet wire. A 0.2 ohm current sense resistor is connected to the coil and the whole thing is wrapped in electrical tape for safety. USB cables connect the sensors to the main unit, although shielded audio cables would work just as well. Unfortunately the two cores produce different reading for the same amount of input current, and this affects the accuracy of the measurements by about 10%. Probably there is some magnetic saturation going on here, trying a few different types of cores would probably help. An LMC6484AIN quad op-amp is used for signal amplification. This chip was chosen because it is capable of operating rail-to-rail with a single 5V power supply.

The voltage is measured using a 2000:1 voltage divider connected to an AD623AN instrumentation amplifier. This chip was chosen because it can operate on a 5V power supply and can accept inputs that drop below ground, which allows for the possibility of using Earth ground as both circuit ground and as the sink for the voltage divider. The voltage divider causes some ground leakage current, but probably not enough to trigger a GFCI. The component values are selected for a 120V input, the voltage divider ratio would need to be adjusted if 240V input is needed.

A note to those who may be considering making a similar device: instead of sampling current and voltage by the microcontroller it is also possible to compute the current using a specialized chip such as the ADE7757. This is much simpler and probably more accurate. Shop around to find the best chip since new parts are being produced all the time.

Schematic: digital section

Schematic: analog section

The analog circuitry is on this board, which will be placed inside
of a grounded copper box to prevent interference from the ubiquitous
60Hz background radiation.

The digital board, power supply, input voltage divider, etc.

The current transformer sensors, one for each phase. They are
installed in a way so that if they fall they won't short anything out.

A strip chart showing power usage over time.
Our hot water heater uses over 4kW.

Three days of power. The large spikes are the hot water heater
and the small square wave is the refrigerator. We did several loads
of laundry on Saturday.

A closeup view of laundry. The oscillation is due to the periodic
spinning of the washer.

So, the moral of the story is that in our house the hot water heater, refrigerator, and laundry completely dominate the power usage. The compact flourescent lights and computers don't really even make a dent. It will be interesting to see if the story changes in the winter. We will have both cars plugged in (oil pan and headblock heaters) and the lights will be on all day.


<-- Home