How to measure actual voltage at the 12 volt barrel connector using software

Started by peterg22, November 13, 2018, 10:18:26 AM

Previous topic - Next topic

peterg22


Linux 3.4.103-00033-g9a1cd034181a-dirty #44 SMP PREEMPT Fri Mar 10 08:50:33 EET 2017 armv7l GNU/Linux

A20-OLinuXino-MICRO


Hi All,

I am now running my A20 using a 40watt solar panel + battery and the results have been good so far. The panel outputs 12 volts average, so I have connected the barrel power connector to the controller and all is good. However I am having problems reading the correct voltage values. If I display the uevent in the power_supply class I get the values, and I'm assuming that the power supply called "ac" is the 12 volt barrel connector?

Is there a better way to display an actual value using software? I will be installing an inline meter but it's not a smart one so I can't interrogate that.


cat /sys/class/power_supply/*/uevent
POWER_SUPPLY_NAME=ac
POWER_SUPPLY_MODEL_NAME=ac
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_ONLINE=1
POWER_SUPPLY_VOLTAGE_NOW=5383000
POWER_SUPPLY_CURRENT_NOW=271000

POWER_SUPPLY_NAME=battery
POWER_SUPPLY_MODEL_NAME=battery
POWER_SUPPLY_STATUS=Full
POWER_SUPPLY_PRESENT=0
POWER_SUPPLY_ONLINE=0
POWER_SUPPLY_HEALTH=Good
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4200000
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=3300
POWER_SUPPLY_VOLTAGE_NOW=0
POWER_SUPPLY_CURRENT_NOW=0
POWER_SUPPLY_ENERGY_FULL_DESIGN=2100
POWER_SUPPLY_CAPACITY=100
POWER_SUPPLY_TEMP=300

POWER_SUPPLY_NAME=usb
POWER_SUPPLY_MODEL_NAME=usb
POWER_SUPPLY_PRESENT=0
POWER_SUPPLY_ONLINE=0
POWER_SUPPLY_VOLTAGE_NOW=0
POWER_SUPPLY_CURRENT_NOW=0




JohnS

There doesn't appear to be any existing connection to allow that.

Note that the inputs cannot accept such voltages, either, so you'd have to do something like use a voltage divider and connect its output to an ADC in one of the chips, then read the ADC.

Be sure never to exceed the max voltage the chip can handle even for an instant.  They are not overvoltage-protected.  (That's why it's a max voltage!)

John

peterg22

QuoteThere doesn't appear to be any existing connection to allow that.

Thanks! I thought had missed an obvious setting. The good thing about the 12 volt barrel connector is that it claims to support 6-16 volts, which nicely covers the output from my panel controller.