Troubleshooting · ADC · Arduino Uno / Nano · ESP32 · ADS1115

analogRead Values Fluctuating? Fix ADC Noise on Arduino & ESP32

analogRead fluctuating? The sensor hasn’t moved, but the Serial Monitor says

512→ 506→ 519→ 503

Before you blame the sensor, check what the ADC measures against: its reference voltage.

Ramanu Systems · Pune, India · 3-minute answer, 12-minute deep dive

Quick answer

On an Arduino Uno or Nano, analogRead() measures your sensor as a fraction of the 5 V supply. On USB or a phone charger, that 5 V is noisy, so every reading wobbles with it. On an ESP32, Wi-Fi bursts and the ADC’s own noise add even more.

Fix: give the sensor and the ADC reference a clean 3.3 V, add 100 nF at the input, and average a few readings. On ESP32, use ADC1 pins, or move to an ADS1115 on a clean rail.

SymptomReadings jump while nothing changes
Likely causeNoisy reference: USB 5 V or a shared 3.3 V
FixClean 3.3 V on AREF + sensor, 100 nF, averaging
Show me the fix ↓ Test it with 1 AA cell Using an ESP32?

Is this your problem?

If two or more of these sound familiar, the reference or supply is your prime suspect:

  • Readings jump by several counts with nothing changing
  • It’s worse on a phone charger, or when the laptop is charging
  • It gets worse when Wi-Fi, a servo or an LED strip turns on
  • Temperature from a TMP36 / LM35 wobbles by a degree or more
  • pH, TDS or soil readings drift and never settle
  • ESP32 raw values scatter by tens of counts

Why it happens, in one picture

An ADC doesn’t measure volts directly. It measures your input as a fraction of a reference voltage: reading = Vin ÷ Vref × 1023. On an Uno or Nano the default reference is the board’s own 5 V. If that 5 V wobbles by 1%, a mid-scale reading wobbles by about 5 counts, even though your sensor didn’t change at all.

Arduino analogRead of a fixed 1.5 V input: with the USB 5 V reference readings jump ±8 counts; with a clean 3.3 V reference from the LN-7A2033 on AREF they stay within ±1 count
Figure 1. Same input, same code. The only change is what the ADC uses as its reference. Example values for illustration.

Does it affect your sensor? It depends on the type

Some sensors are dividers: their output is a fraction of their own supply (pots, LDRs, thermistors). If the sensor and the ADC reference share the same rail, supply noise mostly cancels. Others output a fixed voltage (TMP36, pH modules, a battery divider). For those, every bit of reference noise lands in the reading.

Divider sensors (potentiometer, LDR, thermistor, FSR) need the sensor and reference on the same clean rail; voltage-output sensors (TMP36, LM35, pH, battery divider, AD8495) need a clean AREF or an external ADC
Figure 2. Either way, the cure is the same: one clean 3.3 V for both the sensor and the reference.

The 2-minute test: is it the ADC or the sensor?

Take the sensor out of the picture and give the ADC something perfectly steady to measure: a single AA cell. At about 1.5 V it’s inside the range of both Arduino and ESP32 inputs, and it’s electrically quiet.

Flowchart: disconnect the sensor, connect one AA cell to A0 and GND, print 100 readings; if they jump more than ±2 counts the reference or supply is noisy, otherwise check sensor wiring
Figure 3. Connect the AA cell’s + to A0 (or ESP32 GPIO34) and − to GND. Use one cell only. Then run the board from a phone charger and repeat: if the spread grows, your supply is the problem.
// Print the spread of 100 readings
void loop() {
  int lo = 1023, hi = 0;
  for (int i = 0; i < 100; i++) {
    int v = analogRead(A0);
    lo = min(lo, v); hi = max(hi, v);
    delay(5);
  }
  Serial.print("min "); Serial.print(lo);
  Serial.print("  max "); Serial.println(hi);
}

The fix for Arduino Uno / Nano, in 3 steps

  1. Make a clean 3.3 VFeed a dedicated low-noise 3.3 V regulator from the Arduino’s 5 V pin. Its output becomes your quiet analog rail.
  2. Use it for AREF and the sensorConnect the clean 3.3 V to the AREF pin and to the sensor’s VCC. In setup(), call analogReference(EXTERNAL) before any analogRead(). Readings now run from 0 to 3.3 V, so keep the sensor output below 3.3 V.
  3. Add 100 nF and averagePut a 100 nF ceramic capacitor from the analog pin to GND, close to the board. Then average 8 to 16 readings in code. Together these remove what little noise is left.
