Measure Voltage/Voltmeter with Automation-phat



Is it possible to measure the voltage of a 12v battery with the pi zero with automation phat?

As far as the documentation goes I understand I can hook up a 12v battery/supply and use it as a relay, I will use that feature too, but it would be very nice to see the voltage too.

The plan is a pi zero hooked up to multiple 12v batteries on a off grid solar system(already there), with FHEM on it for automation tasks. now it would be very nice to also be able to see the voltage and record it over time.

The pi zero would be connected to the 12v battery via a 12v cigarette -> USB converter, so 12v to 5V


yes, the ADC should allow you to read voltages from up to 3 batteries, record it, or whatever you wish to do if those readings fall below a specified threshold.


thx, i just tried it and it works wonderfully, didnt realize it was THAT easy.

For others just connect the + to ADC1(or 2,3) and - to Ground

Start the example script and you should get the voltage…

Its a bit inaccurate with voltages under about 3V but with 18V its about ± 0.02V which is fine for me


Cool. Doing something similar, so adding to this thread.

Trying to measure the output from a small solar panel with Automation Hat (not the phat, but they are similar).
I have the first analog input connected to the battery plus to measure battery output, and that seems to work fine. Trying to connect the second analog to the plus from the solar panel, but am not getting a correct reading. The multimeter shows one value but the Automation Hat test program shows the same value all the time - around 12 volts.

What I can’t understand from the docs is if I should connect solar panel minus to the ground on the hat or not. I have googled for examples of using this input, but can’t find any. Also can’t find docs on the difference between “buffered inputs” and “inputs”. (Newbie warning, but in learning mode).