Automation pHat ADC problem?


I have 10 kohm resistor between plus and minus of a 12 V battery. I have connected Automation pHat ADC port two over the resistor. My idea is to measure battery voltage. My Python program is running every 10 minutes and takes maximum voltage from 20 measurements. There are more then 700 results. The measured result varies very much. Minimum is 0 V, maximum is 14,29 V and average is 10,79 V.

With two different voltmeter I have measured 12,4 V.

Is this inaccuracy normal? What have I done wrong?



How is the ADC connected across the resistor? It sounds like your ADC readings are floating. Is there a common ground connected between the HAT and battery?


Thank You for your answer!
All grounds are connected together. HAT ground is connected between battery
minus and 10 kohm resistor. ADC terminal two is connected between battery
plus and 10 kohm resistor.

Best wishes!


Could you supply some photos, or a schematic of your setup?

Have you tried any other ADC inputs on the HAT?

You shouldn’t need the resistor between the positive and negative terminals of the battery- this only serves to create a voltage divider that will skew your voltage readings. The input stage for the ADC already has a voltage divider in place to drop the 25.85v maximum input voltage down to the range that the ADC supports.

You should be able to simply connect from the positive terminal directly to the analog input you wish to use, although you may wish to use an inline resistor closer to the battery to take the edge off any shorts that might happen during your experimentation/development phase. You would trade some accuracy for this, but it’d be safer.


Thank you for your answer!
I found a failure! There was a bad/loose connection/wiring in my system.
Now it seems to run correctly.

Thank you for your advice!