adc.vref looks strange
-
Hi all!
While I try to automate the calibration of the ADC, I found a strange behaviour. I output the adc.vref with adc.vref-to_pin('P22') and measure it with my Keithley 2001. Expecting something stable around 1.1V, I only get something VERY noisy, at arround 0.7V.
ADC and DAC work very well. Just the output of vref is pretty bad.My hardware is a custom baseboard with a L01 on it. Nothing is connected to P22, except the connector and the Keithley. I switched all radios off.
Except this special behaviour, the boards work pretty well.Any idea?
Cheers,
Thomas -
@Thosch42 Add a capacitor of ~100nF to the output. That helps.
-
@robert-hh With 100n to GND, I get very noisy 200mV :-(
-
@Thosch42 Which module do you use? I know that I had a similar problem, and I recall that adding a capacitor helped. But I will try again.
-
Now I connected an external reference voltage to all adc channels, and adjusted the Vref value iteratively to 1106 mV. All adc channels give me the correct value now.
As a workaround it's ok, but not as expected. -
@Thosch42 Well, I tried it again, and it works nice, showing 1.105V. Strange thing: after connecting the probe again after a while, the output was gone, and I had to repeat the vref_to_pin() call.
-
@robert-hh It's a L01
-
So, recently I've also noticed some inconsistencies in some ADC measurements (for a battery voltage measurement using a resistor divider) and I tried to come up with a standard verification-calibration procedure: activate
vref_to_pinand measure the voltage in another GPIO pin, for exampleP13. I am also using a 100uF betweenP13andGND.The code snippet for my tests is:
import utime from machine import ADC import machine _NUM_ADC_READINGS = 50 _MEAS_PIN = 'P13' # define measurement pin adc = ADC() #adc.vref(1100) adc_input_pin = adc.channel(pin='P13', attn=machine.ADC.ATTN_2_5DB) adc.vref_to_pin('P22') # Output Vref of P22 while(True): # measure actual vref : single-shot #print(adc_input_pin.voltage()) # multi-shot tmp = 0.0 for _ in range(0,_NUM_ADC_READINGS): tmp+=adc_input_pin.voltage() print(tmp/_NUM_ADC_READINGS) utime.sleep_ms(5000)I am getting significant inconsistencies in the output. Normally I expect to get something close to
1100, right? But depending on firmware version (playing with1.18.2.r7and1.20.0.rc13) and the device (I am playing withLoPy4modules for now, but I will make some tests with other modules soon).In particular, I am getting values either close to
1100(e.g.1050) but also really low values, close to300.
Any ideas on that?
If someone could also repeat those tests on his/her modules, that would be helpful.Thanks!
-
@agotsis Without any opposite knowledge, I would consider 100µF as capacitor too high. Something like 10nF should be sufficient.
But I had also observed that the VRef output only seems to stay for a short period, and then it is switched off.
There should not by any difference in the VRef value depending on the firmware version, since it is a hardware property. But it should vary between devices and eventually with environment factors like the temperature. -
@robert-hh This was a typo, i meant
100nF(ceramic capacitor with value104) :-)
Yes, I understand that the firmware should not be of an issue, this was really strange and inconsistent.
Regardingvref_to_pin()call, at least for 10-20 secs the 1.1V output seems not to switch-off (i had a voltmeter connected permanently).
I am also suspecting issues with ground-cabling in the breadboard, but I hope the capacitor would deal with them.
Anyway, the thing is that I observed really large differences in the observed values when changing modules. For example for a 3.9V battery voltage using 3 different modules I got3.9V,3.7Vand3.6V.
I will re-run the tests and report again.
Thanks!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login