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.
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.
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.