Introduction: Arduino Home Energy Monitor Shield

Picture of Arduino Home Energy Monitor Shield

Although products are becoming more and more available for monitoring your home power usage, I'm one of those idiots who can't leave well enough alone and who would rather shell out $100 and hours of my time in order to save $20 and learn something in the process.  Building on the fine work of Trystan Lea and others at as well as various and sundry web sources and acquaintances the result is a self-contained Arduino shield for monitoring the energy usage of your home using clamp on current transformers, an ethernet shield, and an Arduino. The resulting Energy Monitoring Shield has a built in switching power supply and with mains voltage (120VAC in the US) to the board can do power factor correction as well.  With mains voltage to the board it is also more dangerous than your typical home electronics project and as such has been rejected for distribution by commercial maker outlets like adafruit and sparkfun.  So take that as a warning, and if in doubt, keep one hand in your pocket and out of puddles when handling the board.

In simple terms, the power monitor shield provides an AC to DC power source for the Arduino and Ethernet Shield, samples the AC voltage waveform for power factor correction, and uses the current transformers to measure current draw of branch circuits in your home breaker box.

* Connectors for easy integration with clamp on current transformers
* Built in 120VAC to 5VDC switching power supply for powering Arduino and Ethernet Shields
* Monitor up to 5 branch circuits at once, of which up to 3 can be two wire single phase 240VAC
* Power factor correction for power measurements
* Code interfaces with Pachube (now COSM) internet of things for data presentation
* Makes your breaker box a mess

DISCLAIMER:  This project requires working with 120 and/or 240VAC, which can kill or seriously injure you if you are not careful.  Please be aware of and follow all applicable safety practice, electrical code, and Geneva Convention guidelines.

Step 1: BOM

The BOM (bill of materials) for the energy monitor shield is below and also attached as a txt file output from EAGLE.  In addition you will need suitable current transformers such as:
30A split core clamp on current transformer
100A non-invasive AC current sensor

If you need a larger  current transformer for getting around the main house service wires (big thick ones) you can get bigger sensors such as:
Split-Core AC Current Sensor SCT-0750

If you go with a current transformer that does not have a 1/8" phono end connector on it you will also need to source and attach them.  You can get these from cutting off old headphones, or from Radio Shack, Ax-man for those distinguished enough to have the means, or elsewhere.

It should be noted that the values for a lot of the resistors below depend on the current sensors and measurement ranges you desire to measure.  Read up on the web on current transformers for more information.

Part Value Device Package
C1 10u C-USC0805 C0805
C2 10u C-USC0805 C0805
C3 10u C-USC0805 C0805
C4 10u C-USC0805 C0805
C5 10u C-USC0805 C0805
C6 10u C-USC0805 C0805
C7 330u CPOL-USE3.5-8 E3,5-8
C9 2200u CPOL-USE5-13 E5-13
JP1  PINHD-1X2 1X02
JP2  PINHD-1X2 1X02
JP4  PINHD-1X2 1X02
JP5  PINHD-1X2 1X02
L1 330u L-US6000-XXX-RC 6000-XXXX-RC
R1 10k R-US_M0805 M0805
R2 10k R-US_M0805 M0805
R3 10k R-US_M0805 M0805
R4 10k R-US_M0805 M0805
R5 100 R-US_M0805 M0805
R6 10k R-US_M0805 M0805
R7 10k R-US_M0805 M0805
R8 100 R-US_M0805 M0805
R9 10k R-US_M0805 M0805
R10 10k R-US_M0805 M0805
R11 100 R-US_M0805 M0805
R12 10k R-US_M0805 M0805
R13 10k R-US_M0805 M0805
R14 100 R-US_M0805 M0805
R15 10k R-US_M0805 M0805
R16 10k R-US_M0805 M0805
R17 100 R-US_M0805 M0805
R18 10k R-US_M0805 M0805
R19 10k R-US_M0805 M0805
R20 100 R-US_M0805 M0805
R21 100 R-US_M0805 M0805
R22 100 R-US_M0805 M0805
TR1  EI30-1 EI30-1
U$2 LM2575 LM2575 TO263-5

Step 2: Schematic and Board

Picture of Schematic and Board

