I want to measure how much electricity our family is using.  This way, we can find ways to use less.  Lucky for all of us, there is the OpenEnergyMonitor project.

Thanks To Those That Went Before

OpenEnergyMonitor (OEM) project – It is inspiring and exciting to be able to benefit from the vast amount of information and resources provided by the OEM project.  In addition, the folks participating on their forums are exceptionally responsive and helpful.  THANK YOU.

boblemaire’s IOTAWATT project – What a fantastic source!  THANK YOU.

My First Prototype

The goals of my first prototype are to:

  • gain an understanding of how to build a DIY electricity use monitoring system.
  • evolve my thoughts on how I want myself (and potentially others) using this system (e.g.: if my neighborhood participates, can we collectively lower our use?).
  • Build a prototype that is the simplest possible to figure out stuff.

The High Level Design

This image shows the major components of the prototype:

For this project, I decided to measure the current flowing through the circuits instead of the main line.  The maximum current that can flow through each circuit in our house is 20A.  The voltage is ~ 120V.  This means the maximum power a microwave, toaster, or any combination on a circuit can draw is P = IV = 20*120 = 2,400 Watts.  Looking at our microwave, it requires 1,250 Watts.  The circuit breaker would constantly be flicking on if I were to try to put two of these microwaves on the same circuit.

The CT is attached to one of the 20A circuits in our panel (1).  The CT has a 3.5mm jack(2 & 3).  This AC circuit gets converted to DC through one of the Feather M0’s ADCs.  RFM69 is used to communicate with another device within my house.

Energy Monitoring 101

This recollection is really for my own benefit since I am a novice when it comes to energy monitoring.  Besides, any project that has me in close proximity of a high voltage of electricity commands my respect.

A question I have going in is how do we go from a wire that provides 20A to an area of our house to measuring some appliance using the electricity?  I mean, I can’t very well measure 120V and 20A with my trusty Arduino…even if it is the mighty Feather…

Lucky for me, the OpenEnergyMonitor web site tries very hard to explain all this to me.:

The first thing I needed to understand was the job the CT played in energy measurements.  The job of the CT is to produce an AC current that is proportionally lower to the AC current that is flowing through the house.  The amount the CT scales down the current is the amount needed to be measured by the voltage/current constraints of the chips the measurement hardware is using.  In the example above, the current needs to scale such that it can be measured by an Arduino.

The CT

The CT I got for this experiment

NewImage

 has the following specs:

NewImage

and schematic:

NewImage

I noticed on the specs it says Iout instead of Vout.  Given the 0-1V output and schematic, I assume the spec should be Vout for this model.

From what I can tell, split core CTs from YHDC are popular with the OEM folks.  The OEM project describes the YHDC sensor they tested in this post.  Looking at the YHDC web site, I got a better feel for which sensors output current and which output voltage.  For example, here are a few:

NewImage

In addition, the number after SCT is the hole size.  The 13mm diameter hole size was big for the wires coming off of the breaker switch.  Eventually I’m interested in measuring all the wires, so I ordered an SCT006 from eBay.  I’ll figure out how to set up the circuit when it comes in.

The Turns Ratio-1

To understand the importance of the turns ratio, I like the image drawn during this video:
NewImage

In the case of the CT I’m using, Np = 1 and Ns = 1800.  So the current coming in (Ip) is scaled to 1/1800 in order to get to the measured current (Is).  So if an appliance used a full 20A, the CT would scale this to 1/1800*20 = 10mA.  10mA…I’m much more comfortable measuring that amount of current.

CT Output

What gets measured out of the CT depends on the CT.  The one I got returns a reading between 0 – 1 V.  What this tells me is it has a built in Burden Resistor.  

Negative Voltage

The challenge then is how do we measure negative (AC) voltage?  The same way I did when I designed the EC circuit – which I called a floating ground.  Thisis also commonly called a bias.

Notice R1 and R2 in the image.  These create a voltage divider that lifts (biases) the ground up from 0V to 1/2 the voltage of the Arduino (which in the diagram is 5V – so the bias is 2.5V).  The GND connection of the CT connector is connected to the mid-point of the voltage divider.  Thus, readings will be (positively) biased by 2.5V.  A reading would be Is a secondary voltage reading( which in our example will be +/- 10mA) +2.5V.

Wiring

For my hands on part of my energy 101 learning, I set up the circuit OpenEnergy kindly provided.

 

 
IMG 6070IMG 6059
I mounted the female side of the jack to a proto board.  This way I could make sure the signal got from the CT to the Arduino’s A1 pin. 
 
I ended up putting the CT around two circuits because of space constraints.  So instead of measuring a max of 20A, I am measuring a max of 40A.
 
The CT has a 3.5mm male jack.  I used this female jack from Digikey:  

Pasted Image 8 13 17 1 11 PM

NewImage

 

 

 

 

 

 

 

hooking 1 on the female jack to the BIAS on the breadboard and 2 to A1 of the Arduino.  

Software

I ran the current_only.ino Example that comes with the EmonLib library.

// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3

#include "EmonLib.h"                   // Include Emon Library
EnergyMonitor emon1;                   // Create an instance

