Electronic – Arduino incorrect readings from analog pin

analogarduino

One of my analog pins, A0, on my Arduino Uno, is not giving totally accurate results. Where as one of the other pins will do a full 0-1023 in a certain use case, the problem pin only seems to be outputting around 50-730.

Is this pin getting interference somehow, or is it perhaps defective?

Best Answer

I was running into the same issue, I tried reading voltage input on A0 and A1 (just to see if A0 was bad) and I was getting values higher than expected.

3.6 instead of 3.4

so the line

voltage = sensorValue * (5.0 / 1023.0);

wasn't outputting the correct value

My Arduino mega 2560 was being powered by rasberry pi via USB

Solution:

Supply your arduino board with regulated dc input and don't rely on USB power for your 5v or 3.3v boards.