Wiring: Arduino 5V to LN-7A2033 VIN, GND to GND, LN-7A2033 VOUT clean 3.3 V to AREF and sensor VCC, sensor OUT to A0, with analogReference(EXTERNAL) in setup
Figure 4. One clean 3.3 V rail feeds both AREF and the sensor. Works the same on Uno R3, Nano and Pro Mini (5 V versions).
const float VREF = 3.300;   // measure VOUT with a multimeter and put the real value here

void setup() {
  analogReference(EXTERNAL); // FIRST line: before any analogRead()
  Serial.begin(115200);
}

float readVolts(int pin) {
  analogRead(pin);                       // discard first reading after switching pins
  long sum = 0;
  for (int i = 0; i < 16; i++) sum += analogRead(pin);
  return (sum / 16.0) * VREF / 1023.0;
}

void loop() {
  Serial.println(readVolts(A0), 4);
  delay(200);
}
Two safety rules for AREF Never put more than 5 V on AREF. And never run analogRead() with something connected to AREF before you have called analogReference(EXTERNAL): the default setting connects AREF to the internal 5 V and the two sources fight each other, which can damage the chip. Make it the first line of setup().
Free first try On an Uno R3, you can wire the board’s own 3.3 V pin to AREF as a quick experiment. It’s usually quieter than USB 5 V. It is a small regulator shared with anything else on that pin, though, and on many Nano clones the 3.3 V pin comes from the USB chip, so results vary. If it isn’t enough, a dedicated low-noise rail is the next step.

Which board are you using?

Your boardDefault ADC referenceWhat to do
Arduino Uno R3 / Nano / Pro Mini 5 VBoard’s 5 V (usually USB)Clean 3.3 V to AREF + sensor, analogReference(EXTERNAL)
Arduino Mega 2560Board’s 5 VSame as Uno: AREF pin + EXTERNAL
ESP32Internal ≈1.1 V reference (no AREF pin)See the ESP32 section: ADC1 pins, 100 nF, averaging, clean sensor supply
Raspberry Pi PicoADC_VREF pin, fed from the 3.3 V rail via a filterPower sensors from a clean 3.3 V; for precision, use an external ADC
Any board, precision needed–ADS1115 (16-bit) powered from a clean 3.3 V rail

Using an ESP32? Read this first

The ESP32’s built-in ADC has no external reference pin, so the AREF trick doesn’t apply. Its readings are also noisy and slightly non-linear even on perfect power. A clean supply still helps: it removes Wi-Fi burst noise from the sensor and the board’s ground. But it works best together with these settings:

Do thisWhy
Use ADC1 pins (GPIO32–39; on most boards 32, 33, 34, 35, 36, 39)ADC2 pins don’t work while Wi-Fi is running
Use analogReadMilliVolts()Applies the chip’s factory calibration
Keep the input below ≈2.45 VEspressif’s recommended range at the default 11 dB setting; readings get non-linear above it
Add 100 nF from the pin to GNDEspressif’s own recommendation for reducing noise
Average 16–64 samplesAlso recommended by Espressif (“multisampling”)
Power the sensor from a clean 3.3 V, not the ESP32’s 3V3 pinThe on-board regulator also feeds Wi-Fi transmit bursts
Need real precision? Use an ADS1115 on a clean 3.3 V16-bit, its own internal reference, I²C. The ESP32 just reads the result

The clean analog rail we designed for this

TrueVolt LN-7A2033 · Clean power for sensors, radios & audio

Feed it from 5 V. Use its 3.3 V for AREF, your sensors, or an ADS1115. Three pins, no code.

  • 7 µVrms noise: hundreds of times below one Arduino ADC step (3.2 mV)
  • 95 dB ripple rejection at 1 kHz blocks USB and charger noise
  • 300 mA: powers several sensors plus an ADS1115
  • Genuine TI TPS7A2033, Samsung capacitors, ferrite filtering, aluminium PCB
  • Reverse-polarity and reverse-current protection. Designed & made in Pune, India

Still jumping? The other common causes

If the AA-cell test was steady but your real sensor still jumps, the problem is between the sensor and the pin:

CauseWhat you noticeFix
Floating inputRandom values, changes when you touch the wireMake sure the sensor is really connected; unused inputs read garbage
High-impedance source (above ~10 kΩ)Readings lag, or one channel affects the nextAdd 100 nF at the pin; read twice and discard the first
Long, unshielded sensor wiresNoise grows with cable length or near motorsTwisted pair or shielded cable, 100 nF at the board
Motor or LED-strip current in the sensor’s groundJumps when the load switchesSeparate ground wires that join at one point
The sensor itself is noisy or driftingSteady on the AA test, noisy on the sensorCheck the sensor’s datasheet; pH probes need time and calibration
That’s the practical answer.Engineers who want the numbers, read on.

For engineers: reference noise in numbers

1. One ADC step is smaller than you think

