problem measuring battery voltage



  • hello,

    i measure the battery voltage from pin16 using lopy 4/exp Board 3.0r.
    here is a code for demonstration.

    adc = ADC()
    p_bat = adc.channel(pin='P16', attn=ADC.ATTN_11DB)
    
    vol_bat = p_bat.voltage() * 3.05 #factor from voltage divider
    
    

    vol_bat is about 6050 mV everytime i measure it but it should be 4100.
    did someone have the same problem? how can i fix it?



  • @apo1997 said in problem measuring battery voltage:

    @robert-hh

    even in this post the most recent answer i found is:
    Pycom Expansion board v3.0: 115 kΩ / 56 kΩ
    Pycom Expansion board v3.1: Undocumented, probably like v3.2? (yes, prooved)
    Pycom Expansion board v3.2: 1 MΩ / 1 MΩ

    So this post is wrong too about the 3.0 version i am using.
    These threads are from 2018. We are living in 2020 in few months and pycom still didnt corecct it in their official documentation, thats weird.

    But ty for your answers, 2.067 is a very precise factor for my application!

    Hi, have you even got any offical documentation for the v3.1 of the expansion board? I'm also interested in a circuit diagram of the expansion board. I have strange things happening depending if the board is powered via USB or battery, but I'd really want a circuit diagram to first try and rule out a mistake on my side, before I try and log a "bug"... Also explaining my issue would be much easier if I had the right info...



  • @robert-hh

    even in this post the most recent answer i found is:
    Pycom Expansion board v3.0: 115 kΩ / 56 kΩ
    Pycom Expansion board v3.1: Undocumented, probably like v3.2? (yes, prooved)
    Pycom Expansion board v3.2: 1 MΩ / 1 MΩ

    So this post is wrong too about the 3.0 version i am using.
    These threads are from 2018. We are living in 2020 in few months and pycom still didnt corecct it in their official documentation, thats weird.

    But ty for your answers, 2.067 is a very precise factor for my application!



  • This post is deleted!


  • @apo1997 There was a thread about it. That told 1M Ohm/1M Ohm.
    Edit: look here: https://forum.pycom.io/topic/3776/adc-use-to-measure-battery-level-vin-level/13



  • ty :).

    In the official documentation the values of the voltage divider are 155kOhm and 56kOhm for board 3. Can you text me the correct values ?



  • @apo1997 use another factor than 3.05. This factor is related to the voltage divider on the expansion board. For board V2, 3.05 was about right. For board 3, the factor should be close to 2. Since you also gave to correct for the ADC variation, you can use your own factor. In this case 2.067.


Log in to reply
 

Pycom on Twitter