void setup()
{  
  emon1.current(1, 60);             // Current: input pin, calibration.
}

void loop()
{
  double Irms = emon1.calcIrms(1480);  // Calculate Irms only
  
  Serial.print(Irms*123.7);	       // Apparent power
  Serial.print(" ");
  Serial.println(Irms);		       // Irms
}

Calibration

Why did I put 60 for the second variable in the call to current (i.e.: emon1.current(1,60) )?

The OpenEnergyMonitor docs includes a section on current sensor calibration.  I found the most important info to be:

 

If you use a current transformer with a built-in burden (voltage output type)

(MY NOTES: I am…see below).

Look at the last line of the theory where the current constant is derived:

current constant = (100 ÷ 0.050) ÷ 18 = 111.11

“100” is the current transformer primary current, and “0.050 × 18” is in fact the voltage across the burden resistor for the standard CT and burden at that current, so to arrive at your current constant you simply substitute your transformer’s rated current in place of “100” and the voltage it gives in place of “0.050 × 18”. For example, the YHDC SCT-013-030 gives 1 V at a rated current of 30 A, so for this transformer you have:

current constant = 30 ÷ 1 = 30
(MY NOTES: I am using the YHDC-SCT-013-060.  In this case, the current constant I will use is 60….and yah - looks like I don’t need a burden resistor).

Or to put it in words, the current constant is the value of current you want to read when 1 V is produced at the analogue input.

Irms

I am sadly intimidated by terms like “Root Mean Square.”  It sounds so physics/math related.  It sounds so much like the professor who always glared directly into my eyes  when he said “Assuming you have the intelligence….”  (seriously!..as an aside, if you have a daughter, don’t let this happen to her…).  Anywho, I think of Irms is the DC equivalent value of an AC current.  While this video starts off slow, “The Concept of RMS” gives me a feeling for Irms (Vrms) perhaps assuming I don’t  have the intelligence….

in the call to the sampling function: emon1.calcIrms(1480); I left the number of samples to what the script recommends.  Here’s a little bit more info (from this web site): The sketch reads approximately 106 samples of current in each cycle of mains at 50 Hz. 1480 samples therefore works out at 14 cycles of mains. That will give you a good average reading. You can change the number, but you should get as close as possible to having a whole number of mains cycles, otherwise if you have only part of a cycle on the end, you will introduce an error.

 

Measurements

Before I list some numbers, I should point out my simple project isn’t measuring voltage.  This means I’m not measuring the real power being used.  Rather I’m measuring the apparent powe

Apparent Power

Note: I am writing this section for my own benefit.  By doing so, I can use wording that helps me understand Apparent Power since it is a key aspect in AC Power measurement.

I found the following info the most helpful:

I am thrilled to have done this experiment if only to learn more about AC Power.  So far, my focus in electronics has been around Ohm’s law – DC Power.  I didn’t know one way or the other about AC, but assumed it too follows Ohm’s law.  Well, most of the time it doesn’t.  If the load drawing current is like a resistor – e.g.: things that use resistance to heat or light – incandescent light bulbs, hair dryers, toasters, and kettles…then P = IV.

However, most of the loads in our houses (as note in this document):

  • Refrigerators, Freezers
  • Air conditioners (all types)
  • Fluorescent lights including CF lights
  • TV, computer, stereo, any wall-wart
  • Microwave Oven
  • Washer, Dryer
  • Vacuum cleaner
  • Fans
  • Power tools: grinder, electric saw, compressor, etc.
  • Humidifier, dehumidifier
  • Garage door opener, pool pump, electric lawn mower, etc 

use inductors and / or capacitors which momentarily store some of the energy and then return it to the energy source.  This means Power measurements using the simple IV calculation that is used in the Arduino sketch for this project where the voltage is approximated at all points to be 123.7V (based on a Kill-A-Watt reading),  will be higher than the actual amount of power being used.

Not Much Load

Here are some measurements I got when I wasn’t running much on the circuit:

0.23 123.7 28.97
0.27 123.7 32.83
0.33 123.7 41.16
0.28 123.7 34.61
0.24 123.7 30.18

The first column is Irms, the third column is the first column multiplied by the second column = Apparent Power.

Microwave

When I turned on the microwave, I got readings like these:

33.94 123.7 4198.91
32.5 123.7 4019.83
30.85 123.7 3816.13
31.82 123.7 3935.75
31.83 123.7 3936.79
31.79 123.7 3932.57

Certainly a much higher amount of Apparent Power.

Coffee Machine

I have a fairly elaborate coffee machine.  The first thing it does upon turning on is heat to 200˚F.

25.41 123.7 3143.41
25.17 123.7 3112.98
25.25 123.7 3123.45
25.23 123.7 3121.1

Heating takes a lot of energy. Given that this process is heating, I assume the Apparent Power is much closer to the real amount of power being used.

What’s Next

To evolve my knowledge, I plan to measure the real amount of power being used coming in from the source rather than one of the (smaller) circuits.  By doing this, I can compare/contrast my readings to the monthly readings I get from my energy provider.  Using these results, I can calibrate future energy monitoring projects to accurately reflect the amount of energy actually being used.

 

 

 

Thanks for reading this far.  Please find many things to smile about.