Go Down

### Topic: Wandering AnalogRead() results (Read 310 times)previous topic - next topic

#### JKagan

##### Feb 26, 2018, 09:56 pm
Disclaimers:
- Arduino newbie
- I've searched the forums, but haven't yet found anything that sounds applicable
- This is such a simple problem that either I'm doing something wrong or something is broken - this can't be normal

Arduino Uno.  Stable input voltage going into A0 (let's say 1.771volts, for example), confirmed with a meter right on the Arduino A0 and GND pins.  Power from an external power supply measured at a stable 9.15 volts on VIN and GND.

AnalogRead() and print every second.  Values wander from 362 to 369 (which I calculate to back to 1.769 and 1.804 volts, respectively).  The range is the same regardless of the input.  IOW, the range of wandering isn't a percentage of the ADC value, but the same 7 point difference for low values and high values.  This seems way too big of a variation to be normal.

Help!

Let me know what other information I can provide, or tests I can do.

John

Output:
362, 1.769volts
366, 1.789volts
366, 1.789volts
367, 1.794volts
366, 1.789volts
363, 1.774volts
365, 1.784volts
365, 1.784volts
363, 1.774volts
363, 1.774volts
364, 1.779volts
365, 1.784volts
367, 1.794volts
366, 1.789volts
362, 1.769volts
365, 1.784volts
365, 1.784volts
363, 1.774volts
363, 1.774volts
363, 1.774volts
366, 1.789volts
368, 1.799volts
369, 1.804volts

#### ballscrewbob

#1
##### Feb 26, 2018, 10:47 pmLast Edit: Feb 26, 2018, 10:47 pm by ballscrewbob

You could also try to use a sketch that has a running average (best bet)

One such example HERE

Another trick passed to me on these forums was to take a reading and ignore it then take the next reading.
In my case that pretty much worked for me.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

#### CtrlAltElite

#2
##### Feb 26, 2018, 11:02 pm
Ripple on the supply?
Or is it a battery?
Does using the internal voltage reference improve things?
Has there been an outbreak of the stupid virus, and I didn't get the memo?

#### JKagan

#3
##### Feb 27, 2018, 12:25 am

You could also try to use a sketch that has a running average (best bet)

One such example HERE

Another trick passed to me on these forums was to take a reading and ignore it then take the next reading.
In my case that pretty much worked for me.

Hi Ballscrewbob,

The readings never stabilize - I can let the loop run as long as I want, and the numbers still wander

Ripple on the supply?
Or is it a battery?
Does using the internal voltage reference improve things?
Hi CtrlAltElite,

I initially suspected that the power supply voltage was wandering, but the meter shows it at a stable 9.15v.

I've also tried unplugging the external power and using USB power.  I then got 4.2v measuring at VIN and GND (which may not be the right place to measure the USB power).  Oddly (to me, anyway), the ADC reading also changed from about 363 to about 380 for the same 1.771v A0 input, and still wanders.  I was surprised that the ADC reading was different depending on the power supply.

I'll have to research what "internal voltage reference" means - I'm not sure how to use that in this situation.

Is it possible that the internal DAC is "broken"?  Does this happen?

#### Delta_G

#4
##### Feb 27, 2018, 12:32 am
I was surprised that the ADC reading was different depending on the power supply.
That isn't surprising.  The ADC doesn't know what 5V is.  It gets that from what you feed it.  So if you're feeding it a slightly different voltage (USB vs. internal regulator) then you've moved the 5V point on the scale so things read different.

I'll have to research what "internal voltage reference" means - I'm not sure how to use that in this situation.
Yes, the voltage reference is the problem there.  If you want to keep things more stable you should maybe use the 1v1 internal reference since it will stay stable even when you change input voltage.

However you're still going to see some drift.  It's just the nature of these things.  Remember how much you paid for it.

Is it possible that the internal DAC is "broken"?  Does this happen?
Yes, it happens.  It's picking up noise.  There is a whole field of engineering dedicated to keeping signals like that clean.
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Go Up