How to reduce noise from analog pins?

Status
Not open for further replies.

alexandros

Well-known member
I'm getting a bit of noise from the analog pins of Teensy 3.1 (I'm using potentiometers with multiplexers, specifically CD4051 and 74HC4067, but I get noise even without the multiplexers) both with 13-bit and 10-bit resolution. Is there some circuit (for example, using capacitors) or some code that can help getting rid of the noise?
Is this a known issue?
 
Driving from a low impedance can help. If your analog voltages are derived from a voltage source, using a low noise and high stability vltage reference is better than using the supply rail in terms of noise and stability. Averaging readings can also help to filter out some noise. If your signal of interest has a noown highest frequency then filtering all frequencies which are above that will help with noise.

If you are multiplexing, allow enough time for the ADC sampling capacitor to charge before taking a reading. Filtering capacitors also help the on-ADC capacitor to charge quickly. Tactics like reading eight times, throwing away the first two, throwing away the highest and lowest of the four remaining and returning the average of the four that are left can also help (effectively a median filter).
 
If your analog voltages are derived from a voltage source, using a low noise and high stability vltage reference is better than using the supply rail in terms of noise and stability
Don't really get that, my electronics knowledge is super limited. I'm using Teensy's ground and 3.3V to power the potentiometers.
If your signal of interest has a noown highest frequency then filtering all frequencies which are above that will help with noise
highest frequency? It's 10K potentiometers. What's their frequency? I've no idea. And how to filter it out? With circuit or code?
Tactics like reading eight times, throwing away the first two, throwing away the highest and lowest of the four remaining and returning the average of the four that are left can also help (effectively a median filter)
Won't that take a lot of time? Eventually I'd like to read quite a lot of potentiometers (I'm building a synthesizer controller). Will the Teensy be able to read eight times each knob and then do some more stuff (apart from the averaging calculations I'm also using shift registers with the SPI library that comes with Arduino)?
 
You have a potentiometer going between the voltge rail, which is about 3.3volts, and ground. A portion of that voltage goes into the analog to digital converter. The 3.3 volt rail is not a stable voltage source; there is noise on it and the actual voltage varies a bit depending on the current draw of the teensy and any other chips powered from it. Thus, that shows up as noise on your analog readings.

A voltage reference chip provides a steady, low noise voltage that is not much affected by noise and instability on the power rail. Thus, you get less noise on your readings.

By frequency I mean how fast the changes can occur. Some sensors can produce values thatchange at the rate of kiloherts or even megahertz. Since you mention potentiometers, those can't change values very fast (you can't sweep from one end tothe other more than a few times a second). So you can filter out any frequencies above, say, 100Hz which are due tointerference, noise, etc. That can be a simple capacitor and resistor to make an RC filter. In addition to that analog filtering you can do averaging etc which is a type of digital filtering.

Teensy 3.1 is capable of reading the ADC very fast. Normally it is doing multiple reads and averaging behind the scenes. The limit is not so much how many times it can read one input, but how quickly it can switch to a different input and get a reliable, stable reading from it.
 
A voltage reference chip provides a steady, low noise voltage that is not much affected by noise and instability on the power rail. Thus, you get less noise on your readings.
Do you mean something like this?
 
Probably more like this.

http://www.ti.com/product/lm336-2.5

Those voltage regulators are meant to deliver power. But they're not specifically designed to hold extremely accurate voltage stability, especially as temperature varies. For example, that LD1117 has a 0.5% temperature stability spec, which is actually pretty good for that type of high power regulator. The LM336 is 1.8 mV, which works out to be 0.072%. Likewise, the LM336 has vastly better long term stability. It's designed specifically to be a dependable stable voltage, rather than a source of power to other stuff.

The LM336 is among the cheapest of voltage references. It has not-so-great "initial accuracy". In many applications, you can just measure the actual voltage (if you have a highly accurate voltmeter) and calibrate out the error, which remains fixed because the temperature and long-term stability are good. But there are many other much better, and more expensive, voltage reference chips on the market.
 
Close, but no. Voltage regulators and voltage references are two different things. Voltage regulators are used for powering things. Voltage regulators are designed to provide a precise reference value. Dollar for dollar, a voltage reference would provide a more accurate reference value than a voltage regulator, but you couldn't use a voltage reference if you needed to supply lots of current to run a microprocessor, etc.
 
Also, I should mention a stable voltage reference is usually NOT what you want for reading the position of a pot. When the power for the pot varies, the voltage output from the pot varies with it, so you actually want to be using that same varying power as the analog reference, so the effect (mostly) cancels out.

Usually high source impedance and ground loops are the noise inducing problems when you have lots of digital signals.
 
Also, I should mention a stable voltage reference is usually NOT what you want for reading the position of a pot. When the power for the pot varies, the voltage output from the pot varies with it, so you actually want to be using that same varying power as the analog reference, so the effect (mostly) cancels out.
So you mean that using a voltage reference chip won't help?
Usually high source impedance and ground loops are the noise inducing problems when you have lots of digital signals.
If connecting one leg of a 10K pot with Teensy's 3.3V, the other with ground and the middle leg with an analog pin on Teensy, is there any high source impedance or a ground loop? The answer to this might be obvious but I'm obviously ignorant...
Even if I connect one potentiometer to Teensy, with no multiplexers or other chips, I still get noise. If a voltage reference chip cannot reduce that noise, how would you go about this?
 
So you mean that using a voltage reference chip won't help?

Exactly. In fact, it might even make things worse. For pot position, you want the reference to be the same power that's feeding the pot.

If connecting one leg of a 10K pot with Teensy's 3.3V, the other with ground and the middle leg with an analog pin on Teensy, is there any high source impedance or a ground loop?

There shouldn't be any ground loop if the pot goes directly to AGND and nothing else connects to it or to AGND.

In the center, a 10K pot will have 5K source impedance. Near the ends, it'll be low impedance.
 
There shouldn't be any ground loop if the pot goes directly to AGND and nothing else connects to it or to AGND.
I guess all pots go to AGND, right? Changed my circuit and all other chips (multiplexers and shift registers) connect to Teensy's GND and all the pots connect to AGND, but I still get noise.
Just to clarify, it's not terrible. The noise has a range of twenty values more or less (in 13-bit resolution). Still, if there's a way to avoid this I'd really like to achieve this, as it will make quite some difference.
 
Exactly. In fact, it might even make things worse. For pot position, you want the reference to be the same power that's feeding the pot.
That was exactly what I was suggesting, put the Vref at the top of the pot, GND at the bottom and read the wiper voltage.
 
First, if you have less than 10 us delay from changing the pins to reading the voltage, add delayMicroseconds(10).

Or you could try adding a 1 nF capacitor directly between the ADC pin and AGND. You'll probably need to increase the delay, to allow time for the capacitor to charge.

Lower impedance pots might help, but 10K isn't that high and going to 1K starts to use a lot of power.
 
You might also try 12 bit resolution. The ADC gets configured differently. Not sure if it'll help, but it's a really easy thing to try.
 
You might also try 12 bit resolution
Nope, that didn't help.

I measured Teensy's voltage and it's very steady, at 3V32, so I guess varying voltage is not the problem...
I'm getting flickering values with just one potentiometer, as well (nothing else on the circuit). A 10-bit resolution though seems to be reducing that noise a lot. The input flickers only one value up and down (approximately). Using a 10-bit resolution to the full circuit though (with multiplexers and shift registers) slightly increasing the noise, not in the range of the flickering values, but the frequency. Adding a 10 us delay doesn't seem to be doing much.
Are there any other work arounds?
 
Status
Not open for further replies.
Back
Top