Author Topic: Wireless Four Channel 'Honest' RMS AC Power Monitor  (Read 68510 times)

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Wireless Four Channel 'Honest' RMS AC Power Monitor
« on: April 12, 2015, 02:18:04 PM »
As promised, here are the Eagle files and software for my Wireless Four Channel 'Honest' RMS Power monitor I mentioned in other postings.  This monitor uses inexpensive clamp-on AC Current Probes (http://www.ebay.com/itm/281272305250) to pick up the AC Current used on various branch circuits in my Home and Workshop. 

I use the term 'Honest' RMS because it does perform a square root of the mean of sum of squared current readings (hence RMS) but has not been calibrated to a traceable standard and probably is off for some kinds of loads.  I've spot tested with a number of loads and am satisfied that it meets my requirements (Water Heater, Well Pump, Air Compressor, Heat Pumps, Dust Collector, etc) but YMMV.

The probe has a sensitivity of 1V output for 30Amps of current in the monitored leg.  Since I'm only interested in monitoring branches 20Amps or less, this is ideal as the Peak current, with 20Amp RMS load, would be slightly more than 28Amp (within the probes specification).   

As you'll see in the circuit, I use an LM317 to produce a 2.00Volt reference.  This reference is used for the AREF input on the Moteino, as well as provide the bias reference for each of the channels.  Each channel has a 10K/10K divider to divide the reference down to half the AREF value, thereby biasing the analog inputs at the midway point, yielding an ADC value of 512 with no current (or offset error).  The range was chosen so the full scale current of 30A provides a full scale digital reading of 1023 or 0, depending on polarity.  The probes are DC isolated with 100uF caps.

In the code, you'll see that I use Glenn Sweeney's code to set the ADC to operate with continuous sampling on an interrupt driven basis.  This not only frees the processor to do other things (rather than wasting time waiting for the ADC conversion to complete) like manage the Moteino radio, to take a random example and, running in continuous sampling mode, also means that every sample takes exactly the same amount of time, providing the best accuracy of the integrated signal.

Each channel is sampled in turn and, with four channels, sampling over a 10 60Hz cycle interval, yields approximately 400 samples per channel per interval.  The sample is converted to floating point to improve dynamic range with acceptable precision.  Each sample is then squared and summed (sum of squares) and the number of samples tracked.   At the end of the interval, the sum is divided by the number of samples (the mean) and the square root is taken (Root Mean Square).  These are then accumulated over a ten minute period and then reported over the Moteino network as total AmpSeconds (AKA coulombs) accumulated in the ten minute window.  These samples are saved on my Home Server and used in a variety of ways to monitor power usage. 

Note a couple of things:
1. The sample code doesn't have the radio code because we all do it differently and, if you can't figure that out, learn that first.
2. The monitor measures AC Current only.  To convert to KWHr you need to know the voltage of the corresponding circuit.  This info is kept in my device database as a constant for each channel (I don't monitor as our voltage is constant enough so that results are WAQL without measuring).
3. The circuit uses very large through-hole pads for the components. This is because I used this design to test CNC Routing of PCB.  It worked well, primarily because it's a simple circuit built around the Moteino module.
4. I used a TO220 version of the LM317 because that's what I have on hand.  You could easily use a TO92 or SMD version as there is very little power dissipated in the regulator.
5. The design MAY work for 50Hz systems if the intervals are changed, but has not been tested at this frequency.

I think that's it and probably all the forum SW will let me say anyway.  Ask questions, I'm happy to answer.  Code and Eagle files attached.  Photos in a trailing posting because they're too big to add to this one...

Tom

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #1 on: April 12, 2015, 02:26:23 PM »
Here are the photos of my implementation.  I use a standard 4x4x2 inch PVC box that I milled on the side with my CNC router so that the 3mm jacks for the individual probes can be mounted directly to the box (the plastic wall is too thick for the standard 'cheapo' jacks).  I also engraved the box with Channel number just because I could...

You'll have to look at this posting https://lowpowerlab.com/forum/index.php/topic,998.0.html to see the PCB (too big for this posting).

Tom

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #2 on: April 13, 2015, 07:50:20 AM »
Nice implementations as always :)
Is the little board at the bottom the guts of a wall-wart? Or some kind of AC-AC/DC supply?

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #3 on: April 13, 2015, 08:11:49 AM »
Nice implementations as always :)
Is the little board at the bottom the guts of a wall-wart? Or some kind of AC-AC/DC supply?
It's a low cost 85-270VAC, 44-440HZ  Input Voltage AC 85-265v 50/60HZ, switching regulator that produces 5V output and 'some' current 1Amp output - I'll have to dig up the specs (and link) and update this post. I use a similar but encapsulated version for some of my other AC Powered motes.
UPDATE: Here's the link: (http://www.amazon.com/gp/product/B00MFAQ3R2)

T
« Last Edit: April 13, 2015, 08:16:40 AM by TomWS »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #4 on: April 13, 2015, 08:32:32 AM »
Ah, good price and features but why does it have to be chinese :(
No dimensions on that page that I can see either, or any UL markings.
I am always on the lookout for finding alternatives to the expensive RECOM supplies I use in switchMotes.

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #5 on: April 13, 2015, 10:38:50 AM »
Ah, good price and features but why does it have to be chinese :(
Now THERE is a rhetorical question if ever I heard one!
No dimensions on that page that I can see either, or any UL markings.
I am always on the lookout for finding alternatives to the expensive RECOM supplies I use in switchMotes.
I don't have the measurements handy, but I think that question was posted and answered on the Amazon listing.  And, just because you're a nice guy, attached is a schematic with the two 5V power modules I use (Encapsulated and Open Frame - this one).

If you want the details, I'll measure it.  Just let me know.

T

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #6 on: April 13, 2015, 12:39:05 PM »
They would need to be certified to have some piece of mind as far as getting low power from mains. Right now the RECOM supplies are great, stable, certified and compact, just expensive.

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #7 on: April 13, 2015, 02:09:16 PM »
They would need to be certified to have some piece of mind as far as getting low power from mains. Right now the RECOM supplies are great, stable, certified and compact, just expensive.
I understand and agree completely for a commercial product (I'm marginally concerned just using them for these projects).  I think I saw some new modules from RECOM (either Allied or Digikey newsletter), announced in just the last month or so, that would be as small or smaller than these.  Probably 3-4X the price, however.  But 'all marked up' as you say  ;)

Tom

ulli

  • Jr. Member
  • **
  • Posts: 87
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #8 on: October 17, 2015, 08:49:19 AM »
Hi Tom,

I also plan to create a board to measure the current consumption of different devices.
I already googled this topic, studied the circuit of www.openenergymonitor.org and compared it with your circuit.

It`s pretty much the same but you are using an additional LM317 to create a 2v reverence voltage for the Atmega.
Why do you not use the Atmega internal VREF? What does your investigation show?
« Last Edit: October 17, 2015, 09:03:55 AM by ulli »

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #9 on: October 17, 2015, 09:19:14 AM »
It`s pretty much the same but you are using an additional LM317 to create a 2v reverence voltage for the Atmega.
Why do you not use the Atmega internal VREF? What does your investigation show?
The clamp on sensors put out 1V/@rated current in Amps (depends on the clamp you use).  I AC couple the clamp output using DC blocking capacitors and bias to 1.0V (2.0V/2) so that it is 'easy math' to convert.  512=0Volts, (ADCval-512)/512 = 1.00 for full scale input.  Using 2.0 ARef give me full dynamic range of the ADC for a full scale input rather than trying to compensate digitally.

Tom

ulli

  • Jr. Member
  • **
  • Posts: 87
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #10 on: October 17, 2015, 11:00:19 AM »
Ah I got the difference. Your are using the SCT-013-030.
I planed to use a SCT-013-000 with a burden resistor like it is on the openenergymonitor.
Why did you not use the SCT-013-000, you could skip the additional LM317?

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #11 on: October 17, 2015, 11:55:51 AM »
Why did you not use the SCT-013-000, you could skip the additional LM317?
Four reasons:
1. I wasn't aware of this sensor or the other implementation, so designed my own implementation using the sensor I knew about.
2. I don't like floating connectors on a panel. I use a standard 3mm audio jack for picking up each of the transformer inputs and wanted the outer ring grounded.  The arduino implementation has the jack floating at Vcc/2.
3. The gain is dependent on Vcc and the precision of the resistor, rather than a separate voltage reference.
4. I have a ton of LM317s looking for an application.   ;)

The arduino implementation is fine, it just doesn't meet my needs.

Tom

luisr320

  • Sr. Member
  • ****
  • Posts: 255
  • Country: pt
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #12 on: November 03, 2015, 08:02:06 AM »
Hello Tom. Nice project. I was messing around with a similar project and this will be a nice reference.
One question: why is the GND pin of the Moteino connected to the DTR pin.
Luis

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #13 on: November 03, 2015, 08:28:17 AM »
Hello Tom. Nice project. I was messing around with a similar project and this will be a nice reference.
One question: why is the GND pin of the Moteino connected to the DTR pin.
Luis
I find that if there is a power loss (we live in the woods and we get a lot of them), depending on how the power comes back on, sometimes the Mote doesn't reset reliably.  Tying the DTR pin to ground and, therefore connecting the Reset pin to ground via the blocking cap, significantly improves the restart reliability.  Obviously I remove this jumper when using the FTDI port - which has been practically never since deploying these devices.

I have two installed; one monitoring key circuits (water heater, water pump, septic pump, and Generator) in our house and one monitoring key circuits (two Heatpumps, compressor, dust collector) in my workshop.

Tom

kobuki

  • Sr. Member
  • ****
  • Posts: 289
Re: Wireless Four Channel 'Honest' RMS AC Power Monitor
« Reply #14 on: November 26, 2015, 02:05:39 PM »
@Tom: in your schematics (and apparently on your board) I see you're using electrolytic caps for AC decoupling. Doesn't it cause problems for you? I see that the cathode of the caps is biased to +1V, but on the anode the voltage can swing from -1 to +1. On the long term, shouldn't it cause damage and malfunction? I might be seriously overlooking something simple, though...