Simple DIY Arduino Whole House Kilowatt Meter

Subscribe to my Feed!

Here is a simple way to turn an Arduino into a whole house power usage logger. The collected data can be graphed using either Excel or another similar program to give you an idea of how much energy your house uses during different times of the day.

I decided to keep this project as straight forward as possible. You can make it more elaborate by adding more EEPROM so that you can store more data (which would require the sketch to be modified) or by writing programs that will automatically create the graphs.

That can get confusing though for everyone but the person who put the system together, so I tried to make this project simple to increase the chance of it working “straight of the box” so to speak.

Below is a picture of my electric meter. You can see that it is the type with the spinning disk. They are pretty common, but some of the newer digital ones probably won’t work with this particular electric meter hack.


For this project, the Arduino logs your power consumption by counting the number of times the disk spins.

If you look at the picture below you can (sort of) see the red light cast by a cheap laser pointer. Notice also that there is a small hole in the spinning disk. When this hole lines up with the laser, the light is able to shine through the disk onto a photoresistor. Every time this happens, the Arduino counts another rotation.


My meter actually has two holes in its spinning disk, so I have to divide the number of rotations by 2 to compensate. If you look at the top of the Arduino sketch, you will see “float triggersPerRotation = 1;” I would want to put a 2 here since the laser light will shine on the photoresistor two times every rotation. You might not need to though depending on your setup.

In this picture you can see the laser on top of the power meter and the photoresistor underneath of it. The laser is inside of a short piece of PVC pipe and sealed with silicone to help weather proof it.

The photoresistor is at the bottom of a tube taken from a pen to keep stray light from throwing of its reading.


The laser and photoresistor are held in place by taping them to a threaded rod coupler nut. The coupler nut is attached to a short piece of threaded rod and the threaded rod is held onto the electric meter with a strong neodymium magnet.

You can also see how I used some electrical tape to tape everything to the meter and keep it all in place. I tried it without the tape first, but things kept getting misaligned.

Alignment itself can be a little tricky, but definitely not impossible.


Using The Arduino Power Meter Sketch

You can download the Arduino Power Meter Sketch by clicking here.

The comments in the code will tell you how to customize the variables at the top of the sketch so that they match your particular electric meter and electricity cost.

Most of it is pretty straight forward, but the “biggerValue” and “smallerValue” variables (shown in the picture below) require a bit more of an explanation.


To find these values, first put together the circuit as shown in the schematic located further down this page and align the laser pointer so that it shines on the photoresistor every time your electric meter’s disk rotates.

Once that’s finished, uncomment the two lines indicated in the sketch at the top of the void loop().



Upload the sketch and open the serial monitor.

When the laser’s light is not shining on the photoresistor, you should get a lower number printed on the serial monitor.

When the laser’s light shines on the photoresistor, the serial monitor should give you larger values.

The picture below is what mine reads. The exact values depend on your photoresistor, so yours will no doubt be different.

My photoresistor’s lowest value is 0 (when dark), so I use the number 10 for my “smallerValue” variable to give extra “space” between the smaller value and the lowest value.

Based on the reading from the serial monitor in the picture below, my maximum value is 112, so I used the number 70 for my “largerValue” variable.

I chose these values somewhat arbitrarily as there is no perfect number for these variables.


After you have the “smallerValue” and “lowerValue” variables set, re-comment the lines that you previously uncommented.


At this point you should be all set. After the Arduino has had some time to collect data, you can try printing it out in the serial monitor as described below.

Total Cost of Electricity Used

If you open the Serial Monitor, type “c”, and hit enter, you will get the total cost of the electricity you have used since the program was last restarted.

Graph of KW Used per Hour

If you open the Serial Monitor, type “a”, and hit enter, you will be given the power usage data from when the program was last restarted.

You will need to first click and drag to highlight the data then use the keyboard shortcut ctrl+c to copy the selected data. Both the x-axis and the y-axis data can then be pasted into a graphing program (i.e. Excel) using this method so that it can be graphed.

Graph of Cost per Hour

If you open the Serial Monitor, type “s”, and hit enter, you will be given the cost of the electricity you have used per hour starting from when the program was last restarted.

You will need to first click and drag to highlight the data then use the keyboard shortcut ctrl+c to copy the selected data. Both the x-axis and the y-axis data can then be pasted into a graphing program (i.e. Excel) using this method so that it can be graphed.


I broke the schematic into three different sections to make it easier to follow.

Photoresistor to Arduino

This first section shows how to wire the photoresistor(LDR) to the Arduino.


Connecting the Laser to the Arduino

Here’s how to wire the laser to the Arduino. The Arduino Duemilanove has a 1K ohm resistor built into pin 13. If you were to use a different pin, you would need to add a resistor.

You will need to modify a laser pointer so that it can be connected to the Arduino. This instructable is the one I myself followed when modding mine.


Disabling the Auto Reset

This next part adds a 110-124 ohm resistor to the Arduino’s reset pin (Such a resistor will likely be hard to find, so you will have to make your own by combining different values).

This will keep the Arduino from auto resetting when opening the serial monitor. That way, if you have a power supply for your Arduino, you can turn off your computer without losing the data stored on your Arduino next time you open the serial monitor.

Make sure this circuit is disconnected when you upload the sketch because doing so requires a reset. It won’t hurt anything, but the upload will fail with it connected. Note: More info on keeping the Arduino from resetting can be found here.


Here are a couple of pictures of the assembled circuit. There isn’t really much to see as half of it is outside where the electric meter is. I ran speaker cable out to the electric meter to span the distance between it and the Arduino.


You can see how I set up a breadboard for the resistor combination that keeps the board from resetting. That way I can easily disconnect it when uploading a sketch. You could even add a switch to do the same job.



Here are a few graphs that I made from the data logged from the Arduino. These graphs show “time” on the x-axis and “cost per hour” on the y-axis in cents.


This first graph shows the power usage when the dryer is being used. Notice how it starts out at about 5 cents per hour and quickly jumps up to 50 cents per hour when the dryer turns on. The dryer is one of the most expensive appliances in your house to run.

It is interesting to see how the dryer’s thermostat turns the heating element on less and less frequently as the clothes dry out.


Water Heater

Here is a graph of the water heater’s power usage. This one starts in the middle of the water heater’s on cycle. At the end you can see how far down the graph jumps down when the water heater turns off. You can see that, like the dryer, the water heater uses a lot of power.


11 Hours of Data

Here is one last graph which shows 11 hours of electricity usage at my house. You can see that the typical cost is actually less than 5 cents per hour, but things like the clothes dryer and water heater turn on periodically and bring it up a lot more.


Subscribe to my Feed!