Mains AC: non-invasive

Measuring AC mains energy use the non-invasive current transformer method

This is version 1.0 of the mains AC energy monitor, the current version version 3.0 can be found here

 

This method of measuring mains AC electrical energy use is quite nice, it doesn't require any breaking of the mains wire, which makes it nice and safe, you just clip-on to the wire a sensor called a current transformer (CT) that measures the current flowing through either the live or neutral mains wire. It does this by measuring the magnetic field that surrounds the wire, created by the current. The simplicity of just clipping on the sensor means that it can be used to measure the electrical energy used by the whole house. It a method used by many commercial devices that you can buy.

How it works

The electronics only physically measures current which is measured using a CT sensor which produces a small secondary current that is proportional to the current in the mains wire. In the case of the efergy elite sensor the secondary current is 1500 times smaller than the current in the mains wire. A small resistor is then placed in parallel with the CT to produce a voltage proportional to this current. The voltage is then biased (shifted up) by 2.5V using a voltage divider. This allows you to measure both the negative and positive component of the waveform due to 0 -5V input requirement of the Arduino.

The program on the Arduino then calculates the RMS current and with a manually entered value for RMS Voltage (230V in the UK, 110V in the US) it can calculate a value for apparent power. More on this program detailed below.

There is also an alternative experimental arduino program that can calculate in addition real power and powerfactor by synthesising a voltage waveform that is in phase with the peak of the current waveform – this gives the same result as the main program for all normal real loads like heaters and incandescent lightbulbs but can accurately calculate the power factors of less than 1.0 for loads with non-linear current draws such as laptops but does not work for “real” reactive loads such as washing machines and fridges. For more information and the code for this visit this page.

How to build it

Circuit Schematic


 

Components required


 

  • Efergy Elite Sensor (or similar current transformer sensor).   Efergy Shop - £7.50.

I got an email from Seeedstudio who kindly offered to cater for any parts for this project, they currently stock 1 current transformer sensor that has current output: 100A CT  $9.78 and are working on an arduino datalogging project called Seeeduino Stalker. I haven't had the chance to test their sensor so I would recommend going for the efergy if you have a choice.

  • 6way header (To broken down in to 1x 1pin, 1x 2pin and 1x 3pin for Sheild-Arduino connection)    farnell £0.162
  • 10way sockets (To be divided in two) farnell
  • Stripboard farnell -£4.73 (you will have a lot left over for other projects)

Total cost of build: £35.76

Step 1

Place the header pins through the stripboard. First you will need to move the little plastic bit to one side of the pins. Make sure that the single pin goes to Arduino analog in 0, the double pin to GND and 5V and the triple pin to Arduino digital in/out pins 5 to 7.


 

Step 2

If you would like to connect up a 7 segment display or make the digital pins below the stripboard accessible for any other reason: Insert and solder in the first 5way socket connector nearest to the digital pins. The second header is used to place Rsens in a way that it can be changed so that you can change the range of current that can be measured.

Hint: To keep it in place while soldering use a couple of striped bits of wire about 5mm longer than the header then insert in to headers and then insert other end into breadboard.

Note: When building the board and taking the pictures I for some reason soldered in the second header after stage 4 but there's no reason why it shouldn't be done at this point.

Step 3

Place and solder both 100kOhm resistors used for the biasing voltage divider.


 

Step 4

Place the 100Ohm resistor used as a current limiter.


 

Step 6

Place the 3.5mm jack used to connect up the efergy CT sensor. I found you can cut off the side pin on the jack and just keep the one at the end and the one on the bottom.

Step 7

Place wire jumpers that route 5V and GND along to the 7 segment display socket.


 

Step 8

Remove some of the copper track. There are 6 breaks to make as in the picture below (let me know if its not clear enough) you can do this with the stripboard tool or a small drill bit.


 

Step 9

Connect the mini shield to the arduino making sure that its inserted into the correct pins as described in step 1.


 

Step 10

Connect up the CT sensor.


 

Step 11

Once your happy there are no shorts and everything is looking good connect it up to the computer the arduino power light should be on as usual and hopefully nothing will be smoking :)

right on to the software

Software side

Step 1 – Arduino software:

Download the Arduino sketch here

Step 2 – Computer side

  1. Download the ArduinoComm java program here.

  2. Unzip ArduinoComm.tar.gz

  3. Compile the program by typing $ javac *.java

  4. Run the program with $ java Program

For a 'How to' on compiling and running java programs have a look here. (It also details installation of rxtx library)

For more information about ArduinoComm visit this page

If its all working you should see something like this appear in your terminal window:

153.25 230.00 0.63
126.76 230.00 0.62
128.24 230.00 0.63
....

From left to right we have: apparent power, rms voltage, rms current.

Now clip the sensor around the live wire of a test power strip as in the picture below and connect up some a load something in the 100W range. The value for apparent power and Irms should go up but you may need to calibrate as described below to get accurate values.

Calibration

The values coming out of the sensor probably wont be correct if you compare it with a commercial plug in meter even if you use the a 100Ohm resistor and the same CT Sensor as specified above. I have a couple of CT sensors now and each one seems to give slightly different results from the other as if they have not been coiled with the exact same amount of secondary windings.

So to calibrate you need to get a plug in meter like this one that can measure the RMS current and create a spreadsheet of RMS current values measured by the plug in power meter versus RMS current values measured by the method above for different combinations of lamps, laptop, small heaters etc. Then create a scatter graph of the data points with the commercial meter on the y-axis and the method above on the x-axis and then plot a line of best fit (hopefully the data points should lie pretty close to the line). Now take the equation of the line which should be in the form y = mx +c and enter it in to the arduino sketch by modifying the following variables factorA and Ioffset at the top as follows:

double factorA = 15.2 * m ;

double Ioffset = -0.08 + c ;

Note: factorA here is equal to the CT sensor reduction factor divided by Rsens and so if you placed a 100Ohm resistor in as your Rsens you can work out how many secondary windings your CT sensor has.

Now if you compare the RMS current values again they should now be in better agreement.

Extend it

Next you may want to test it and then do useful things with it by extending it.

Changes since last version

November 5th 2009

Id like to thank Peter and Ed who posted below for pressing me on the voltage synthesis and suggesting I look at more traditional reactive loads like the washing machines or fridges instead of only laptops which even though their powerfactor is less than 1.0 aren't really reactive. The above version does not now feature any voltage synthesis just Irms and apparent power calculations (from a manually set Vrms value). I have relegated the voltage synthesis info to another page here in-case it is of any interest to anyone.

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options