Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

In RP2040

The RP2040 microcontroller features a built-in 12-bit ADC with multiple input channels, giving you 4,096 distinct levels to represent voltages from 0V up to the ADC reference voltage. With a nominal 3.3V reference, this produces a step size of approximately 0.806 mV.

On the RP2040 chip, the ADC is powered from a pin called ADC_AVDD. The ADC reference voltage is provided on a separate pin, ADC_VREF. The reference voltage sets the maximum voltage the ADC can measure. In practice, both ADC_AVDD and ADC_VREF are typically connected to 3.3 V on the Pico board.

On the Raspberry Pi Pico board, this is already taken care of for you. The board connects the 3.3 V supply to the RP2040 ADC_VREF pin through a small filter made from a resistor and a capacitor. This helps reduce noise on the ADC reference and improves ADC behavior.

The Pico also exposes this filtered reference on a pin labeled ADC_VREF (physical pin 35). By default, you do not need to touch this pin and can use the ADC as is. For more advanced use cases, this pin can be driven externally with a suitable reference voltage if required, but this is optional and not necessary for beginner projects.

For now, it is enough to remember that the RP2040 ADC is 12-bit, measures voltages up to its reference voltage, and that the Pico board already provides a safe and stable default setup.

ADC Channels and GPIO Mapping on Raspberry Pi Pico

The RP2040 ADC has multiple internal channels. On the Raspberry Pi Pico, four of these channels are connected to GPIO pins that can be used as analog inputs.

GPIO PinADC ChannelFunction
GPIO26ADC0Can be used to read voltage from peripherals.
GPIO27ADC1Can be used to read voltage from peripherals.
GPIO28ADC2Can be used to read voltage from peripherals.
GPIO29ADC3Measures the VSYS supply voltage on the board through a resistor divider.