Attached to this step are the EAGLE schematics and board layouts for the Arduino energy monitor shield as well as PDFs for printing and using the toner method for etching your own PCB.  You can use the EAGLE files to get a professional board made or you can email me and see if I have any on hand for sale.  Note that if etching your own board, the through hole parts will be a bear to solder since the vias aren't plated and the traces are on the same side of the PCB as the components which is not standard through-hole practice.  With a professionally made board with plated vias this will not be an issue.  If you care to you can redesign the EAGLE board file to run the through-hole traces on the bottom to ease soldering and assembly from a hand-made PCB.

Step 3: Code

The presented code is a conglomeration of a variety of open sourced, non-commercial code from the Arduino libraries, myself, Trystan Lea, Eric Sandeen, and others.  It is attached below.  It is somewhat commented, but if you have questions please ask. 

Step 4: Mod the Analog Input Pins

Picture of Mod the Analog Input Pins

As presented, using the older (05 or v5) Ethernet shield and Arduino, you need to perform a few mods on the store-bought hardware to get the power monitor shield to work.

First, on the Ethernet Shield you need to cut the traces from the A0 and A1 analog input pins to their pullup resistors for the SD card. You can do this with a dremel cutoff wheel, a knife, or similar. The newer official ethernet shields (06 or v6 and newer) don't appear to require this mod, so look at your board before cutting it up willy-nilly. A good resource is this atlas of Ethernet Shields.  In the attached pictures you can see that for the 05 or v5 Ethernet Shield board you need to cut the traces from A0 on the bottom of the PCB and A1 on the top of the PCB.

Step 5: Mod the Reset Pin

Picture of Mod the Reset Pin

Secondly, I implemented a software reset of the Ethernet Shield using D9 on the Arduino since I was having trouble with the Ethernet Shield locking up and failing to update the Pachube/Cosm feed.  The fix presented increased the interval between lock-ups but didn't really fix the problem so you can skip it if you like. The newer Ethernet Shields may not have this problem or it may be the code has a memory leak. I don't know, as I am much more used to a real embedded development platform that has true debugging tools and I just couldn't be bothered with trying to munge with the lightweight Arduino environment. It works as is but you have to power cycle the whole thing every month or two.  The fix requires that you bend the reset pin on the Ethernet Shield so that it does not mate with the Arduino connector.  See pic.  Then solder a wire from the bent reset pin to the D9 pin on the other side of the Ethernet Shield.  You also need to cut the "RESET" pin on the Ethernet Shield ICSP header as pictured to allow the Ethernet Shield to be reset separately from the Arduino using D9.

Step 6: Mod the Power Monitor Shield

Picture of Mod the Power Monitor Shield

Depending on your installation needs, you may need to change the configuration of the Power Monitor Shield. The two main configuration options on the Power Monitor Shield are the burden resistor, which is used to set the scaling factor for the current to voltage conversion, and the single or double branch jumper which selects a single or double pole (120VAC or 240VAC in the USA) configuration. When measuring current from a double pole breaker (main supply, AC, electric range, etc) you will need a current transformer on each branch wire and need to use two of the 1/8" jacks on the Power Shield PCB. For example, 1a and 1b in the picture below. Placing a jumper on the two-pin headers between the 1/8" jacks on the Power Monitor Shield will combine the signal from the two current transformers in series to allow power measurements for a 2-pole breaker.  The jumpers are highlighted with arrows in the image below.

If only using a single current transformer then leave the pins open (unjumpered) and use the first 1/8" jack (viewed from top, counterclockwise), leaving the second jack open. For example, use only 3a and leave 3b and its associated jumper open.  Jacks 4 and 5 are single pole only due to space constraints but you could mod my board layout to allow all 5 measurement circuits to be 2 pole if you wish.

The burden resistors are all set to 100 ohms on the schematic as shown and depending on the current transformers or desired currents measured will need to be altered according to the formulas shown at For example, I had to lower the burden resistor to 10 on the large main supply current transformers, 49 on the 100A clamp-on CTs, 60 on the 30A clamp-on CTs run in 2-pole, and left the 30A clamp-on CTs in 1-pole mode as 100 ohms.

Step 7: Install

Picture of Install

