cancel
Showing results for 
Search instead for 
Did you mean: 

unstable ADC readings

rkunert9
Associate II
Posted on August 19, 2009 at 08:32

unstable ADC readings

6 REPLIES 6
rkunert9
Associate II
Posted on May 17, 2011 at 13:20

Hi,

I'm using the STM32F103VET6 and try to use the ADC1. I read the channels manually:

Code:

ADC_RegularChannelConfig(ADC1, 1, 1, ADC_SampleTime_7Cycles5);

ADC_SoftwareStartConvCmd(ADC1, ENABLE);

while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET);

return ADC_GetConversionValue(ADC1);

I read the values with a frequency of about 10Hz, but they are unstable. The variations are in a range of 50-100 digits, which seems to be much too high. I already blocked the ADC input with a 10nF to GND and I also followed the ST AN and blocked the supply voltage with 100nF.

Of course I can do some filtering in software, but from my opinion this is not the right way.

How can I reach a stable reading from the ADC?

Best regards

Ralf

raptorhal
Associate II
Posted on May 17, 2011 at 13:20

Since your sample frequency is low, try increasing your sample time to 28Cycles5.

Cheers, Hal

konstantin23
Associate II
Posted on May 17, 2011 at 13:20

Have you checked your input impedance? The datasheet has a formula for max Rain. It depends on your frequency, but with 7.5 cycle samples impedance needs to be pretty low.

st3
Associate II
Posted on May 17, 2011 at 13:20

Quote:

The variations are in a range of 50-100 digits, which seems to be much too high.

Why does that seem ''too high''?

What have you done to confirm that the signal is not actually varying by that much?

eg, have you looked at it with an oscilloscope?

Quote:

How can I reach a stable reading from the ADC?

You cannot reach a stable reading if the signal is unstable - so the first thing you must do is to confirm whether or not the signal itself is actually stable - eg, with that 'scope...

miles
Associate II
Posted on May 17, 2011 at 13:20

I agree with Ralf, you should look at your signal on a scope. Besides the signal you're measuring, also look at noise on your supply voltage. Is your supply from a battery, linear regulator, or switching regulator? Switchers tend to be noisy, you may need extra filtering to get acceptable performance.

Using an STM32 in a 64-pin package (with no pin for an external analog voltage reference), I was able to get peak-to-peak noise of from 10 to 25 ADC counts. To get better than that I had to switch to a 100 pin STM32, and start using the external analog voltage reference.

rkunert9
Associate II
Posted on May 17, 2011 at 13:20

Hi,

thanks for all the posts.

I checked the signal with the scope. If I input a fixed DC voltage it's stable and has no noise. The same is with the real signal. Also the supply voltage has no noise.

As a reference voltage I use an external voltage of 3.5V. I checked it also with the scope and found that there is a noise of approx. 300mV on it. I applied some caps to the supply voltage and also to the reference voltage. This solved the problem. Now the readings are stable by about 3-4 digits, which is ok.

Best regards

Ralf