Hello, I'm making a rp2040-based device that's powered from USB (via buck converter). I want to know measure the VBUS voltage (5V expected).
So I wired a 10K/10K (+-5%) voltage divider to an ADC pin, and added a 0.1uF cap on the ADC input so very low impedance is exposed during the sampling time of the ADC, to bring the voltage down to 2.5v where it can be read by the ADC.
*adc_init was called beforehand
However, I reliably get a reading of ~2700 (ouf of 4096), i.e ~2.15V (ouf of 3.3V).
I've confirmed on a multimeter the pin at the voltage is 2.5V, and the 5V is 5V.
The readings are stable. I let it sleep for 200ms before so the cap loading is definitely not an issue. (TC for 10k|10k => 5k / 0.1uF = 0.5ms)
I expect 0.1uF to prevent any significant drop related to the ADC input impedance given the sampling time must be << 1us.
Besides, the Pico ADC input impedance is >100k, so with a 5k equivalent resistance to 2.5v, I expect no more than a 5% error even without the cap related to it, and here it's ~15%.
The rp2040 ADC has a 15mV static offset, if I recall correctly, but then again it doesn't justify being 350mV off.
AVDD is wired to VDD i.e 3.3V and AGND is wired to GND. Note AVDD is wired straight to VDD, unlike in the Pico schematics where it is slightly below VDD. So 4096 really is expected to 3.3v.
I have tried forcibly wiring the inside of the voltage divider (ie the adc pin) to gnd, and read <10mV, and to 3.3v, and read <10mV off 3.3v.
I'm very confused and feel I must be blind. It's like the adc input impedance is suddenly <<10kR. Just what could cause what I'm seeing ? There really aren't that many elements at play.
So I wired a 10K/10K (+-5%) voltage divider to an ADC pin, and added a 0.1uF cap on the ADC input so very low impedance is exposed during the sampling time of the ADC, to bring the voltage down to 2.5v where it can be read by the ADC.
*adc_init was called beforehand
However, I reliably get a reading of ~2700 (ouf of 4096), i.e ~2.15V (ouf of 3.3V).
I've confirmed on a multimeter the pin at the voltage is 2.5V, and the 5V is 5V.
The readings are stable. I let it sleep for 200ms before so the cap loading is definitely not an issue. (TC for 10k|10k => 5k / 0.1uF = 0.5ms)
I expect 0.1uF to prevent any significant drop related to the ADC input impedance given the sampling time must be << 1us.
Besides, the Pico ADC input impedance is >100k, so with a 5k equivalent resistance to 2.5v, I expect no more than a 5% error even without the cap related to it, and here it's ~15%.
The rp2040 ADC has a 15mV static offset, if I recall correctly, but then again it doesn't justify being 350mV off.
AVDD is wired to VDD i.e 3.3V and AGND is wired to GND. Note AVDD is wired straight to VDD, unlike in the Pico schematics where it is slightly below VDD. So 4096 really is expected to 3.3v.
I have tried forcibly wiring the inside of the voltage divider (ie the adc pin) to gnd, and read <10mV, and to 3.3v, and read <10mV off 3.3v.
I'm very confused and feel I must be blind. It's like the adc input impedance is suddenly <<10kR. Just what could cause what I'm seeing ? There really aren't that many elements at play.
Statistics: Posted by JBernard — Mon Jan 06, 2025 10:59 pm