Introduction: Simple Arduino Home Energy Meter

Picture of 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

Picture of 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

Picture of 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

Picture of 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.

Comments

ajayt7 (author)2017-08-22

So for whole house use the main conductor , Phase wire, for metering

ajayt7 (author)2017-08-22

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.

mikenaly (author)2017-03-15

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

thediylife (author)mikenaly2017-03-17

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.

Michael JohnG (author)2017-03-14

hi, what do you mean for “RMS”current andd “RMS”power ??

thank you..

Michael JohnG (author)2017-03-04

hi do you use a current sensor here an ACS 712?? tnx

thediylife (author)Michael JohnG2017-03-05

Hi Michael JohnG, I've replied to your comment with some details on my blog.

bfcmartins1 made it! (author)2017-01-20

Thank you for sharing the excellent project.
I followed the project step by step and read all the comments to see if I was doing something wrong and I think everything is the same as your project.

I chose the resistors to have a reference voltage value of 2,5V, and I used 50Ω Burden Resistor. 100µF Capacitor
In summary, I'm having difficulty calibrating, can you explain the formula better RMSCurrent = ((maxCurrent - 516)*0.707)/50.8337, Every field you are referring to, for me to understand.

I'm using YHDC's SCT013.

I appreciate any help you can give me

best regards,

Bruno

thediylife (author)bfcmartins12017-01-21

Hi Bruno,

Great work, it looks good. The burden resistor you have used is correct, the 100uf capacitor is correct, have you also used 100K divider resistors?

I see your screen is displaying a current reading which is a good sign, does this current reading change if you increase or decrease the power being used? If it does then everything is working correctly with the hardware, so as you say it's just the software calibration.

To calibrate your meter you need to use a load of fairly well known power consumption. Something like an old 100W or 200W incandescent light bulb is perfect. Hook the CT up to that and now your goal is to get the screen to display the lightbulb's rating (100W or 200W). This is done by changing the last value in your line - 50.8337 in your case. Increase this value if your displayed power is too high and decrease it if it is too low.

If you are still having trouble, make the 50.8337 = 1 in the code and see what your screen displays as the power. Lets say for example you are using a 200W light bulb and the screen says 8567W as the output (with the 50.8337 replaced by 1). Now take 8567W / 200W = 42.835 and this is the calibration value you should put into your code.

This should be sufficiently accurate to start with. Once you get this working then play around with a number of different range loads, from 100W to 5000W and calculate all of their calibration factors as we did above. Take the average of all of your results and use that for a more accurate reading over a range of powers.

Hope this helps!

JofejemaP (author)2016-11-24

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

nicolasumaras (author)JofejemaP2016-12-03

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.

JofejemaP (author)nicolasumaras2016-12-05

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

thediylife (author)JofejemaP2016-11-24

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.

Kaballasx (author)2016-11-20

I found this very interesting. But what if you have solar power and push power back into the grid. How would you measure the power you push back into the grid and what power you are puling from the grid.

An alternative to multiple current transformers would be to measure the voltage as well as the current. Doing this means you can save money by not using multiple CTs while still being able to determine whether you are pulling current from the grid or feeding current to the grid. It has the added advantage of also giving accurate results when you are running inductive loads (such as a washing machine or heat pump). The downside is that it is a little more complicated as noted above. Here is an explanation for one that I use on a home with solar panels.

https://openenergymonitor.org/emon/buildingblocks/...

Hi asheville makers,

I like your idea to monitor the voltage, it's a nice simple solution. It's really easy to put a voltage measurement into the code and that will give you a more accurate "real" power reading especially when used with digital electronics.

thediylife (author)Kaballasx2016-11-21

Hi Kaballasx,

I would put 3 CTs in, one on the grid supply, one on the solar power inverter supply and lastly one on the houses mains input. You can then use some Arduino logic through summing to determine the proportions coming from each source. Alternately, if the solar supply is higher than the houses demand then the difference must be going into the grid.

swingzazou (author)2016-11-17

Hi,

Thank you for this instructable.

Sorry, for this question but i'm a beginner : why choose 2.5v for reference and not GND ?

