Maker and author Simon Monk has put three popular microcontroller boards through their paces to answer one simple question: which, out of the Espressif ESP32, Raspberry Pi RP2040, and the venerable Microchip ATmega328, delivers the best analog-to-digital converter (ADC) input?
"After some inconsistent and unreliable results reading an analog input from an [Espressif] ESP32 board," Monk explains in a blog post brought to our attention by Adafruit, "I decided to get all scientific and do some experimenting with an ESP32, a Raspberry Pi Pico and an Arduino UNO Rev3. My test setup was a bench power supply providing the reference voltage to be measured by the test board. The output of the bench PSU had a dummy load of a 470Ω resistor and a 100nF capacitor in parallel (the latter largely for superstitions reasons, as the voltage output looks extremely stable on a DMM voltmeter.)"
With this simple circuit set up, Monk connected the output of the benchtop power supply to the analog input of the microcontroller on test — switching it through 0V up to the board's maximum rated input voltage. "I was particularly interested in three things," Monk explains. "Finding any dead-zones at each end of the analog input voltage range. Measuring the reproducibility of the readings. Linearity through the range."
A Wemos LOLIN32 Lite, built around an Espressif ESP32 microcontroller, was the first device on test — delivering an unexpected dead zone between 0V and 0.05V and considerable noise before 0.1V, with 100-sample testing showing ±3 standard deviations (SDs) for almost all samples. "It retains pretty good linearity," Monk notes, "up to the 1V upper limit."
The Raspberry Pi RP2040 on the Raspberry Pi Pico was the next board tested, delivering "smaller 3x SD error bars," Monk explains, "a small dead zone at the low voltage end and some slight tail-off in linearity at the 3.3V end." This latter also reveals another advantage of the RP2040: its analog input can accept up to 3.3V, compared to the 1V limit on the Wemos board.
Finally, the venerable Arduino UNO — tested here in its popular Rev3 form, rather than the considerably overhauled and recently-released R4 variant. "Despite its age," Monk writes, "the Arduino UNO Rev3 is still my go-to board for any experimentation or early stage project work that doesn't need a specific microcontroller." And testing delivered a reward for that loyalty: a highly linear reading from 0V up to 5V, with minimal deviation in the samples.
"On looking at the documentation in MicroPython and learning that the analog readings for a Pico and ESP32 come at a massive 16 bit precision (a number between 0 and 65536)," Monk concludes, "it's easy think that their analog inputs are much better than the paltry 10 bits of an Arduino (0 to 1023 reading range). But this is to confuse precision with accuracy. It's why pure megapixels is not the best way to judge a camera. So much depends on the lens."
The full article is available on Monk's website, along with the source code used to test each microcontroller.