Simple Arduino Home Energy Meter

268K744115

Intro: Simple Arduino Home Energy Meter

I was walking through the hardware store the other day and I walked past an energy meter which clips onto your home’s electricity mains and then provides you with information on your power consumption and cost estimates for the month. I thought it looked really cool until I saw the price, it was almost five times what I thought it would be! So I decided to try and build my own and Arduino was the perfect platform for it.

I had a look around online at what others had done but they all seemed to be a bit over complicated for a simple home application. Sure, for perfectly accurate measurements you need to monitor both the supply voltage and current but for simple household monitoring which gives estimates cost to the closest few cents, why not keep things simple.

So this meter measures the supply current to your home through a CT (current transformer) and then does a couple of calculations to give you your current, power, maximum power and kilowatt hours consumed. Its also really easy to add your local tariff and display the cost of electricity used to date.

This project assumes you know the basics of Arduino programming, otherwise read our article on getting started with Arduino, and that you know how to connect an LCD screen to an Arduino.

STEP 1: What You Will Need for a Home Energy Meter

Here is a list of the items which you need in order to complete this project. The LCD screen is optional, it is obviously useful if you plan on permanently installing or using your energy meter however you can just make use of the Arduino serial interface to display the information.

  • An Arduino (Uno used here)– Buy Here
  • LCD Shield (Or LCD Screen, follow how to connect an LCD screen)– Buy Here
  • CT - Talema AC1030 or SCT-013-000 – Buy Here
  • 56Ω Burden Resistor– Buy Here
  • 10µF Capacitor– Buy Here
  • 2 x 100K Divider Resistors– Buy Here

The CT was selected based on a small household and should be suitable for most houses, if you cannot get the same one then you will need to adjust the burden resistor accordingly (details on resizing the components can be found in this link under the Choosing Different Components heading).

STEP 2: Assemble the Components

First you need to start by assembling the components onto the CT or onto your breadboard in order to create your current sensor which produces a signal which your Arduino can understand. An Arduino only has analogue voltage inputs which measure 0-5V DC, so you need to convert the current output from the CT into a voltage reference and then scale the voltage reference into a 0-5V range.

If you are going to be installing your power meter somewhere permanently then you may want to solder the resistors and capacitor directly onto the CT so that they cannot come loose. If you are simply trying this project for fun then a breadboard is perfect.

The basic circuit for the connection of the CT to the Arduino is shown in the images attached.

The LCD screen shield already picks up on the analogue inputs but only A0 is used by the shield. Simply solder the three leads from your current sensor onto the pin headers on the shield and use A1 as your sensor input as shown in the attached image.

Once you have connected all of your components, you need to connect your sensor onto what you want to monitor. If you are wanting to monitor a couple of appliances then you should connect the CT onto the input lead of a multi-plug, anything you plug into the multi-plug with then be counted. Alternately, you can connect the CT directly onto your home’s mains supply and monitor the whole houses usage as has been done here. Either way, you need to put the CT around one of the supply cables, preferably the red “live” cable. Be sure to only put it around 1 as it will not work if it is around both and it can’t be connected around the earth wire (yellow, green stripped wire) as energy is not drawn through this wire. If you are connecting it to your mains, connect it to one of the output wires after the main breaker.

NB – Be careful when connecting the power meter to you homes mains and make sure that the power to your board is switched off before doing anything in the mains box. Do not remove any wires or remove any screws before checking with your local authority, you may require a certified electrician to install the CT for you.

STEP 3: Upload the Sketch

Now you can upload your sketch onto your Arduino, if you haven’t uploaded a sketch before then follow this guide on getting started.

The code is shown in the attached images, here is the link to download the Energy Meter code.

Because your setup, CT , resistors and input voltage may be different, there is a scaling factor in the sketch which you will need to change before you will get accurate results, see next steps for calibration. If your LCD is connected to the same pins as used here and your CT is connected to the same input pin, you should at least get the screen populated with some figures although these will most likely be incorrect and some may be negative.

If you don’t want to use or don’t have an LCD screen, you can also modify the sketch to output to the Arduino IDE’s serial window as shown in the second image.

Here is the link to download the Energy Meter Serial Output code.

STEP 4: Calibrate the Current Reading


As mentioned above, because your setup, CT , resistors and input voltage may be different, there is a scaling factor in the sketch which you will need to change before you will get accurate results.

To calibrate your energy meter, your need to be sure that the current that your meter says is being drawn is what you expect is actually being drawn. In order to do this accurately, you need to find a calibrated load. These are not easy to come by in a normal household so you will need to find something which uses an established and consistent amount of power. I used a couple of incandescent light bulbs and spot lights, these come in a range of sizes and their consumption is fairly close to what is stated on the label, ie a 100W light bulb uses very close to 100W of real power as it is almost entirely a purely resistive load.