Converter and referenceResolutionOne step (LSB)
Arduino Uno, 5 V reference10-bit≈4.9 mV
Arduino Uno, 3.3 V on AREF10-bit≈3.2 mV
ESP32, 0–2.45 V usable12-bit (fewer effective bits)≈0.6 mV nominal
ADS1115, ±2.048 V range16-bit62.5 µV

A USB port may legally sit anywhere from about 4.75 to 5.25 V, and phone chargers add ripple and switching spikes on top. A few tens of millivolts of movement on a 5 V reference is several LSBs on an Uno, and far more on a 16-bit converter. That’s why the reference must be quieter than the step you want to resolve.

2. Divider sensors cancel noise, but only on one rail

For a pot or thermistor divider, Vin = Vsupply × k. If the reference is the same supply, the reading is k × 1023 and the supply drops out of the equation. That only works if the sensor and the reference really share one node. Separate rails, long wires or ground currents break the cancellation. Voltage-output sensors never cancel: reading = Vsensor ÷ Vref × 1023, so a 1% reference error is a 1% reading error.

3. Why the TPS7A2033 suits a reference rail

Parameter (TI datasheet)ValueWhy it matters here
Output noise7 µVrms (10 Hz–100 kHz)About 1/450 of one Uno LSB at 3.3 V; even small next to an ADS1115 step
PSRR95 dB at 1 kHzBlocks USB and charger ripple from the 5 V side
Dropout140 mV at 300 mAKeeps regulating even when USB sags
Output current300 mAAREF plus several sensors and an external ADC

A low-noise LDO is a quiet reference, not a precision one. For absolute accuracy, measure the actual output with a good multimeter and use that number in your code (the VREF constant above). For lab-grade accuracy over temperature, use a dedicated voltage-reference IC.

What a clean supply won’t fix It won’t fix the ESP32 ADC’s built-in non-linearity, a floating input, a sensor that is noisy or drifting by itself, or interference picked up by long cables. Averaging won’t remove slow drift or an offset either. The AA-cell test tells you which problem you have.

Frequently asked questions

Why are my analogRead values fluctuating?

Usually because the ADC’s reference is noisy. On an Arduino Uno or Nano, analogRead measures the input as a fraction of the board’s 5 V, which comes from USB or a charger and carries ripple. Other causes are a floating input, long sensor wires and motor currents in the ground. Test with a single AA cell on the input: if that also jumps, fix the reference.

How do I stop analogRead from jumping on Arduino?

Power the sensor and the AREF pin from a clean 3.3 V regulator, call analogReference(EXTERNAL) at the start of setup(), add a 100 nF capacitor from the analog pin to GND, and average 8 to 16 readings.

What should I connect to the AREF pin?

A clean, stable voltage between about 1 V and 5 V, for example the output of a low-noise 3.3 V regulator. Set analogReference(EXTERNAL) before any analogRead, never exceed 5 V, and keep your sensor’s output below the AREF voltage.

Why is the ESP32 ADC so noisy?

The ESP32’s ADC has noticeable noise and non-linearity of its own, and Wi-Fi transmit bursts add more through the supply and ground. Use ADC1 pins, analogReadMilliVolts(), a 100 nF capacitor and multisampling, and power the sensor from a clean 3.3 V. For precise measurements, use an external ADC such as the ADS1115.

Can I use ADC2 pins on the ESP32 with Wi-Fi?

No. ADC2 is shared with the Wi-Fi driver, and reads fail while Wi-Fi is running. Use ADC1 pins (GPIO32–39) for analog inputs in Wi-Fi projects.

Does averaging fix ADC noise?

Averaging reduces random noise, roughly by the square root of the number of samples. It does not remove slow drift, offset, ripple at a steady frequency or a noisy reference that moves slowly. Fix the reference first, then average.

What is the best power supply for accurate analog readings?

A dedicated low-noise 3.3 V linear regulator, fed from 5 V and used only for the sensors and the ADC reference. For example, the Ramanu TrueVolt LN-7A2033 (TI TPS7A2033, 7 µVrms, 95 dB PSRR at 1 kHz, 300 mA) gives an Arduino AREF, an ADS1115 or a set of sensors a quiet 3.3 V rail.

Fix it today

Give your ADC a reference it can trust

One small module between your 5 V and your sensors: quiet 3.3 V, genuine TI, made in India. Cheaper than one failed demo.

© Ramanu Systems · Precision electronics modules, Made in India · ESP32 ADC guidance from the Espressif ESP-IDF ADC documentation. Arduino AREF guidance from the Arduino analogReference() reference. Regulator figures from the Texas Instruments TPS7A20 datasheet. Found an error? Tell us and we will fix it and credit you.

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart
Scroll to Top