Arduino, Green Living, Projects

Simple 3 Phase Arduino Energy Meter

simple 3 phase arduino energy meter

Since writing up the article on how to build a simple Arduino home energy meter which measured the energy consumption for a single phase, I’ve had a number of people ask about doing a 3 phase energy meter. While there is a range of commercially available single phase energy meters available, the 3 phase meters aren’t nearly as common and tend to be quite expensive. So I decided to take the opportunity to build a 3 phase energy meter and fix up a couple of areas in the original energy meter’s code which could have been done better.

Again, with this meter I was going for simplicity. Sure, for perfectly accurate measurements you need to measure both the supply current and voltage but for this application and in the interests of keeping the energy meter simple and safe – only requiring a non-contact connection to your mains – I’ve decide to stick with a simple current measurement which gives you an estimate to within a couple of decimal points of a kilowatt hour.

This meter measures the supply current through each phase using a CT (current transformer) and then does a few calculations to give you the current, power, maximum power and kilowatt hours consumed for each phase. With a few changes to the code, you can also add your local tariffs 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.

What You Will Need For A 3 Phase Energy Meter

How To Make The Energy Meter

First you need to start by assembling your components onto the CTs to create the current sensors which produce a signal which your Arduino can understand. An Arduino only has analogue voltage inputs which measure 0-5VDC, so you need to convert the current output from the CT into a voltage reference and then scale it into the 0-5V input range.

Assemble the Components

If you are going to be installing your power meter somewhere permanently then you may want to solder the resistors and capacitor directly onto each 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 CTs to the Arduino is shown below:

3 phase energy meter circuit diagram

The LCD screen shield already picks up on the analogue inputs but only A0 is used by the shield for the button inputs. Simply solder the five leads from your current sensors onto the pin headers on the shield and use A1 to A3 as your sensor inputs as shown below.

3 phase energy meter ct connections to board

Once you have connected all of your components, you need to connect your sensors onto the supply you want to monitor. For connection to a typical 3 phase mains supply, connect one CT around each of the phases as shown below.

3 phase energy meter connection diagram

Each CT should only have one wire/phase running through its core.

3 phase energy meter single ct connection

NB – Be careful when connecting the CTs to your 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 your local regulations with your local authority, you may require a certified electrician to install the CT for you.

Choosing Different Components

There are essentially four components which need to be chosen or correctly sized for you energy meter.

Choosing A Current Transformer

The first is the CT or current transformer. The one used here is the Talema AC1030 which can sense 30A nominal and 75A maximum current. At 220VAC, it can theoretically sense up to 16.5kW for short periods of time but it is sized to continuously sense 6.6kW which is suitable for a small household. To calculate how many amps yours needs to sense, take the maximum  continuous power your are expecting to sense and divide that by your voltage (usually 110V or 220V depending on your country).

Sizing The Burden Resistor

Next you need to size your burden resistor R3, this converts your CT current into a voltage reference. Start by dividing your primary current (the maximum as used above) by your CT’s turns ratio (available on the data sheet). This should be around 500-5000 to 1. This article worked on 42A with a turns ratio 0f 1000:1 giving a secondary current of 0.042A or 42mA. Your analogue reference voltage to the Arduino is 2.5V so to determine the resistance you use R=V/I  – R=2.5/0.042=59.5Ω. The closest standard resistor value is 56Ω, so this was used.

Here are some options on different CTs and their ideal burden resistors (in standard sizes):

  • Murata 56050C – 10A – 50:1 – 13Ω
  • Talema AS-103 – 15A – 300:1 – 51Ω
  • Talema AC-1020 – 20A – 1000:1 – 130Ω
  • Alttec L01-6215 – 30A – 1000:1 – 82Ω
  • Alttec L01-6216 – 40A – 1000:1 – 62Ω
  • Talema ACX-1050 – 50A – 2500:1 – 130Ω
  • Alttec L01-6218 – 60A – 1000:1 – 43Ω
  • Talema AC-1060 – 60A – 1000:1 – 43Ω
  • Alttec L01-6219 – 75A – 1000:1 – 33Ω
  • Alttec L01-6221 – 150A – 1000:1 – 18Ω
  • CTYRZCH SCT-013-000 – 100A – Built In Burden Resistor – Buy Here
  • TOOGOO SCT-013-000 – 100A – Buy Here

The capacitor used is 10µF which should be sufficient for most CT ranges for household applications.

Finally you need two dividing resistors to get the 2.5V reference voltage from the Arduino. They must be the same value, so R1=R2 and we don’t need much current so this articles uses two 100K resistors.

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.

Here is the link to download the 3 phase meter code.

Because your setup, CTs , resistors and input voltages may be different, there is a scaling factor in the sketch which you will need to change before you will get accurate results, see below 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 screens populated with some figures although these will most likely be incorrect and some may be negative.

This code, unlike our original simple Arduino energy meter’s code makes use of the millis() function to calculate the duration between cycles instead of relying on an estimate, this results in a slightly more accurate (about 0.5%) calculation. For those of you who have read that the millis() function goes into overflow after about 49 days, the code deals with the rollover automatically by making use of the unsigned long variable. For example, if the overflow happens at 10000, the start millis was 9987 and the end millis was 2031, the difference would be 2031-9987=-7956 but the value can’t be negative as it is unsigned so it becomes -7956+10000=2044 which is the correct duration.