Plug in a small light bulb (100W or so) and see what load is displayed. You will now need to adjust the scaling factor uses in the calculation line:

double RMSCurrent = ((maxCurrent – 516)*0.707)/11.8337

In this case it was 11.8337, it may be higher or lower depending on your application. Either use linear scaling to calculate this figure or, if you’re not good with math, play around with different values until the load you have plugged in is shown on the energy meter’s screen.

Once you have your energy meter calibrated, you reset it and leave it to do its job.

The first number displayed is the instantaneous current followed by the instantaneous power. On the bottom line, the kilowatt hours used since reset and then the maximum recorded power since reset.

Let us know if you have made this project or done something similar. We're always looking for quicker and easier ways to do things. Leave a full review in the comments section at this link to have some of your ideas added to our page.

STEP 5: Autodesk Circuits Diagram & Simulation

Please note that Autodesk Circuits doesn't support a current transformer. A signal generator has therefore been used to generate an example signal however it is not really suitable for the application, therefore the displayed energy consumption is erratic, in practice this does not occur.

90 Comments

My CT came fitted with what looks like a 1/8" male audio connector. My first thought is to delete the connector, separate the conductors and connect them directly to my Arduino inputs. Will that work? Just need to correctly identify the + and -, I would imagine.

Could this be modified to monitor both mains lines to get a reading for whole house usage? As written, it seems thst it would only measure one side of my breaker box. I would be most interested in monitoring both sided

Hi Mikenaly,

Your mains line has two wires connected to it to form a closed circuit, the current essentially flows in through one wire and out through the other wire. You therefore only need to measure the current through one of the wires to get the whole houses consumption. You can try this by connecting up two meters, one to each wire and you should get the same measurement on each.

In America we will have three wires, not two. Two 110/120 and a neutral. Run the two lines through the ct in opposite directions and you will be accurately reading both wires at the same time.
The principle of CT is to use an Electric field surrounding a current carrying conductor. If both the conductors are used together, their effects would cancel each other out.
Not if they pass through the ct in opposite directions.

Hi, In my country we also use 2 phases (110V each) AND neutral. The 2 phases are being used for 220V equipment. So how to setup power measurement for whole house now? I can't simply measure neutral cuz for my 220V equipment current doesn't flow through neutral.

Run one through the ct in one direction, the other one in the opposite direction. You might need a larger diameter ct.
Cand reading 2kw . ? This project
Don't you need to measure the voltage to get accurate readings? Also, what do you recommend to test this on if I can't access a home circuit breaker?

hi, here in Canada like in the US we use two phases of 110V each. So to measure power accurately I would need to CTs. Can you suggest some and also let me know how the connections and code would change for handling two CTs?

best regards from Gatineau, QC

sorry bud.. 120v has been standard in the US nation wide since 1967..
its 120v or 240v now.
do they really still use 110v in Canada?
Hi JofejemaP,

I could be wrong but I don't think you have two phases. You have two supply cables (live and neutral) which make up a single phase, you only need a single CT on one of the two wires. To modify the code for 110V, you just need to change the line with 220 to 110, everything else stays the same. Hope this helps.

Hi, In my country we also use 2 phases (110V each) AND neutral. The 2 phases are being used for 220V equipment. So how to setup power measurement for whole house now? I can't simply measure neutral cuz for my 220V equipment current doesn't flow through neutral.

You could either buy to transformers or tap the neutral. You only need to monitor both phases if you have something that runs on 240V, in that case the electricity flow between the two phases and not through the neutral. If you don't have any 240v socket just use the neutral: everything that "comes" from both phases will flow trough the neutral.

hi, the first thing I would like to monitor is the power usage of my electric water heater (60 USg, 4500W, 240V). it is at the end of its useful life and I must decide to stay electric or go natural gas. I will get the two CTs as you suggested,
thanks
Hi! I followed your instructions, connected the sensor to just one of a power strip chords, yet it show wattage even when no consumer is plugged (144-170Watts). Why is that and how can I make it right?
I've followed your instructions very carefully. I've tried the calibration and it works fine when I use a 40 watts bulb. Then I plug in another bulb and my calibration is way off (60 watts). I've also tried other devices to measure and I keep recalibrating. I've tested my voltage with a meter and all, so I'm wondering what I'm missing.

The second issue is I get a spiked reading everytime I start. This means my Peak Wattage is always off at the start. Should we be debouncing before the first reading ?

Otherwise the project is great. I'm planning on using this sensor with my GAS Generator as an indicator of AMPS and WATTAGE consumption.
Can you show me your diagram ? Because im having a hard time. Mine didnt work at all
Hope this diagram helps. I'm still having troubles with calibartion. Every time I change the wattage source, I need to recalibrate as the readings are off. Not sure what I'm doing wrong.
More Comments