AnalogReadAccuracy

I am getting various voltage codes when doing analogRead(0).

Nothing is connected to the pin and I get 150-160. doing a digitalWrite(3,HIGH) increases this to about 270-275.

I thought and expected this value to be 0.

Any ideas.

Thank you
Zach

Hi

the analog inputs, and the digital ones as well, are designed to consume very little current. This means in turn that they are very high impedance: when you connect them to a circuit, the circuit has to divert very little current (on the order of microamperes) into the input pin.

What this means in practice is that without anything connected, the pins are so sensitive that they will 'float' in value. Electromagnetic signals in the air around the pin will cause different readings. So, to get proper readings, they have to be always connected to a circuit. You will get all kinds of crazy values form an unconnected pin... tie the pin to ground, and the analogRead() will return 0... Tie it to a voltage divider, and it will return the exact value of the voltage divider's centre pin.

D

Thank you. Zach :)