The board uses voltage dividers to scale the 24V and 48V battery voltage levels to the 0–3.3V range accepted by the GPIO pin. Therefore, we need to scale the values back.
According to this tutorial the register is updated every 2µs to a value in the range [0, 2^12). Reading the value with machine.ADC().read_u16() will scale the value to [0, 2^16).
On the Pico, the VSYS voltage level can also be monitored by ADC3; this should approximately follow the 24V battery voltage level.
ADC1
(GP27
)ADC2
(GP28
)VSYS
/3ADC3
(GP29
)VBUS
presenceGP24
The board uses voltage dividers to scale the 24V and 48V battery voltage levels to the 0–3.3V range accepted by the GPIO pin. Therefore, we need to scale the values back.
According to this tutorial the register is updated every 2µs to a value in the range [0, 2^12). Reading the value with
machine.ADC().read_u16()
will scale the value to [0, 2^16).On the Pico, the
VSYS
voltage level can also be monitored byADC3
; this should approximately follow the 24V battery voltage level.