With your Ethernet Shield modded and your code ready to go you can program your Arduino and stack up the shields.  Put the Arduino on the bottom, then the Ethernet Shield, then the Power Monitor Shield.  Using a suitable enclosure, mount this assy near your breaker box, usually in the basement.  Run a hot, neutral, and ground wire to the enclosure, grounding the enclosure, and running the the hot and neutral wires to the screw terminals on the Power Monitor Shield.  (see schematic) Be sure that the power circuit powering these wires is off during this procedure. Next, run your clamp on current transformers to the desired power circuits. Note: do not clamp the current transformers over the wires unless the 1/8" plug is plugged into the Power Monitoring Shield.  This is because the current transformer will generate a large voltage if not terminated to the measurement and burden circuit. Put the main large current transformers over the large main supply wires, when using the clamp on transformers over a 240 circuit, be sure to have one transformer out of phase of the other, as in turned 180 degrees from the other branch or your power measurements will cancel out. Similarly, if you are getting negative power values, turn your clamp-on CT 180 degrees on the wire.

You will also need an ethernet jack and cable or a long cable from your router/switch to plug into the Ethernet Shield. A wi-fi shield may be a better choice if you can't get a network jack nearby, but I can't provide any help there.  Search the net and I'm sure someone has done it.

Now, power up the breaker that your monitoring system is wired to, and hopefully you see the LEDs on the Ethernet Shield light up and no magic smoke. Check your Pachube/Cosm feed to see if you are getting data. You should start seeing data pretty quickly (less than 5 minutes) and updated every minute or so. Use the USB port on the Arduino and your laptop to view serial data from the Arduino to troubleshoot.

With everything working, you will want to calibrate the system.  Depending on the circuit being monitored, you should plug in a known load into the circuit and see what the Power Monitor reports to the server.  You can do this via the Pachube/Cosm website or the serial output of the Arduino environment using the USB connection. It is easier to use the USB connection to a laptop reading the serial data if you can. I used a resistive load as a calibration measurement, it was a simple single burner hot plate which was a 650W load when on HIGH.  I measured the load and power factor using a P3 Kill-a-watt meter and then adjusted the scaling factors in the Arduino code until they matched.  Adding a less than unity power factor load to the calibration regimen is a good idea if you can, such as a switching power supply or large motor.  The larger the load relative to the peak power of the circuit the more accurate your calibration will be.  In the code you should have the burden resistor values updated to your actual configuration (variable is ct_burden), you should have the turns ratio adjusted to your actual CT configuration (variable is ct_turns), you should halve the effective turns ratio for 2-pole branches (for example, put 1000 if using a pair of 2000 turn CTs), and then use the calibration constant to adjust the measurement when calibrating using the ICAL variable.


mtzmihai (author)2016-03-31

Hello there, how much current does the pcb power monitor shield drain? I'm looking into it because i can't find a LM 2575 or LM1575 at the moment at the local store and i'm thinking of using a LM 7805.What do you think guys, also if it doesn't work with the LM 7805 can you recommned me something else please?


jmengel (author)mtzmihai2016-04-01

LM7805 has the same 1A rating as the LM2575 and should work fine so go for it. Might need a TO-220 heatsink on the LM7805 but those are easy to get.

mtzmihai (author)jmengel2016-04-01

I use a 30A clamp, our national grid is at 230V 50Hz..i have a transformer 230V ro 9v unregulated to get the power factor..i reduced the circuit to only one CT and kept the rest but i can't get the code to work..can you help me pleaseeith the code only for one ct and the transformer, i don't need any ethernet, or xbee shields, i'm gonna view the results from the arduino via the connection cable on the serial monitor..
Many thanks.

VaradM5 (author)mtzmihai2017-03-31

u made it for 3-phase? did it work?

jmengel (author)mtzmihai2016-04-01

If you'd like to hire me to write the code for you at USD$150 per hour, then send me a private message. Otherwise you are going to have to DIY, it will do you good.

turbiny (author)2017-01-23

Can this be implemented in a 3 phase 220v?
How much and will you be willing to make me one?

jmengel (author)turbiny2017-01-23

Theoretically an energy monitor similar to this could be implemented on 3 phase although the timing of measurement and computing phase becomes more critical. It may require a more powerful processor and better sampling code. Not sure.

