Analog Read Problems.

Hello, i have an Arduino Uno plugged in with a Ethernet Shield.

The problem is when I try to read from the analog pins they are not working correctly.

I read from analog pin number 4, and if the pin is not connected to anything it measures 5v, when i connect it to a sensor that puts out 2.3V it measures 2.5V and no matter how much the sensor changes it stills measures 2.5V.

I tried all the analog pins. And when i connect it to ground it does measure 0V.

What does a multimeter say about the voltage from your sensor?

Thats my problem, when I measure a voltimeter from the sensor output to GND it says 2.3V and when the sensor is active it says 2.0V

How ever, the analog reading is always stuck at 2.5V, and it doesnt even change when the sensor is active or not.

I dont know if it has something to do with the Ethernet Shield..

chelo_c: Hello, i have an Arduino Uno plugged in with a Ethernet Shield.

The problem is when I try to read from the analog pins they are not working correctly.

I read from analog pin number 4, and if the pin is not connected to anything it measures 5v, when i connect it to a sensor that puts out 2.3V it measures 2.5V and no matter how much the sensor changes it stills measures 2.5V.

I tried all the analog pins. And when i connect it to ground it does measure 0V.

Do you have the analog reference set wrong? The Arduino board can use an external reference or an internal reference of 1.1 volts, 2.56 volts or 5 volts (different ones available on different boards).

If, for example, your reference is set to 1.1 volts and you put a 2+ volts input on the analog pin, of course the reading will peg at 1023 (which you usually think of as "5 volts"). Likewise if you use the 2.56 volt reference, anything over 2.56 volts will peg the reading at 1023.

Also, if you are using an EXTERNAL reference, you need to actually provide one, else the reference input will float wherever it wants to and your analog readings will be worthless.

Hope this helps.

If you're reading from more than one analog channel, you need to discard the first reading after switching channels. You can do this by just taking 2 readings in a row.

You only need to read twice if switching to a source with an impedance greater than 10k, or the very first time you read any analog pin.

A4 is shared with the I2C bus - do you have anything on the I2C bus?

What value is being returned from analogRead ()? - you're assuming you've calculated the voltage value correctly from this, I am not...

How ever, the analog reading is always stuck at 2.5V, and it doesnt even change when the sensor is active or not.

What is this statement based on ? (considering that no arduinos read back in voltage) (sort of what Mark meant by this:

What value is being returned from analogRead ()? - you're assuming you've calculated the voltage value correctly from this, I am not...)

Can you post your code and a schematic of your circuit ?