We're no longer updating This wiki!!

This is an old revision of the document!


Read Battery Voltage Script on ODROID-C0

This script read the voltage of battery from ADC channel 0.
Save the following code as readbatvol.sh in home directory.

#!/bin/sh
#
# Read Battery Voltage on ODROID-C0
#

ADCRES=0.004106
ADCVAL=$(cat /sys/class/saradc/saradc_ch0)
BATTVOL=$(echo $ADCRES*$ADCVAL | bc)
echo Battery voltage is $BATTVOL V

Please change the script permissions to execute with chmod.

sudo chmod a+x readbatvol.sh

Execute the script to Read battery voltage.

./readbatvol.sh
en/c0_read_battery_voltage.1459761854.txt.gz · Last modified: 2016/04/04 17:54 by ruppi
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0