Power measurement

I live in a flat with a prepaid electricity meter. Buying enough electricity is a task I am faced with every month. One advantage of this system is that you can see how your electricity "units" count down, telling you how much electricity you are using.

Together with an LCD showing the amount of units that are left, the electricity meter also has an LED that flashes faster or slower according to your electricity usage. Below this light it says "1000 flashes per kWh". Kilowatt-hour is the technical term for what we call a "unit" of electricity.


When I stand in front of the meter I would like to know my current consumption of electricity. I can thus do this by timing the duration between flashes, but this will need very high accuracy of timing. Another way of measuring the consumption is by counting the amount of flashes per minute.

Now a little bit of math:

Thus for every flash I count in a minute I use 60 Watts of electricity.

Doing this by hand gets tedious very quickly. So as an electronic engineer I made a plan. I had a Arduino Mega development board with an ethernet shield lying around. The Arduino was programmed to count the flashes per minute and upload the flash count to a computer in my house running a MySQL database.

When I visit a specific website on the computer running the database I now get a graph displaying my electricity usage for the past 24 hours and past 7 days. This graph is drawn by the jpgraph PHP library from the data selected out of the MySQL database.

An example of the graph is shown below. One can clearly see the times I boiled a kettle of water or used the microwave; the hot water cylinder was on; the time at night my computer was turned off; and the on and off cycle of the fridge.


A live version of the graphs can be seen here.

A few statistics
One day with the hot water cylinder turned off, me not home and thus only the fridge, mini PC and network running (base load) used 5.187 kWh of electricity.

But how does it work?
Want to know more about how I did it? Go and read the Power measurement - technical details.