EmbeddedEra EmbeddedEra

← Notes from the bench.

Why a microcontroller ADC reading is noisy or wrong

Oct 28, 2026pcb-designlayoutdesign-for-testDrafted with AI assistance, reviewed and edited by our engineer.

The reading jumps around by many counts with the input held still. Or it is steady but wrong, and the error changes when you touch a different channel. Averaging hides some of it. The rest is still there when the product ships.

Most noisy-ADC problems are not noise in the converter. They are a mismatch between what is driving the pin and what the pin needs. This note walks through the causes in the order we check them, cheapest first.

Start by finding out which kind of error you have

Three symptoms look alike on a bench and have different causes.

  • Random scatter. Readings spread around a mean. This is noise, either picked up on the way in or coming from the supply and reference.
  • A fixed offset or gain error. Readings are tight but wrong. Look at calibration, the reference, and the source network.
  • Readings that depend on the previous channel or on timing. Change the channel order and the answer moves. This is almost always an input that did not settle before the sample was taken.

Capture a few thousand raw samples with the input held at a known, steady voltage and look at the spread and the mean. Then repeat with the input shorted to analog ground at the pin. If the shorted reading is quiet and the connected one is not, the problem is outside the chip. If the shorted reading is already noisy, look at the reference, the supply, and what the firmware and other peripherals are doing while the converter runs.

That one comparison saves hours. It splits the search in half before you open a schematic.

Check the source impedance and sample time first

A successive-approximation ADC input is not a quiet, high-impedance node. Inside the chip, a switch connects the pin to a small sampling capacitor for a short window, then disconnects it. The capacitor has to charge to the input voltage during that window. A high-impedance source cannot supply that charge fast enough, so the capacitor ends up short of the true voltage.

ST’s application note on ADC accuracy for STM32 parts describes the input as an RC circuit and ties the required sampling time to the source impedance: a higher-impedance source needs a longer sampling time to charge the sampling capacitor to within the accuracy you want (ST application note on optimizing ADC accuracy in STM32 MCUs). The exact numbers differ by family and by ADC, so use the sampling-time and input-resistance figures in your own part’s datasheet, not a rule of thumb from a forum.

What this looks like in practice:

  • A resistor divider made of large resistors feeds the pin directly. The reading sags and drifts, and it shifts when you switch channels.
  • A thermistor or sensor with a high output impedance sits on the pin with no buffer. Same symptoms.
  • The firmware leaves the default, shortest sample time selected because the example project did.

Two fixes, in order of preference. First, lengthen the sample time in firmware to the longest your throughput allows. It is free and fully reversible. Second, if the longest setting is still not enough, put a buffer amplifier between the source and the pin. A divider of smaller resistors also works if the extra current is acceptable, which on a battery product it often is not.

Add the right capacitor, not just any capacitor

A common forum answer is “put 100 nF on the pin.” Sometimes it helps. Sometimes it makes things worse.

Analog Devices explains the reason in its article on front-end design for precision SAR converters. When the sampling switch closes, the converter pulls a burst of charge from whatever is connected. The RC filter between the driver and the converter limits wideband noise and absorbs that kickback, but it has to settle within the acquisition time (Analog Devices, front-end amplifier and RC filter design for a SAR ADC). A larger resistor and capacitor filter more noise, but they also settle more slowly and can distort the result at higher sample rates.

For a slow sensor, such as a temperature reading taken a few times a second, this is easy. A modest capacitor right at the pin, fed through a modest resistor, gives the sampling capacitor a local charge reservoir and cuts noise pickup. The capacitor does most of the work of refilling the converter, and the source only has to top it up between samples.

For a faster signal, the filter becomes part of the measurement. Size it against your sample rate and the converter’s acquisition window, and check the datasheet of your specific ADC for what it recommends. If you cannot tell whether a filter is helping, run the shorted-input test and the held-input test again with and without it.

Place the capacitor at the pin, with a short return to the analog ground, not at the far end of the trace. A capacitor three centimeters away from the pin filters the wire, not the converter.

Look at the reference and the supply

If the shorted-input reading is noisy, the converter itself is seeing a noisy reference. On many microcontrollers the reference is the analog supply or a pin tied to it. Any ripple on that rail appears directly in the reading, scaled the same way as your signal.

  • Check that the analog supply pin has its own local decoupling as the datasheet shows, and that the filtering (a ferrite bead or small resistor from the digital rail, where the datasheet suggests one) is actually populated.
  • If the part has an external reference pin, check the datasheet for its required capacitor and keep that capacitor close.
  • Watch the rail with a scope while the radio transmits, a motor starts, or a display refreshes. If the ripple lines up with those events, the scatter is coming from the supply, not from the sensor. We cover one common version of this in why a boost converter fails when the Wi-Fi radio starts.

When the sensor is ratiometric, such as a load cell or a resistive bridge, use the same supply or reference for both the excitation and the converter so that supply drift cancels. The details are in why a load cell reading drifts with an HX711.

Check the layout and the other users of the converter

Layout problems show up as scatter that correlates with something else on the board.

  • Analog traces next to fast digital edges. Clock lines, SPI buses, and switching regulator nodes couple into high-impedance analog inputs. Keep the analog trace short and away from them, and give it a ground reference underneath.
  • Return current through the analog ground. If digital return current flows through the same copper as the analog return, you measure its voltage drop. Route so that noisy currents do not pass under the converter’s ground.
  • A long unterminated sensor cable. The cable acts as an antenna. Put the filter at the connector end of the board, and consider what the cable is exposed to.

Then look at firmware, which people skip.

  • Shared converters. On the ESP32-S3, Espressif’s documentation notes that ADC2 is also used by Wi-Fi, and that a read can time out and return an invalid result when another driver holds the converter (ESP-IDF one-shot ADC driver documentation). Check the return code on every read. A reading you did not validate is not a measurement.
  • Calibration. The same documentation points to a calibration driver for converting raw counts to millivolts. Raw counts from a part with a nonlinear response look like a gain or offset error even when the hardware is fine. Use the vendor’s calibration path before you blame the board.
  • Channel switching. If you scan many channels, discard the first sample after each switch, or give the converter extra sample time, so that the previous channel’s charge does not carry over.
  • Activity during conversion. Large current steps from a radio burst, a GPIO bank toggling, or a display DMA transfer during the sample window add scatter. Where you can, take the sample at a quiet moment, or trigger it from a timer aligned with the quiet part of the cycle.

Averaging and oversampling then do their proper job. They reduce random noise that is already small. They do not remove an offset caused by an unsettled input, and they cannot fix a reading that is correlated with a supply event.

What it costs to fix, in time and risk

The firmware changes, such as sample time, discarded samples, calibration and return-code checks, cost a few hours and carry little risk. The input network, such as a buffer or a filter, can be tried on a bench board with a soldering iron and usually settles the question in a day. A layout change means a new board revision. That is the expensive one, so it pays to prove with the shorted-input test, and a probe on the supply, that the layout really is the cause before you spin a board.

How we approach it

We run the shorted-input and held-input comparison first, then work outward from the pin to the source, the reference, the layout and the firmware. If you send the schematic, the layout files, the part number and a capture of raw samples taken with the input held steady, we can usually say which of those it is before touching hardware.

Your sensor reading is noisy or offset at the microcontroller pin, and we would trace it through the source, the input network, the reference and the layout.

ENGINEERING NOTES

One note a week on PCB design, firmware and getting hardware built. No sales email.

Double opt-in. Unsubscribe in one click.