Making a one-off 3-phase energy monitor is not extremely interesting to me. The cost would be prohibitive for you. Good luck!

Jntu (author)2017-01-14

I want to automation my devices and monitor current,energyconsumed,power factor,activepower,reactive power,apparent power and tariff for powet consumed. Can I have source code for web as well as for arduino

mtzmihai (author)2016-03-31

And also i don't want so many CT's i need only one CT, how can i modify the code?

JadinA2 (author)mtzmihai2016-06-22

Here is a very basic example I made for you by hacking my code to pieces:

#include <SPI.h>

#include <Ethernet.h>

#include "EmonLib.h"

EnergyMonitor circuit_1;

EthernetClient client;

IPAddress ip(192, 168, 0, 10); //Change this to match your network configuration incase DHCP fails

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};

const char server[] = ""; // Change this to whatever server you're using

void setup() {


// start the Ethernet connection:

if (Ethernet.begin(mac) == 0) {

Serial.println("Failed to configure Ethernet using DHCP");

// try to congifure using IP address instead of DHCP:

Ethernet.begin(mac, ip);


// give the Ethernet shield a second to initialize:



circuit_1.current(1, 30); //This depends on the CT you use, I'm using SCT013


void loop() {

float circuit_1_Irms = circuit_1.calcIrms(1480) * 230 / 1000; //convert to kW

if (client.connect(server, 80)) {


/* Make your HTTP request here with

* client.print("your request here");

* you must construct your own request with headers and all.


// Wait for the server to respond and print the response to the serial console.

int count = 0;

while (!client.available()){



if (count >= 500){




Serial.print("Response took: ");


Serial.println(" milliseconds");

while (client.available()) {

char c =;



} else {

// if you didn't get a connection to the server:

Serial.println("connection failed");



Serial.print("Power on circuit_1 : ");




JadinA2 (author)mtzmihai2016-06-22

I had a look at the code, it is very bloated, I would suggest you use the emonlib from open energy monitor and instantiate a single object per analog pin you want to monitor. The way to do it in the code provided in the instructable would be to change the following lines:
#define NUM_CTS 1
#define MAX_CTS 1

AND THEN you will need to trace down all the arrays that jmengel declares, and only add a single element to them. It's a very inelegant way to do things though.

mtzmihai (author)2016-04-10

Hey jmengel, i succeded to make my configuration work flawlesly, now that i did the measurements in one phase,i want to develop it for 3 phase measurement:D


OsamaS29 (author)mtzmihai2016-05-16

can you please share your circuit and tell about what your results are obtained from your circuit. I want to get the apparent and real power for variable loads in one phase.

mtzmihai (author)OsamaS292016-05-16

If you want to measure apparent power and real power for different loads, you need more CT's(current sensors) and more current sensing circuits.For example if you have 3 different loads like(a dishwasher, electrical saw and a washing machine) you will need for each one a different CT and a different current sensing circuit, your Arduino sketch should look pretty much like mine(i measure 3 currents and 3 different voltages for each of the 3 phase) with a slightly difference: You will have 3(or more) CT and probably only one voltage sensing circuit(i'm guessing all off your loads which you want to measure are 1 phase not 3 phase).I've put on my project a Nokia LCD to show me the results(you can't use serial monitor and LCD at the same time).
Currently i'm at the office but if you give me your email i will gladly share my circuit infos and pictures of the project with you.

VirenL (author)2016-04-24

Hey, i've seen the datasheet of LM2575 and found that it needs a resistor divider to feedback the output which decides the output voltage. cause i'm using a 230 to 12V transformer so do i need those resistors???

jmengel (author)VirenL2016-04-24

Have you seen it? Because I have, and no resistor divider is needed. I suggest you read the datasheet:

VirenL (author)jmengel2016-04-25

oops!!! , i got my hands on this datasheet

maybe resistor pair is to get adjustable output voltage...

BTW thanx a lot for ur quick reply , i thought it would take a week for ur reply. Peace!

VirenL (author)2016-03-20

i've seen ur code , can u briefly describe the initial variables u declared like phasecal , Vratio etc. and how do i calculate the value of phasecal and other variables...

and btw , u've done an awesome job!

jmengel (author)VirenL2016-04-01

All of these variables serve to get from the measured values to a somewhat accurate calculated current, power, voltage value. The calibration code is essentially Trystan Lea's, and he has some explanation on his website:

For calibration, I used a large resistive load of known magnitude, a 1500W electric space heater, to load the system and then tweaked the calibration values until the CTs and code reported good voltage, current, power and power factor for the load. Good luck!

VirenL (author)VirenL2016-03-20

and i fought to mention that i'm using a CT that has inbuild burden resistor, the CT coverts 30A to 1V.

AbrahamE4 (author)2016-03-26

How can i see your code, i want to know how to calculate the phase angle

jmengel (author)AbrahamE42016-04-01

You are going to have to read the Instructable. Hint, it is in "Step 3 Code".

tgvoss (author)2015-12-01

This looks like a great project, I am interested in taking a stab at it but I am a little confused looking at the schematic and BOM (a bit more technical than I am used to looking at). I certainly understand the voltage divider concept but I am unclear how you are measuring AC voltage. Are you using a transformer to lower AC voltage > Rectifier to bring the phase up? Other similar projects are using AC-AC prebuilt adapters so I am a little lost in that area.

jmengel (author)tgvoss2015-12-02

The project brings the AC-AC adapter on-board (the xformer) which is a bit different from other projects because I intended this for installation inside the power mains cabinet where it is easy to tap into the 120VAC mains but difficult to plug in a prebuilt AC-AC wall-wart. The AC voltage is measured by stepping the 120VAC mains voltage down where it is rectified and fed into the 5V switching regulator to generate VCC. The VCC is also divided down and used to bias the 9VAC output of the xformer which is itself divided to reduce the amplitude for sampling via the ADC. The sampled, divided, center-biased AC voltage signal is used to calculate phase.

Regarding the BOM, it is a dump from the Eagle schematic and isn't terribly readable for us humans.

If you prefer to use a pre-built AC-AC adapter, just get a 9VAC wall wart transformer and feed it into the circuit at the rectifier, omitting the on-board xformer. The rest of the circuit will be unchanged.

Hope this helps.

tgvoss (author)jmengel2015-12-02

Yes, very much. Thanks! I am also building a simple meter inside the mains box so this is still a good solution. I was just having a difficult time wrapping my head around it.

I think it would be helpful to have a more human readable list of materials for those that don't use Eagle. Can you import that list directly into a supplier like Digikey/Mouser?

JonasK3 (author)2015-09-15


Very cool project! I noticed you are measuring the voltage on only one phase and in your pictures you seam to be measuring the current on both phases going in to your breaker. Are you using a calculation to estimate the power factor for the other phase or how are you getting the separate power factors?


jmengel (author)JonasK32015-09-15

The voltage phase angle is measured on a single phase for all current sensing transformers, with the assumption that being backed by the grid it will be the same across both branches. The measurement of the current waveform phase angle relative to the voltage is used to calculate power factor and is computed for the pair of current transformers when measuring 240VAC current on both branches. So the assumption there is that the aggregate current phase angle as approximated by the code is accurate for both branches. In the strange case where an appliance on the 240 branch has a large resistive load on both branches (PF = 1) and a motor for a blower on only one branch (PF < 1) then this assumption will lead to some inaccuracies in power factor correction perhaps. A limitation. But for the price.... :)


dutuc.nicolae (author)2015-07-13

Green energy monitor:

SohnJ1 (author)2015-06-24

Hi Jmengel,

Your article is very interesting. So, if you are okay, we would like to link our site( to your article for more references. Is it okay?

I also left the same request to you by a private message a few days ago.

ahmadfaisalMJ (author)2015-04-20

hey...can i get the coding that without using ethernet shield? only print the output at serial output

jmengel (author)ahmadfaisalMJ2015-04-20

The code already prints to the serial port. You should be able to simply comment out the ethernet setup and transmission code and go for it.

turtl3sh3ll (author)2014-11-10

Can i flat out buy onr of these from you? This seems like a better solution than whats commercially available. Also, i have sometging wou may want in exchange (square D powerlogic cm 3350 with comm chip and panel.) Its 3 phase and waymore / not enough for wjat i want to do.

jmengel (author)turtl3sh3ll 2014-11-11

Honestly I don't currently have any units on hand. I have my personal unit, which is prototype-esque in its fabulous spaghetti. If you are interested I can put one together for you, but the time frame would be post-holidays as I'm just buried right now with managing a kickstarter campaign.

Damn phone keyboard...

mfadiga (author)2014-03-07

i already got this one in the picture, that is 220v-9v. can i use it?

jmengel (author)mfadiga2014-03-07

Should be fine. Not going to fit the holes in the PCB files but you can use wires from the PCB to the transformer. Just have to tweak the calibration parameters.

mfadiga (author)jmengel2014-03-07

So i can use this transformer without changing any other other hardware component? It's also fine for the arduino power suply?

jmengel (author)mfadiga2014-03-07

You may need to change the divider resistors that feed AC voltage to the Aurduino (R2 and R19) depending on the actual output of your transformer. You just need to keep the signal from saturating the ADC input.

Also, as discussed, the burden resistors for each current transformer input will need to be altered to match the current transformers you end up using.

mfadiga (author)2014-03-05

First of all sorry for my English because I'm italian.
I want to make a project similar to yours but i need to use 220v instead of 120v.
I found this on internet can i use it?

jmengel (author)mfadiga2014-03-06

In hardware, all you will need to do to change the circuit for 220VAC is to swap in a transformer with a different winding. For example:

You will also need to adjust some of the parameters in the code. But that will be easier.

mfadiga (author)2014-03-05

First of all sorry for my English because I'm italian.
I want to make a project similar to yours but i need to use 220v instead of 120v.
I found this on internet can i use it?

duncangallimore (author)2013-11-12

I'm having a failure every two days atm updating Cosm - it hangs at the update, seemingly at random. Did you ever get to the bottom of what was causing the locking up on yours? I'm thinking of rewriting the code without the Cosm plugin to add some extra connection checking.
I've been trying things for weeks now, to no avail. My shield is a clone by the way, don't know if that makes a difference.
Yours exasperatedly, Duncan

jmengel (author)duncangallimore2013-11-12

I did not get to the bottom of the lock up, although it was more on the scale of weeks/months rather than every day or two so I just live with it, and I got tired of messing with it. Did you heatsink the ethernet chip?

zapro (author)2012-09-29

Great build, but please - add some isolation between neutral/phase and make isolation between neutral/phase and the ground plane. Add a fuse for that mains transformer too, if the transformer fails shorted you will have full house current cooking your PCB... That PCB layout is a recipe for disaster :-/

jmengel (author)zapro2012-10-05

Looking over the PCB, I can see that it might make sense to increase the spacing between the mains traces and the ground plane. Also a fuse is not a bad idea. The case the PCB is housed in is a metal case grounded to the main panel. The transformer itself is not rated as an isolation transformer but does isolate the rest of the PCB from mains unless it fails in short across the primary to secondary. So again, I'm not sure how to add isolation.

zapro (author)jmengel2012-10-06

You need some isolation between parts that is in contact with line voltage, that is - isolation to components on low-voltage side, groundplane, case etc.

If your PCB is mounted on plastic standoffs there is nothing to mention about placing the standoffs, but if the PCB is slit into some kind of grooves in the box, so the groundplane and metal box is actually touching, you need make a 8mm spacing between the high voltage and the edge of the PCB. The recommended spacing between your live parts and other components and/or groundplane is 8mm too. Please have a look at this picture:

See the spacing between the two sides ? That is for safety. The only connection between the sides is a optoisolator and the transformer (which is internally isolated)

A fuse is a good idea, too.

jmengel (author)zapro2012-10-01

Can you elaborate on a proper method to isolate? I am an ME with only enough EE to be dangerous, as you point out.

davebe (author)2012-07-08

Have you looked at the AC waveform you are getting from the transformer?

I've been looking at an energy monitor, but found that transformers distort the voltage waveform.

See for details

jmengel (author)davebe2012-07-09

I have not looked at the AC waveform out of the xformer. I'll take a look and post the result. Nice write up on the power monitor you are building.

russ_hensel (author)2012-07-06

Nice, but a lot of cost in the audio jacks, I think people can find a cheaper alternative and save.

About This Instructable




More by jmengel:Laser Cut Front End Loader ToyLaser Cut UkuleleElectric Brewery Control Panel on the Cheap
Add instructable to: