With the Raspi Pico I had a strange experience:
the input impedance was so low that I measured only about 30% of the real voltage, with a 47k resistor in series to the input.
Strange as the datasheet says the impedance should be rather high.
I investigated further and found that the problem was gone when I initialized the concerned pin as input at the beginning.
I thought this was done automatically by the ADC initialization code.
My working code is now like this:
Code: Select all
from machine import Pin, ADC
import time
adc = Pin(26, Pin.IN) # this is needed to turn input to high impedance
adc = ADC(0)
while True:
v = adc.read_u16() / 65535 * 3.26
print(v)
time.sleep(0.5)