Thank you very much.

thediylife (author)swingzazou2016-11-17

Hi swingzazou,

Because we are measuring AC current, the current transformer gives us a waveform which oscillates positive and negative. If we use ground as the reference then we will only measure half of the waveform (and put an inverse polarity voltage onto the Arduino input). So we create a reference at 2.5V so that the voltage stays positive with 2.5V effective being equivalent to the zero volts line. Does this make sense?

swingzazou (author)thediylife2016-11-18

Yes ! I understand better now this choice. Thank you very much !

scientist1995 (author)2016-11-17

i didnt understand how you have connected the current transformer any pin diagram or connection that would really help me out thanks for making this project you can also email-me schematic shahsoumil519@gmail.com

or mail me at soumil.s@somaiya.edu

please i really want to make this project!!!!!!

only part i didnt understand was ct pasrt and its connection

thediylife (author)scientist19952016-11-17

Hi scientist1995,

There is a connection diagram in the images in the second step. You don't connect the current transformer directly, it requires some resistors and capacitors to condition the signal.

There are essentially three connections to the Arduino, to gnd, to 5V and to an analogue pin, pin1 in this case.

Captain Jim (author)2016-11-16

I would really like to see a monitor like this for 12v DC system for all those boat and caravan people out there. Any tips or pointers?

MichaelM350 (author)Captain Jim2016-11-16

dont forget that with a 1 ohm resistor, dc voltage and amperage are the same, definitely the easiest way to measure high current dc

Captain Jim (author)MichaelM3502016-11-17

Hi thank you so much. I have ordered the part from Pololu. Once everything has arrived I will have ago.
Awesome instructable, awesome comments back- I will be sure to follow your other projects : )

thediylife (author)Captain Jim2016-11-17

Hi Captain Jim,

That's great, let me know how your project turns out and feel free to mail me if you have any problems/questions with the DC version. I'd love to put it onto my site as well, if you are interested of course.

thediylife (author)Captain Jim2016-11-16

Hi Captain Jim,

To build a D.C. monitor for a battery system, you would need to measure voltage (this varies quite a lot with the battery charge cycle) and current.

The voltage measurement you can take with a simple voltage divider circuit, similar to this one but with a 12K and 5K resistor to scale the 15-6V max to 5V at the Arduino input.

The current input you'd need a shunt. This is essentially a really low resistance resistor which the voltage drop across is measured. You can buy premise current sensing chips with the shunt and circuitry designed for Arduino use pretty cheaply. Have a look at this one: http://www.pololu.com/product/1186

laz7591 (author)2016-11-16

Hi,

would you attach some pictures or some explanations (just for rookies) how your final application looks like? How do you attach the target cable to the CT? Do you stitch the wire thru the CT, so it is a 'hard-wired' solution?

