analogRead Wrong Values
Arduino Microcontroller Board
Severity: ModerateWhat Does This Error Mean?
Arduino analogRead returning wrong or noisy values is usually caused by a floating input pin (nothing connected), incorrect voltage reference, or power supply noise. A floating analog pin with nothing connected will return random garbage values — always connect a definite voltage or a pull-down resistor.
Affected Models
- Arduino Uno
- Arduino Mega
- Arduino Nano
- Arduino Leonardo
- Arduino Micro
- Most Arduino-compatible boards
Common Causes
- Floating analog input pin — unconnected pin picks up stray electromagnetic noise
- Incorrect voltage reference — reference set to internal 1.1V but input is 0–5V
- Power supply noise coupling into the analog section
- Sensor output voltage exceeds the Arduino's analog reference voltage — reading saturates at 1023
- Crosstalk between analog channels from fast multiplexer switching
How to Fix It
-
Connect a definite voltage to the input pin.
A floating (unconnected) analog pin will return random values. Even connecting a 10kΩ resistor between the pin and GND (pull-down) will stabilize readings to 0 when no sensor is connected. Always have the pin connected to something that defines its voltage.
-
Check the voltage reference setting.
If you called analogReference(INTERNAL), the reference voltage is 1.1V on Uno/Nano (not 5V). Inputs above 1.1V will saturate at 1023. For 0–5V sensors, use analogReference(DEFAULT) which uses the VCC supply as reference.
-
Add a 100nF capacitor on the analog input.
Place a 100nF capacitor from the analog input pin to GND as close to the Arduino as possible. This forms a low-pass filter that reduces high-frequency noise. Combine with a 10kΩ series resistor for better filtering.
-
Read multiple times and average.
Add a short delay before reading and average several readings to reduce noise. Example: take 16 readings, sum them, divide by 16. Also add a small delay (delay(1)) between readings to allow the ADC multiplexer to settle after switching channels.
-
Ensure the sensor output does not exceed the reference voltage.
The Arduino's ADC reference is 5V (on 5V boards). If your sensor outputs 0–3.3V, readings will only use the lower range (0–676 instead of 0–1023) and appear lower than expected. If the sensor can output above 5V, use a voltage divider to scale the signal down — never connect more than 5V to an Arduino analog pin.
When to Call a Professional
Arduino ADC hardware is standard and reliable. If readings are wrong with a confirmed correct wiring, the analog input pin may have been damaged by an overvoltage input — test with a different analog pin.