Reducing noise on analog input

Hey guys,

My device is reading in voltage levels using analog input on FEZ Spider socket #10. I use pin #5 for AIN, and have the other AIN pins, #3 and #4, as well as Ground connected to ground.

Below is a sample list of voltage readings I am receiving when the device is connected to a power supply at 0 volts. As you can see, there are fluctuations in the values; and although they only occur in the thousandths, my device performs sensitive calculations based on these voltage levels.

Do any of you know if there is there any way to reduce this noise outside of writing code to filter it?

0.0064
0.0064
0.0096
0.0032
0.0032
0.0064
0.0064
0.0032
0.0032
0.0096
0.0032
0.0032
0.0064
0.0064
0.0064
0.0064
0.0064
0.0064
0.0161
0.0096
0.0032
0.0032
0.0064
0.0064
0
0.0032
0.0064

Thanks!

There are loads of digital filters you can use to filter the signal. The right one to choose would depend on the dynamics of the signal you expect to see.

The simplist is moving average where you just take the average of the last n samples. There are efficient ways to impliment this without having to recalculate the entire average every time.

Or you can do a simple IIR filter where you take
FilteredOutput = X*sampleCurrent + (1-X) * sampleLast

Where X is normally something like 0.1

Personally I use RLP to do some really quick oversampling, which is effectively like the moving average.

More complex filters exist that let you define the characteristics with more precision, but for most things these basic 2 are often good enough.

1 Like

Awesome, thanks for your input - I will look into these suggestions!

also remember that the reference voltage you’re using as the source, ie your normal 3v3 power supply, has to be rock solid to get rock solid analog readings. If you’re doing ultra-sensitive calculations, you’ve taken special precautions for this, haven’t you ? :wink:

@ Brett - what you say is ideally right. However none of the GHI boards bring out the Analog Supply and Ground pins so there isn’t a lot you can do. As these are connected straight to the digital supply rails it is the becomes the source of most of the system noise. :’(

I prefer to use an external ADC if I need a rock solid reading. The GHI boards are notorious for noise on the ADC inputs.

The MCP3428 is a nice 16 bit device that can, with a clean board layout and suitable filtering of the Vdd input, give a nice stable reading depending on the resolution you need.

With a 5000 psi pressure sensor and 4-20mA output get a nice 0.1 psi resolution out of it. The ADC input is 0.4 to 2.0 volts with the current input so not using the full input range either.

It’s not the fastest device but it just works. I’ve used 100’s of them over the years.

2 Likes

as Brett mentioned, there is no real reference voltage for the AD converter. Not ideal, but what i have done once is to add an external 2.5 volt reference IC to an analog input and calculate the VCC (AD-Ref) to correct the ad sample.

1 Like

@ RobvanSchelven - good idea. I might try this.

all great discussions, but my real hidden point was - in the example shown, you think the input signal is solid, but you have other noise sources all contributing to make that non-zero, and you have to take steps to control all that if you’re serious. I feel confident if you go overboard on getting a more stable input 3v3 power to the processor you’ll get similar improvement in results, but to be absolutely reliable, especially when you admit the calculations based on that data are “sensitive”, you need to be deliberate in controlling the power supply.

However I love the idea of a purpose built ADC when the need justifies.