Pages: [1]   Go Down
Author Topic: analog in will not read true  (Read 7179 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying to read a voltage(below 1 volt) on A0, using the analog read/serial sketch, but the readout is nowhere what shows on the LCD of my device... and I know too little to understand the problem! I have a delay in the sketch, have changed that (incr and decr), thinking the problem is latency. No better. The readouts are from zero V up to numbers that have no relationship to reality whatsoever. I can read the voltage out with a standard V/Ohm meter, and as I said there is a LCD on the device (Radio Shack Sun and Sky Monitoring Station). Any ideas?
thanks
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 286
Posts: 25659
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Don't see code, don't see a schematic.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13471
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Any ideas?
yep, have you read this tutorial - http://arduino.cc/en/Tutorial/AnalogInput -

but it could be also some other problem, so please follow AWOL's advice and post all information you have.

The more information in the question the better answer  smiley-wink
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Online Online
Shannon Member
****
Karma: 199
Posts: 11640
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are reading a rapidly varying voltage then analogRead() gives a snapshot of the voltage taken over a few microseconds or so.

A digital multimeter measures a time-averaged value over a substantial fraction of a second.   A voltage with a lot of noise will thus read
as a steady value on a DMM and apparently highly random using analogRead().

Perhaps you need to bandwidth limit the signal of interest with a low-pass filter?
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Got no code, other than the analog in / serial sketch I mentioned. Got no schematic, other than two contact points out of the device marked + and -...

Could I program a way to take several snapshots of the voltage reading and average them? I thought of this, but at this point all the readings seem to be unrelated to one another, and the voltage *should* be a steady reading out, as it is the light reading from a diode, used as a light sensor.

As to the advice about limiting the bandwith of the signal, I will look into that. thank you very much.

My son gave me a MEGA for Christmas... gonna try that, too.

Thanks everyone, and merry christmas/happy holidays!
jim
Logged

0
Online Online
Shannon Member
****
Karma: 199
Posts: 11640
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
and the voltage *should* be a steady reading out, as it is the light reading from a diode, used as a light sensor.

Well there's the obvious issue - what light is falling on the diode?  Fluorescent?  compact fluorescent?  Or is it really a constant
light source such as the sun or tungsten filament bulb?
Logged

[ I won't respond to messages, use the forum please ]

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Got no schematic, other than two contact points out of the device marked + and -...

Got a link to the 'device' that has + and - contact points?

Lefty
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13471
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am trying to read a voltage(below 1 volt) on A0
You can set the analog reference to 1.1 Volt internal to make the ADC more sensitive..
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried setting the ref voltage, but didn't understand how to use the code. I can read a 1.5V battery cleanly, but the readings I need to make are less than 1 V, and I guess the resolution is the problem. Perhaps I can amplify the output with a buffer? I sure wish I knew what I was doing  smiley-confuse
Logged

Indiana, US
Offline Offline
Full Member
***
Karma: 12
Posts: 204
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi eatabean,

Quote
I sure wish I knew what I was doing

We'd love to help, but without a copy of the sketch and a description of your wiring, we're at a loss too!

Copy and paste the sketch in a reply and talk us through the wiring.  The project you describe seems pretty straight forward and shouldn't need anything fancy to make work.

Pat.
Logged

There are 10 types of people in the world, those that understand binary, and those that don't.

Offline Offline
Faraday Member
**
Karma: 57
Posts: 2764
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The analog input will have a voltage input  and will return a result between 0 and 1023.

So if your input voltage is 1 volt  and your  reference voltage is 5V,   the result of the analog input read
operation would be a number around 200.

If you try reading the voltage of a 1.5V battery,   your number in the arduino would be about 300.
Is that what you get when you try measuring the voltage of a battery ?
Logged

Pages: [1]   Go Up
Jump to: