Pages: [1]   Go Down
Author Topic: analogRead fluctuates  (Read 497 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everybody, I've written a program that constantly uses analogRead to measure the voltage being outputted by a sensor I made.  I am testing the voltage with a voltmeter and it's very steady, but the arduino reading is fluctuating by 0.05 to 0.2 volts around what the voltmeter says.  When I measure ground directly it seems to be fine.  Any ideas what could be the problem?  I tried grounding the analog pins that I wasn't reading from, but it didn't help.  Thanks!
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34143
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is normal. Either put a 0.1uF cap across the voltage input or average ten or so readings.
Logged

Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

1.
the voltmeter averages its readings...
it doesnt update the display 5000 times per second... smiley
2.
possibly ur reference voltage is not very stable?
those 5V from the USB are not very stable...
3.
ur sensor might have some noise on the output that u cant c...
e. g. 50Hz/60Hz mains power lines cause some noise...
but 0.2volts (appr. 40LSB @Vref=5V) sounds a little bit too noisy...
Logged

-Arne

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
fluctuating by 0.05 to 0.2 volts around what the voltmeter says.

That's 1 - 4 lsb. Typically a fluctuation of 1-2 lsbs is normal. So yours is slightly outside of that range, which could be due to the sensor's output - put it on a scope for sure.

BTW, the fluctuation you observed is the reason the adc module makes a good random number generator.
Logged

Pages: [1]   Go Up
Jump to: