How do I detect if I am running off the battery ?

154 views
Skip to first unread message

Dave

unread,
May 9, 2019, 2:02:31 AM5/9/19
to BeagleBoard
I am using and OSD3358 based PocketBeaglish Board. 

I need to figure out if the board is running from external power or the LiPo battery, 
Is there an easy means of doing so ?

Something in sysfs maybe ?

n ithinu

unread,
Jun 6, 2019, 4:27:47 AM6/6/19
to BeagleBoard
I do not know if it is also true for PocketBeagle, but there is a tool rc_battery_monitor which shows the voltage at the power supply jack. So you may just look into the sources of the tool.

Indiaaditya Networks

unread,
Jun 7, 2019, 9:17:58 AM6/7/19
to beagl...@googlegroups.com
I think you will need to do it by adding some hardware to detect if external power supply is present or not. If external supply is absent and you are executing some code then you are on battery. Simple comparator circuit should do it.

Kind Regards,
Aditya Ayachit

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/1c0c963c-9c84-41b4-a6cc-350e6be732a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Indiaaditya Networks.... Embedded System development
For industries customised needs

evilwulfie

unread,
Jun 7, 2019, 11:36:48 AM6/7/19
to beagl...@googlegroups.com
The PMIC has registers you can read to see what source you are using

Indiaaditya Networks

unread,
Jun 7, 2019, 1:18:24 PM6/7/19
to beagl...@googlegroups.com
Don't know how one could do that....
Although the PMIC supports direct connection of a Li-ion battery (including charging), this functionality is not officially supported on any BeagleBone. Nevertheless, the terminals for this are available on an unplaced header (pins labled TP5-TP8) for experimentation.  


Kind regards,
Aditya Ayachit


For more options, visit https://groups.google.com/d/optout.

evilwulfie

unread,
Jun 7, 2019, 2:06:31 PM6/7/19
to beagl...@googlegroups.com
I use the built in battery and it works great I Can monitor it as well

Indiaaditya Networks

unread,
Jun 7, 2019, 2:12:23 PM6/7/19
to beagl...@googlegroups.com
Hi Evilwulfie,
Can you please explain. I am quite confused here. What internal battery are you talking about? Others also please do not hesitate to point out what I am missing here.
Thanks in advance.

Kind Regards,
Aditya


For more options, visit https://groups.google.com/d/optout.

evilwulfie

unread,
Jun 7, 2019, 3:00:24 PM6/7/19
to beagl...@googlegroups.com
The 4 pins on the board that do not have anything soldered to them connect to the
PMIC and can supply voltage from a 3.7v li cell you also need a thermistor and a 75k resistor .

The PMIC can use the battery voltage and when on AC in can charge the battery

Indiaaditya Networks

unread,
Jun 8, 2019, 12:26:30 AM6/8/19
to beagl...@googlegroups.com
@evilwulfie Thanks. that's valuable information.



For more options, visit https://groups.google.com/d/optout.

Dave

unread,
Jun 8, 2019, 3:02:45 PM6/8/19
to BeagleBoard
Thank you all for the responses. 

I am using an OSD3358
Battery power is supplied to P8 R8 T8 and N7. 


Dave

unread,
Jun 8, 2019, 3:08:42 PM6/8/19
to BeagleBoard
I found the PMIC docs and I could get the information I want from it. 
But it is I2C and owned by the kernel and I can not seem to communicate with the PMIC while the kernel driver is loaded, which does not surprise me. 

I noted from other posts that there is a patch to the tps65217.c driver that generates KEY_POWER hits on various changes that the PMIC detects. 

Unfortunately the current tps65217.c source (5.1-rc3) has significantly different interrupt handling, and patching it to incorporate the KEY_POWER functionality without breaking the other things that have been changed is on the edge of my abilities. 

Is there someone that understand threaded and nested interrupt handling in Linux that can guide me in patching the current tps65217.c driver to include the Key generation without blowing it up ?

evilwulfie

unread,
Jun 8, 2019, 3:20:17 PM6/8/19
to beagl...@googlegroups.com
A person wrote a small program that can read all the registers from user space. so its possible
https://github.com/wphermans/Beaglebone-Web-PMIC-Register-Viewer
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages