Start a new topic

Battery status display on desktop pannel

Right now you can type "pt-status" in a console window, but there is no continuous battery status display while you are on the desktop.


I have therefore created a little program to display the pi-top battery status on the desktop. It displays a small icon on the task bar.


To download, use the browser and navigate to github.com

Then search in github for pi-top-battery-status


Installation instructions are there.


Questions and suggestions for improvement are most welcome.


Installation is failing :-( Failed to run command gtk_battery (I've made it executable)

Ok, issue was that the install file had 'bin1' as the bin name.


But now when it runs it reports that it does not have access to the battery pack.

BTW: I'm an experienced Pi user :-)


I've now got the application running, but it still shows 0% battery in the window.


the pt-battery returns:

 (standard_in) 1: illegal character: R

(standard_in) 1: illegal character: O

(standard_in) 1: illegal character: R

(standard_in) 1: illegal character: :

(standard_in) 1: illegal character: O

(standard_in) 1: illegal character: U

(standard_in) 1: illegal character: L

(standard_in) 1: syntax error

(standard_in) 1: illegal character: N

(standard_in) 1: illegal character: O

(standard_in) 1: illegal character: T

(standard_in) 1: illegal character: O

(standard_in) 1: illegal character: P

(standard_in) 1: illegal character: N

(standard_in) 1: illegal character: I

(standard_in) 1: illegal character: L

(standard_in) 1: illegal character: `

(standard_in) 1: illegal character: V

(standard_in) 1: illegal character: I

(standard_in) 1: illegal character: '

(standard_in) 1: illegal character: O

(standard_in) 1: illegal character: R

(standard_in) 1: illegal character: `

(standard_in) 1: illegal character: V

(standard_in) 1: illegal character: I

(standard_in) 1: illegal character: '

(standard_in) 1: illegal character: :

(standard_in) 1: illegal character: N

(standard_in) 1: illegal character: O

(standard_in) 1: illegal character: S

(standard_in) 1: illegal character: U


gtk-battery reports: Unable to init server: Could not connect: Connection refused


So I suspect it's not working correctly.  I'm using a Pi3 with the latest PiTop 0.2.7 Dev version.



gtk_battery uses the same approach to talk to the battery pack as pt-battery, which as been supplied by pi-top. So we need to get that script to work first. I assume you have i2c enabled in raspi-config, and the command "i2cget" is installed (can be checked with "whereis i2cget"). 

Yes, i2c kernel module is loaded, and so are the other dependencies.  When I last used the PiTop app, it didn't display the battery either, so I think I need to sort that out first.

I have fixed a few minor glitches and tested it again with a fresh copy of the newest Pi-Top-OS. It works on my fresh system both before and after the newest updates are installed. I am also using a Pi3.


All comments, questions and suggestions are most welcome.

Oddly enough, when I started the PiTop this morning, it was working!

work fine, thanks

 

It works for me, too, and I posted a picture to Rene's Twitter . Thanks, Rene, for a great little piece of code. Really appreciate it.

Regards,

Stuart

Thanks, Stuart, for your encouraging feedback. Thanks also to Gio from Italy, who fixed a nasty little bug in the install script. It's a pleasure to be able to contribute to the success of the pi-top. Regards, Rene

2 people like this
Make sure the power adapter is connected to the Pi-Top.
Shutdown the Pi-Top.
Let it charge overnight.
Next morning switch the Pi-Top on.
At the end of the power-on cycle there's no battery symbol and no 100%.
Unplug the power adapter. After a few seconds the battery symbol shows as does the 100%.

The Smart Battery Module will not overcharge your battery cells and stops charging at 4.211 - 4.223 millivolt.

Regards,
Ivo

Thanks Ivo for the bug report. I will open an issue on gitHub and leave a message once its fixed.

Regards, Rene

gtk_battery shows now a gray symbol if the external power is connected and the battery is not charging. Usually this means that the battery is full or has been fully charged a short time ago.
gtk_battery makes now a log of all activities in /home/pi/batteryLog. I hope this might help to find out what went wrong if the battery fails.

2 people like this
Login or Signup to post a comment