Noise in volt readings

I'm in the early stages of a DIY monitor using Arduino and the emonLib.

So far I've got the AC source set up on a protoboard. I'm using this transformer:

http://au.element14.com/myrra/44086/transformer-1-5va-9v/dp/1689048?Ntt=...

And a 33ohm load with the standard divider and offset. I'm using a 10uF electrolytic for the cap.

I'm getting a lot of variability in the voltage readings compared to a Watts power monitor that I'm trying to calibrate to. I'm using 200 half cycles in the call to calcVI. The calculated voltage tends to jump around 2 to 3 volts regularly and sometimes more. At the same time the Watts monitor wil be varying by something in the order of 0.3V.

Looking at the raw readAnalog values I notice that they sit at a max level of around 920 (for 246 Vrms) but then every now and again will pop sharply up to 1023 and then resume per normal in the next cycle.

Is this normal? Might it improve when the components are more permanently mounted?

Any help greatly appreciated.

Cheers

Peter

 

 

 

dBC's picture

Re: Noise in volt readings

It does sound like it could be noise, or possibly a loose connection.  What R value are you using to construct your mid-rail?  Is it a 3.3V system, or a 5V system?  Does a DC multimeter on the mid-rail show up a nice steady voltage?    I assume the spike is too brief to catch on a multimeter?  You mentioned a 33R, where does that fit into things?  And with the transformer switched off, how steady are the readings on just the mid-rail?

peterhum's picture

Re: Noise in volt readings

Hi - thanks for the reply.

Sorry - 33 ohm is on the current sensor. I'm getting myself confused.

It's 5V. Not sure what mid rail is. Is that the 2.5V offset? In which case I'm using 200k resistors cause that's what I had on hand. And '5V' supply measures 4.82V on the multimeter and the 2.4V on the offset looks good on the multimeter.

Will check the readings with transformer switched off this evening.

Thanks

Peter

Robert Wall's picture

Re: Noise in volt readings

Note that, contrary to intuition, a high value pair of resistors in the voltage divider that produces the bias/mid-rail/offset does not increase the overall noise. Reducing the resistors decreases the noise voltage but increases the bandwidth to compensate exactly!

My guess is it is noise spikes getting through the transformer, so a physical low-pass filter (but with a corner frequency high enough to not give an appreciable phase shift at mains frequency) might help.

dBC's picture

Re: Noise in volt readings

One common technique to help with the phase shift is to always put the exact same filter on all your V and I input channels.

peterhum's picture

Re: Noise in volt readings

Thanks very much for the help, really appreciate it.

I'm thinking that the first thing I'll do is solder all the components to some vero board to eliminate contributions from dodgy connections. I'll stick with the high resistor values I'm using. And I'll do some research on a 'physical low pass filter'. All new to me but interesting.

Cheers

Peter

Robert Wall's picture

Re: Noise in volt readings

"physical low pass filter" - by that I meant not a software filter. Try here for a start: http://en.wikipedia.org/wiki/Low-pass_filter. If you look at the simple RC filter, you already have a 9.2 kΩ resistor (approx.) in the form of your 10:1 voltage divider, so a capacitor of 3.3 nF from the voltage ADC input to 0 V will give you about 0.6 ° phase shift at 50 Hz, and a corner frequency of about 5 kHz. You can probably live with that phase shift, though you'll need to compensate for it in the software with PHASECAL.

But first, you definitely need to eliminate bad connections, and make sure you have a good 0 V connection to your power supply negative. Also, keep the connection to the analogue input as short as reasonably possible.

dBC's picture

Re: Noise in volt readings

And if you want to see a scope picture of such a filter in action, you can find it in this thread:

http://openenergymonitor.org/emon/node/9956

That signal is a current signal, rather than a voltage signal, but the principle is the same.  If you want to read up on why you want to keep that high frequency junk out of your ADC conversions, include "anti-aliasing filter" in your searching.   A low pass filter connected to an ADC input is often referred to as an anti-aliasing filter to highlight its purpose.

If you do have joy with the filter on V,  for the trivial price of a few more components and a bit more soldering, you might want to also consider replicating it on all your current inputs.  You may well then give a shop-bought monitor a run for its money with regards noise.  As far as I can tell, they don't seem to do any filtering on their analog inputs.

peterhum's picture

Re: Noise in volt readings

Thanks very much Robert, dbc.

I haven't done anything with the low pass filter as yet, but was interested in reading up on them. The thing that worked for me was to use an external analog reference on the Arduino. As soon as I did that the readings all settled down. I don't understand why that should be at all. I was previously using the +5V line from the Arduino across the voltage divider that provided the 2.5V offset, and then using the internal Aref, the Arduino being powered off the USB.

I switched to an external 9v supply and used 5v from a 7805 regulator for the offset and the Arduino external aref, and all the inconsistencies fell away. This was prompted by this guy's post:

http://technobabble.prithvitech.com/stabilizing-the-arduino-analogread/

Is this something that everyone knows about and does as normal practice?

I'll come back to the low pass filter if I may.

Cheers

Peter

Robert Wall's picture

Re: Noise in volt readings

I've deleted your near-duplicate post. Please check that posts are not held for moderation before duplicating your posts.

We've long suspected that noise from the digital side is getting into the ADC, and that Arduino boards are worse than the emonTx (and especially worse than the emonTx V3.4), so it's very good (in a way!) to hear how you solved your problem.

dBC's picture

Re: Noise in volt readings

I'm glad you found a solution that solves your problems.  I suspect there are quite a few variables contributing here, including but probably not limited to:

. cleanliness of your USB supply

. does your Arduino have a decoupling cap on AREF (some do, some don't)

. does your Arduino connect AVCC to VCC via an inductor (some do, some don't)

. layout and design of your Arduino

As it happens I recently did a very similar experiment to the one in your pointer, and got much cleaner results than he did, and you can see from the photo​ I've made no attempt to keep signals short or prevent noise.  If anything, they look like antennas: http://openenergymonitor.org/emon/node/6196.

Of course my experiment (and the one in your pointer) is a much simpler environment than yours... no 50Hz AC signals bouncing around mid-rails... just straight DC measurements.

If you do decide to also investigate the low-pass filter, the relevant bit in the AVR datasheets says:

Signal components higher than the Nyquist frequency (fADC/2) should not be present for either
kind of channels, to avoid distortion from unpredictable signal convolution. The user is advised
to remove high frequency components with a low-pass filter before applying the signals as
inputs to the ADC.

And you'll find pretty similar text in the datasheet for any ADC from any manufacturer (and any text book about ADC conversions).

 

Comment viewing options

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