Monitor Voltage C0

Post Reply
L67GS
Posts: 488
Joined: Wed Apr 22, 2020 3:02 pm
languages_spoken: English, Jibberish, Pig Latin
ODROIDs: XU4, C1+,(3) C0's, and a whole big pile of accessories, VU7A Plus,, ect....
Has thanked: 143 times
Been thanked: 70 times
Contact:

Monitor Voltage C0

Post by L67GS »

I just installed lm-sensors on a C0, it says there's nothing available, is there another way to get the battery voltage or am I looking at dividing down into an analog input?

User avatar
odroid
Site Admin
Posts: 37403
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1797 times
Been thanked: 1143 times
Contact:

Re: Monitor Voltage C0

Post by odroid »

There is no properly implemented battery driver in the C0 kernel.
Therefore, you need to access the ADC sys-node.
https://wiki.odroid.com/odroid-c1/appli ... ry_voltage
These users thanked the author odroid for the post:
L67GS (Wed Apr 28, 2021 2:57 pm)

L67GS
Posts: 488
Joined: Wed Apr 22, 2020 3:02 pm
languages_spoken: English, Jibberish, Pig Latin
ODROIDs: XU4, C1+,(3) C0's, and a whole big pile of accessories, VU7A Plus,, ect....
Has thanked: 143 times
Been thanked: 70 times
Contact:

Re: Monitor Voltage C0

Post by L67GS »

Hmm, bc: not found

User avatar
tobetter
Posts: 7805
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 431 times
Been thanked: 1210 times
Contact:

Re: Monitor Voltage C0

Post by tobetter »

L67GS wrote:
Thu Apr 29, 2021 1:21 am
Hmm, bc: not found

Code: Select all

sudo apt install bc
These users thanked the author tobetter for the post:
L67GS (Thu Apr 29, 2021 12:09 pm)

L67GS
Posts: 488
Joined: Wed Apr 22, 2020 3:02 pm
languages_spoken: English, Jibberish, Pig Latin
ODROIDs: XU4, C1+,(3) C0's, and a whole big pile of accessories, VU7A Plus,, ect....
Has thanked: 143 times
Been thanked: 70 times
Contact:

Re: Monitor Voltage C0

Post by L67GS »

It magically works! Thank you guys, I thought I was going to have to provide an external ADC and read it.

L67GS
Posts: 488
Joined: Wed Apr 22, 2020 3:02 pm
languages_spoken: English, Jibberish, Pig Latin
ODROIDs: XU4, C1+,(3) C0's, and a whole big pile of accessories, VU7A Plus,, ect....
Has thanked: 143 times
Been thanked: 70 times
Contact:

Re: Monitor Voltage C0

Post by L67GS »

I modified your script to log date/time/ voltage. Now I can call it periodically from inside my program and see where the limits are, Then I can work on automatic shutdown to prevent the computer from crashing from low voltage. Posting it here in case it can help someone in the future....

C1/C1+/C0
Script

Code: Select all

#!/bin/sh
#
# Read Battery Voltage on ODROID-C0
#
log=voltage.txt 
ADCRES=0.004106
ADCVAL=$(cat /sys/class/saradc/saradc_ch0)
BATTVOL=$(echo $ADCRES*$ADCVAL | bc)
date >> $log 
echo Battery voltage: $BATTVOL V >> $log

These users thanked the author L67GS for the post:
odroid (Thu Apr 29, 2021 1:53 pm)

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 2 guests