5.1. Working#
As stated previously, an ADC measures voltage and converts that measured value into an appropriate number. To do this, an ADC needs a reference voltage, VREF, which is 3.3V in the case of the μC we are using. Then the ADC maps the voltage range, GND - VREF, to a range of unsigned integer values.
Any ADC that you may encounter, either it’s part of a μC or is an Integrated Circuit (IC) itself, will have a predefined bit depth. What this means is that the range of numbers used to represent the measured voltage values can be between 0 - (2n-1), where n represents the bit depth. For example, the ADC available on the RP2040 is 12-bit. The numbers this ADC can use must be in range 0 - 4095. Thus, if the ADC outputs number 1123 then it must be reading
Note that the bit depth and the reference voltage both define the resolution of an ADC. For a 12-bit ADC that measures voltages from 0V-3.3V has a resolution of
As opposed to this, an Arduino Nano has 10-bit ADC that measures voltage in the range of 0V-5V. Thus, the resolution of the ADC on Arduino Nano would be
Although an ADC has a resolution as high as 0.8mV, it doesn’t mean it is accurate. The accuracy depends heavily on the stability of GND and VREF signals. For example, in Raspberry Pi Pico, the VREF signal provided to the ADC is not very accurate and thus the datasheet (Section 4.3) suggests that an external more stable 3.3V reference should be provided if higher ADC accuracy is desired.