ADC pin to GND, doesn't show full zero #16558
-
Hello! Is it normal ,that when I connect ADC pin to GND IDE doesn't show full zero? ADC Value: 272, Voltage: 0.01 V, Raspberry Pi Pico with RP2040 import machine
import time
adc = machine.ADC(26)
vref = 3.3
conversion_factor = vref / 65535
while True:
raw_value = adc.read_u16()
voltage = raw_value * conversion_factor
print(f"ADC Value: {raw_value}, Voltage: {voltage:.3f} V")
time.sleep(0.1) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
ADCs in general purpose MCUs like the RP2340 usually lack precision. Especially at the end of the range they show greater non-linearity, and the effective resolution is smaller than the claimed bit width. The ADC of the RP2040 has more issues. See e.g. https://forums.raspberrypi.com/viewtopic.php?f=144&t=299904 and https://forums.raspberrypi.com/viewtopic.php?f=144&t=299904&p=1833277#p1833277 |
Beta Was this translation helpful? Give feedback.
ADCs in general purpose MCUs like the RP2340 usually lack precision. Especially at the end of the range they show greater non-linearity, and the effective resolution is smaller than the claimed bit width. The ADC of the RP2040 has more issues. See e.g. https://forums.raspberrypi.com/viewtopic.php?f=144&t=299904 and https://forums.raspberrypi.com/viewtopic.php?f=144&t=299904&p=1833277#p1833277
If you need a precise ADC, use external devices designed for dealing with analog values, like for instance the ADS1115 of analog devices.