Calibrate the Current Reading

As mentioned above, because your setup, CTs , resistors and input voltages may be different, there is a scaling factor in the sketch for each CT 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 on each phase 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) on each phase and see what load is displayed. You will now need to adjust the scaling factors defined in line 8 accordingly:

double calib[3] = {11.8337,11.8234,12.0325}

In this case they were 11.8337 for phase 1, 11.8234 for phase 2 and 12.0325 for phase 3. They 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.

The Energy Meter In Operation

Once you have you energy meter calibrated and the scaling factors have been uploaded onto the Ardunio, your meter should be ready to connect and leave to monitor your energy consumption.

Upon startup, you’ll see a 3 Phase Energy Meter screen followed by cycling through the current, power, maximum power and kilowatt hours consumed screens. In each case, the top line displays phase 1 and phase 2’s measurements and the bottom line displays phase 3’s measurements.

Current Screen

3 phase energy meter current screen

Power Screen

3 phase energy meter power screen

Maximum Power Screen

3 phase energy meter maximum power screen

Energy Consumption Screen

3 phase energy meter energy usage screen

Video Of The Energy Meter In Operation

Autodesk Circuits Model

Here is the three phase energy meter modeled in Autodesk Circuits so that the code can be simulated. Note that they do not have provision for a CT so I have just used a waveform generator as an input which is triplicated onto all three CT inputs, the waveform generator is not really suitable so the displayed results are erratic.

The code also looks a bit different to the code supplied on this page, it is just the order of elements which is different, the content is the same. There is an issue with the way in which Circuits interprets the methods called up in the code which requires them to be declared before the main loop.

How did this project go for you? What have you used it to monitor? If you have any questions or would like to share your build of this three phase energy meter, please post a comment below or send a mail using the contact form.

 

 

8 Comments

  1. Marius

    Hey there

    This is great was a bit busy but i made the 3 phase circuit in the meantime and put together some code
    just waiting for some stock to put everything in a case then i will mail you pics of the setup i made

    Thanks 🙂

    • The DIY Life

      Great! Looking forward to seeing some of your pictures.

  2. Michael Jones

    Cool project. I never realized how simple measuring 3-phase could actually be. I thought it would involve more complex math, dealing with the phase angle. Learned something here.

    I’m just a little confused by this line:
    if (maxCurrent = 517?

    • The DIY Life

      Hi Michael,

      Thank you. It really can be made quite simple, there are two things which typically complicate it, one is when your supply is three wire three phase (this setup and code require the neutral) and the second is if you have very inductive or capacitive loads (low power factor). Since most household wouldn’t have too many low power factor contributors, the meter works quite accurately.

      The line you are referring to is defining the “zero” current line of the AC waveform. The Arduino analogue input ideally maps the AC current sine waveform from 0 – 1024 with the mid point at 512. Practically, the middle of the waveform is occurring very slightly higher at 516. The code is simply saying that any readings below 516 are negative and should be discarded.

      Hope this helps and I have explained it clearly enough.

  3. 12458

    Will it be accurate for inductive loads?

    • The DIY Life

      It depends on how inductive. The further from unity the power factor of the inductive load is, the less accurate it is going to be. You need to measure the voltage as well to make an accurate inductive and capacitive load meter.

  4. Hey!

    Nice work 😀 Always fun when something like this can be put together.

    A couple of notes based on my experience!

    1. Safety. When using a CT like this – even with a high turn ratio (not high turn ratio CT’s are safer than low turn ratios) with an open circuit the CT becomes a voltage source – meaning a high and dangerous voltage can be present! Always make sure the burden resistor is soldered to the CT leads, preferably as close to the CT as possible. This can be done very easily by stripping some of the wires away, soldering the burden resistor in and some heat shrink over the whole lot. Also choose 1% or better tolerance burden resistors AND make sure the wattage is applicable to the CT!

    2. The sketch. It doesn’t seem that the correct RMS calculation is being done, plus there is math going on in the sampling – meaning that the current waveform being sampled may not be fast enough… With the SEGmeter codes I have developed, I have an array that I sample into, meaning the sampling can be as fast as possible. I can get around 4kHz sampling using the 16Mhz arduino. Adding math here slows this considerably!

    Simply how this should be done is:
    – fill up the sample array for the desired number of samples.
    – square each sample
    – add the squared sample into an accumulator variable
    – when done, divide this accumulator variable by the number of samples
    – calculate the root from the result of the division
    – apply the calibration factor to this result
    – do other maths for energy based on time etc

    The sketch for Arduino based ADC is used in the SEGmeter V1 is below
    https://github.com/samotage/Aiko/blob/master/SEGmeter/seg_meter_v0_199.pde

    Note, the V2 SEGmeter uses a separate 12 bit ADC over SPI.

    Another thing for Arduino and this kind of stuff, which is useful for current sensor selection, is that many sensors have a 0.333V output. Setting the Arduino analog reference to INTERNAL, means that it uses the internal 1.1V as it’s ADC vRef – a handy hint I got from @jonoxer once upon a time

    analogReference(INTERNAL);

    There is a bunch of other stuff I can share, and hit me up if you would like any more tips!

    Sam, @samotage

  5. online higher education

    Hi, just wanted to tell you, I enjoyed this post. It was inspiring. Keep on posting!

Leave a Reply

ALL RIGHTS RESERVED

Close