I havnt found the link (on http://www.the-diy-life.com/) to the alternate CT options.

Regards Laz

thediylife (author)laz75912016-11-17

Hi laz7591,

I have subsequently added some alternate CT's and their corressponding resistor values: http://www.the-diy-life.com/simple-arduino-home-energy-meter/#different-cts

laz7591 (author)thediylife2016-11-17

Hi,

thanks a lot, helped a lot!

thediylife (author)laz75912016-11-16

Hi laz7591,

I have added a picture of the CT installed on my main feed in step 2. The main wire goes through the CT, no further connection required. Some CTs have a split and can be fitted over the wire and then snapped closed, these are easier to install and don't require any tinkering with wiring or screws.

There is no information on alternate CT options, it is a section on how to calculate the burden resistor size for different CTs and this is roughly halfway down the page under the heading choosing different components. If you have a couple of CTs you would like to use in mind, give me the part numbers or links and I'll do the calcs and put those in a list under that heading as well, that would be a nice addition to the page.

paul.hadley (author)2016-11-16

Very interesting. Its a simple but useful project. For some time I wanted to measure the import/export energy from my 2.4Kwp solar panel system, but true import/export meters are not available,

It will need 3 sensors: A current from the utility company, B current from the solar invertor into the fuse board, C current into the house from the fuse board.

If B >C the solar panels are generating more than the house uses; so A is the export power to the grid.. This is good.

If B<C the house is using some power from the grid and some from the solar panels; so A is import power from the grid.

The display could show the solar power and house power. Then Import or Export power and a red/yellow led; red means taking power from grid, yellow means solar power is feeding the grid.

The yellow led means its a sunny, happy day and we are exporting power to the grid! It also means its a good time to charge batteries or run the washing machine/dish washer to consume some of the export power.

-Paul

thediylife (author)paul.hadley2016-11-16

Hi paul.hadley,

That sounds like an awesome application for it, you could really do a lot with that information. I'm thinking you could even do "load management" by driving relays from the Arduino to turn on/off appliances such as the dishwasher or washing machine when there is power available from the solar panels. You could also integrate the Ardunio into your charging circuit to only charge the batteries when there is excess power and feed the grid when the batteries are full.

paul.hadley (author)thediylife2016-11-16

theDiyLife,

Thanks - we would need split core CTs for safety and practical reasons. Clipping onto a wire is fairly "idiot proof", but disconnecting a Live wire is potentially dangerous, especially around a fuse board.

There are plenty of YHDC clip-on CTs available on eBay; calibration will be different of course. Yes you are correct, automation of building control has great potential now that so many buildings have solar power. But I have a feeling the happy yellow leds will be easy for everyone to understand! (without explaining Kirchhoff's Law lol).

iARRIVE (author)2016-11-16

Hello Sir,

Can i change the sensor with ACS712 ?
Thank You.

thediylife (author)iARRIVE2016-11-16

Hi iArrive,

Yes you can use the ACS712 however the interface and circuit would be different. There's no need for the burden resistor or divider circuit. The software would also be different as the Arduino would receive a proportional signal and won't have to do any calibration or RMS calculation.

PhilS43 (author)2016-11-15

The nice thing about doing your own metering is that you get what you want, not what the utility company wants. I have tried several commercial energy monitors and they are frankly rubbish and a waste of money.

There are alternatives to CT's and Allegro do a wide range of IC's, some Hall effect, some specialised.

I monitor all the utility meters, electricity by optically picking up the 1-Watt LED, and a Sparkfun sound board to pick up the relay clanking when it goes from night rate to day rate - water and gas use the built-in magnets to trip Infineon TLE4913 Hall switches.

XBee Series 2 modules provide the wireless links, sleeping for 5-minutes or a pin wake-up when the sensors trip. XBees have plenty of spare IO's for temperatures, floods etc. Two "C" cells in series provide the power and the XBee monitors the voltage - estimated lifetime on battery is two to three years.

If you want to go up a notch on the CT, LEM do a nice range of split core devices with all the signal conditioning on board.

The tricky bit with XBee's is getting to grips with the API's and data frames, but Digi's support (XBee manufacturer) is first class and they have free software called X-CTU which makes configuring straightforward

thediylife (author)PhilS432016-11-15

Hi PhilS43,

Thanks for the ideas. I like the optical and sound pickup ideas for the rate changeovers. In my area we have fixed rates day or night so I didn't have to worry about that.

I will definitely look into the XBee modules, I've never really used them but they seem to be quite powerful, especially where you need extremely low power consumption to preserve battery life.

PhilS43 (author)thediylife2016-11-16

DIY

In UK there are cheaper night rates and the meter has a radio controlled relay that changes over at, say, 00:30 GMT until 07:30. I don't trust the utilities not to tweak the times.

There are pro's and con's with XBee's - con's - expensive (£20 a pop) - pro's - easy networking and extensive Digi support - with Zigbee, the API, a full meshing network is easy to do and as they all talk to each other, the network is self-healing, the more you have, the more reliable the network.

Recommended read is Faludi - Building Wireless Sensor Networks and Packt publishing have some XBee and home automation books.

Also recommend looking at OpenEnergy website or DesertHome.

Winding your own coils is OK, but you need to calibrate somehow - an easy way is to use a purely resistive heater element like a kettle or one of the old style "bar" heater ceramic elements at 1 to 3 kW.

thediylife (author)PhilS432016-11-16

Hi PhilS43,

I think most countries work on day and night rates, we only have usage limitations for industry (peak demand etc.).

Yes, the XBee's are quite a lot more than the Arduino boards. Thanks for the information and resources, I'll definitely have a look at them. I've been interested in building a Raspberry Pi based home automation system, maybe this is a task for the XBee.

joergeli (author)2016-11-14

Hi thediylife,

well done!

I also like to monitor the power consumption of our house.

I´m using another principle: I´m counting the surroundings and speed of the turntable in the main power meter (75 surroundings = 1kWh). Every time, when the red marker on the turntable reaches an infrared reflex light barrier an interrupt on the arduino is triggered and the actual consumption (in kW) is calculated and send over an ethernetshield to my website.

There some PHP-code calculates the daily, monthly and yearly consumption. Also the current time of the webserver is added as time-stamp. After that these values are visualized as a chart (with amCharts).

I´ve added some photos and the math on my (german) website: http://arduino.joergeli.de/stromzaehler/arduino_stromzaehler.php

Actual power consumption you can see here:

http://joergeli.de/0_strom/stromverbrauch.php

This might also be an additional alternative for you?

Greetings from Germany

Jörg



thediylife (author)joergeli2016-11-15

Hi joergeli,

That's a great idea counting the turns on your built in meter and that way your actual utility bill and estimated bill should be the same. Unfortunately I live in an apartment and the meters are locked in the basement so I don't have access to mine.

I love your web page which shows the real time consumption and trends, looks like you have really put a lot of effort into it! I must have a look at connecting my meter up to my site.

RobertS48 (author)2016-11-15

Doesn't this actually measure VA not Watts?

Volts * Amps = Volt Amperes = Apparent Power

Volts * Amps * Power Factor = Watts = True Power

So if you are measuring the power usage of an incandescent light bulb its power measurement might be fairly accurate, but on a computer or TV it will not be.

thediylife (author)RobertS482016-11-15

Hi RobertS48,

That's correct, it does measure VA but for the layman using this as a home energy meter they are quite comparable.

Your statement about the lights and computers is correct. Any highly capacitive or inductive load will produce inaccuracies however if you look at the main power consumers in a household, these are mainly the stove, oven, water heaters, lighting etc, all almost purely resistive loads which have close to unity power factors therefore VA and Watts will essentially be the same. If you are running a lot of compuets or digital equipment then it would make sense to measure the line voltage as well and take the power factor into account.

jrd210 (author)2016-11-15

great idea, looks all straightforward except the transformer CT as I live in rural Canada and am wondering about practical alternatives and an easy site to obtain a CT at least within the USA or Canada?

thediylife (author)jrd2102016-11-15

Hi jrd210,

For an AC application, a CT is really the most simple way but they are a common electrical component so you should be able to get one shipped to your address. Even ebay has them available. The are some other hall effect etc options but you'll still have to have them shipped to your address and they'll be more difficult to get hold of.

If you really can't get hold of one then as jtechian says, you can make your own by coiling wire around the feed wire.

TomC162 (author)jrd2102016-11-15

Digikey offers the CT for $11.47 (CAN). Here's a link:

http://www.digikey.ca/product-search/en?keywords=Talema%20AC1030

jtechian (author)jrd2102016-11-15

If you want to DIY a simple current transformer, Simply wind some wire around the feed wire with enough turns to produce a measureable voltage when current flows. Then you can adjust the calculations within the Arduino code. :)

Nemirtingasis (author)2016-11-15

You do not need to calibrate if you will use very popular and cheap acs712 module, you can choose from 5 to 30A model, with this sensor you don't need rectifiers and pullup resistors.

thediylife (author)Nemirtingasis2016-11-15

Hi Nemirtingasis,

I never seen that chip before but it looks like the right kind of solution. It would definitely make the code a lot simpler. Thanks.

About This Instructable

72,873views

608favorites

License:

Bio: The DIY Life is all about your next project. Be it a project to make improvements to your home, something fun to do or guiding ... More »
More by thediylife:DIY Designer MirrorOff Grid Van Power Information SystemSuper Easy 9V Emergency USB Charger
Add instructable to: