I'm working on a new project that I would like to share with this community. For now, I called it "JMPM".

It's a power monitor similar to the designs here, but based around more mordern components.

The design goals are simple -- I want a highly accurate device for measuring my home's energy use and production.

JMPM is based on the Xmega series of uC by Atmel and as such:

Feature highlights:

  • 11 CT sensor inputs

    • 2x 200 Amp Range
    • 2x 100 Amp Range
    • 2x 50 Amp Range
    • 5x 30 Amp Range
  • On board voltage isolation (read: No wall wart neccessary)
  • Native support for both Raspberry PI and USB interfaces

    • Pin header for Raspberry PI. Just connect a ribbon cable
    • USB if you want to use a laptop or whatever
  • 12 bit native sample resolution

    • +/- 6 watts accuracy on the 200 Amp sensor inputs
    • +/- 1 watt accuracy on the 30 Amp sensor inputs
  • 14 bit over sampling (This *SHOULD* work)

    • +/- 2 watts accuracy on the 200 Amp sensor inputs
    • +/- 0.25 watt accuracy on the 30 Amp sensor inputs
  • High sample rate

    • Provide data at up to the 80th harmonic in real time. Think of it as an oscilloscope permanently attached to your mains.
    • Identify specific loads.

      • Eg. My electric toothbrush was charging for 75 minutes today

The design target for this is to have it work with emoncms as the front end. I took a look at that and it's pretty darned complete.

The board powered up for the first time last night. Once it's proven to work, I will publish everything as an open design and open source.

Huge thanks to everyone here for inspiring!

- Jm

chaveiro's picture


That looks good.

See my post about EmonLibPro

May be usefull to you.


For improovement, i'd like to see an ethernet port in it to comunicate directly to emoncms as i'm doing with arduino. :)


TrystanLea's picture


Looks really good! nice work! Love the purple boards. I look forward to seeing the schematics, are you using similar input stage circuitry to emontx or different?

mchamster's picture


V0.01 uses nearly the exact same input stages as described here. I have v0.02 in the works right now. that includes an anti-aliasing filter to improve ADC accuracy and an option for direct (transformer-free) measurement of line voltage. Transformers are difficult to reliably source and expensive when they can be found. 

Also considering adding an rf transmitter to the board layout since that'll be nearly free. 

- Jm

Robert Wall's picture


I'll be interested to see what difference the anti-alias filter makes to the low level performance and noise rejection.

How do you intend to handle the necessary isolation if you will be having a direct galvanic connection to the line for voltage monitoring?

mchamster's picture


nyquist frequency theorem says the sample rate has to be at least twice the highest frequency being measured. With my scope and a ct probe, I can see details around 30khz and I have only looked at my laptop power supply and a small desk fan. I'm sure higher frequencies are present and even more noisy with larger and composite loads.

Additionally, if there are enough cycles to perform reliable over sampling, the signal can't change much during the extended sample period. I don't think the 12bit adc is nearly good enough for measuring the 200amp sensors with any reasonable accuracy.

Unfortunately my ct probe came after the boards were sent to be fabbed, so I didn't think to add the filter to the first design.


- Jm

chaveiro's picture


Anti-alias filter in hardware? I see that as a shortcut with precision reducion.

Typical LPF DC offset filter should account for high frequency content removing.


If you want reliability and precision you should:

1 - Eliminate digital noise from analogic section.
2 - Sample values ranges close to max precision of adc. If needed much range, hardware gain must be considered. From atmel appnote it exists onchip on XMega so use it.
3- Sample as fast as possible. (include cpu processing time)
4- Assure you are sampling at the same time position in every cycle. (call for PLL)
5- Continuou sample and never miss any sample at any time.
6- Do the filtering in software.
7- Give result data as an average over time of sampled data.


What exact XMega are you using at what freq? ATxmega128 is only twice as fast as arduino Atmega328 in cpu raw power.Not realy enought for what you describe you want to do.
You should revise your cpu software processing power required as no way you can get your "80th harmonic in real time" measurements with this for 11cts.
See Atmel AVR1631: Single Phase Energy Meter using XMEGA A



As i said on the post above, see my lib, it does pretty much all the necessary steps i said minus step 2, but i'm using 20A/ CTs so range is short.
Noise is my main problem with arduino shield proto boards as pcb layout is bad designed for analog signal. Even though i got 0.01-0.25 precision on all units.

With a precision for step 4 in range of  39-78uS with the PLL technique.

Take time and analise it, you wont regret.


Robert Wall's picture


Is there any other way? ? ?

"Typical LPF DC offset filter should account for high frequency content removing."
Please explain. You need a HIGH PASS filter to remove the d.c. content, else you obtain the d.c. content with a low pass filter and subtract it. Either way, the high frequency content is largely unaltered.

chaveiro's picture


Robert Wall  :

First to clarify, high frequency 'noise' (in MHZ) is not the same as (not so) high frequency current peaks (eg.: from smps).

I tought that hardware anti-aliasing filters was used to remove  the later peaks, but from viewing the atmel AVR1631 app note i believe that filters are there to remove high frequency noise from the line like the generated by powerlan devices in MHZ ranges.

Meaning that this kind of filters will not do much change with arduino like ADCs because itself works by sampling a small window (at 125khz for arduino). So any higher frequency content is lost already.


Regarding LPF for DC ofset, forget it we use a HPF. My mistake.

For LPF in software it can be implemented with a formula like:

y(n) = 0.996 * y(n-1) + x(n)

mchamster's picture


Aurduino isn't a development target for this project. 

Robert Wall's picture



I am well aware that digital noise originates from a different source, and is unwanted, compared to high frequency Fourier components of the wanted input. However, a passive anti-alias filter, which will of necessity remove high frequency components of the wanted signal above the Nyquist frequency, might also serve to remove some of the noise components, especially those that are inductively or capacitively coupled, as opposed to conducted, into the input (or indeed conducted into the analogue supply).

For good low level performance, you must have a clean analogue supply (an L-C filter L50 - C50 is shown in the Atmel app.note AVR465 and similarly in other Atmel documents), and if there are components in the input above the Nyquist frequency, then hardware anti-alias filters are required. However, the limited bandwidth of the current transformer, and the very low level of high frequency components in the voltage supply are probably reasons for these not being included in the Atmel AVR465 design. It is of course quite impossible to have a digital anti-alias filter.

mchamster's picture


chaveiro - I appreciate all your feedback. This is good information. I'll review the utility of all your points with the design.

I'll include ethernet into v0.02. That's really a very good idea and something I hadn't considered.

Additionally, re: 80th harmonic -- My consideration is much of the processing can be offloaded for high precision heavy lifting. In this use case, the device just sends raw data in a periodic packet and something else can do the analysis. Moving this much data in and out of the uC will be enough work.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.