ADC voltage reference



  • Hi to all,

    I'm using a gpy with a pytrack 2 and I'm trying to calibrate it getting the voltage reference to P22. So, I run these commands:

    from machine import ADC
    adc = ADC()
    adc.vref_to_pin('P22')

    but when I go measure the voltage on P22 with a voltmeter I get almost 3V. That is not I expected, should be around 1,1V.

    So, anyone can help me about where I'm wrong?



  • @robert-hh thank you so much for your quickly answer.



  • @lolloz Pytrack 2 uses P21 and P22 as SDA and SCL for the sensors, which means that the have a pull-up resistor connected. And P6 is used by the GPY LTE modem.
    So you cannot use vref_to_pin() in that set-up. Since you need a multimeter anyhow, you can get the calibration value by measuring a known voltage with multimeter and the internal adc, get the default vref and calculate the vref value from ratio of externally to internally measured voltage.


Log in to reply
 

Pycom on Twitter