Page 1 of 2

Gaboze Pocaio - Battery Monitor (UPDATED)

Posted: Wed Jul 18, 2018 11:19 pm
by Lphillimore
Hey All,

So for those of you currently working on / in possession of Eugene's Gaboze Pocaio, you may be wanting to add the ever useful battery monitor. If so, here's a guide. 8-)

There's not much more to it other than using what info is already out there.

The monitor I'm referring to uses the script created by Hoolyhoo:

https://github.com/HoolyHoo/Mintybatterymonitor

This was originally introduced for use on Wermys mintyPi where Helder created an add-on board to utilise this script and later integrated this into the main mintyPi PCB.

Further works and discussion found that aftermarket ADS1015 or 1115 could be added to builds (GBZs etc.) to utilise Hoolyhoos script and display the icon(s), trigger a shutdown etc.

Note: The 1015 will work off the bat while the 1115 requires a script tweak:

https://sudomod.com/forum/viewtopic.php?f=42&t=4585

To add this into your Gaboze build, you can wire the ADS in much the same way as below:
SpoilerShow
batt mon gaboze.jpg
batt mon gaboze.jpg (966.89 KiB) Viewed 14773 times
As for the ADS1015 this is the pinout:
SpoilerShow
ads1015.PNG
ads1015.PNG (798.13 KiB) Viewed 14773 times
To wire the ADS:

You'll definitely need the 10k resistor and this will go from A0 of the ADS1015 to the B+ on the TP4056

V and G will hook into the TP4056. (B+ and B -)

SDA and SCL will need to go to GPIO 2 and 3 as per:

https://pinout.xyz/pinout/io_pi_zero#

There are no alternative points on the Pi Zero for these so GPIO 2 and 3 are fixed.


**Subject to review - Bluup recently advised that changing SDA and SCL might be possible**


By default, the Gaboze image uses GPIO 2 (SDA) for the 'A' button and GPIO 3 (SCL) for 'L1'. To get around this you'll need to do the following:

1) Solder a wire from the breakout point on the PCB for the 'A' button and choose a free pin on the Pi Zero.

Pin 29 (GPIO5) is ideal for this but choose a free one as you see fit.

You will also need to physically cut the 'A' trace above the breakout point to ensure there is no unwanted power draw and interference with GPIO2 afterwards.


2) You will also need to cut the 'L1' trace above it's breakout point. I would recommend doing this even if you do not planning on using triggers. You do not want inference on that pin else the battery monitor script may not work.

Be sure to test the cut traces with a multimeter as I had an issue where pressing 'A' was sending the Pi into manual shutdown when pressed.

Thanks to Wermy we identified that the trace had not be completely severed and thus pressing 'A' caused power draw on Pin 2 causing the Pi to think it was at critical battery and as such, triggering the shutdown.

See below for an example of how it all comes together. Note the wiring as above and trace cut.

You should be able to fit everything in and close the shell without an issue.
SpoilerShow
batt mon gaboze comple.jpg
batt mon gaboze comple.jpg (880.19 KiB) Viewed 14773 times
gaboze 3.jpg
gaboze 3.jpg (1.09 MiB) Viewed 14773 times
**UPDATE**

You can enable and disable the battery icon if you so desire by pressing and holding a specified button for 2 seconds (default). The button for doing this translates directly from the mintyPi image to 'up' on the Gaboze D-Pad. This is not ideal given most games require long presses of the 'up' key.

Additionally, you can set an 'on-demand' shutdown key to trigger a safe shutdown of the device at any time.

Both of these aspects can be tweaked by editing the fields at the bottom of the 'MintyShutdown.py' file. You can specify the press duration and GPIO that the script should look at. I set mine as follows:

- Enable / Disable battery icon: Select (press for 2 seconds)

- Trigger Safe Shutdown on-demand: R1 (press for 8 seconds)

Re: Gaboze Pocaio - Battery Monitor

Posted: Wed Aug 15, 2018 10:14 am
by KonnorJ
Thanks for the guide Liam, gonna be using battery monitors in my next builds.

Re: Gaboze Pocaio - Battery Monitor

Posted: Thu Aug 16, 2018 9:44 pm
by ABH
Does the script work with the latest version of retropie?
It does not work with me in the last version 4.4, but if I install mintypi Image it works well.

Re: Gaboze Pocaio - Battery Monitor

Posted: Sat Aug 18, 2018 11:57 pm
by Lphillimore
ABH wrote:
Thu Aug 16, 2018 9:44 pm
Does the script work with the latest version of retropie?
It does not work with me in the last version 4.4, but if I install mintypi Image it works well.
I've not seen any issues with it and recently updated a couple to 4.4 - i'll double check though.

The script wont work if you have any GPIO conflicts etc. and I certainly have seen issues getting it to work if that's the case.

Re: Gaboze Pocaio - Battery Monitor

Posted: Tue Aug 28, 2018 6:32 am
by Lphillimore
ABH wrote:
Thu Aug 16, 2018 9:44 pm
Does the script work with the latest version of retropie?
It does not work with me in the last version 4.4, but if I install mintypi Image it works well.
Works fine :D

Re: Gaboze Pocaio - Battery Monitor

Posted: Tue Aug 28, 2018 6:42 am
by ABH
Lphillimore wrote:
Tue Aug 28, 2018 6:32 am
ABH wrote:
Thu Aug 16, 2018 9:44 pm
Does the script work with the latest version of retropie?
It does not work with me in the last version 4.4, but if I install mintypi Image it works well.
Works fine :D
Do you made any changes to the script?
And do you install fresh 4.4 image or do you update from retropie settings.

Re: Gaboze Pocaio - Battery Monitor (UPDATED)

Posted: Sun Sep 30, 2018 6:23 am
by Kepsilonz
Lphillimore wrote:
Wed Jul 18, 2018 11:19 pm
Hey All,

So for those of you currently working on / in possession of Eugene's Gaboze Pocaio, you may be wanting to add the ever useful battery monitor. If so, here's a guide. 8-)

There's not much more to it other than using what info is already out there.

The monitor I'm referring to uses the script created by Hoolyhoo:

https://github.com/HoolyHoo/Mintybatterymonitor

This was originally introduced for use on Wermys mintyPi where Helder created an add-on board to utilise this script and later integrated this into the main mintyPi PCB.

Further works and discussion found that aftermarket ADS1015 or 1115 could be added to builds (GBZs etc.) to utilise Hoolyhoos script and display the icon(s), trigger a shutdown etc.

Note: The 1015 will work off the bat while the 1115 requires a script tweak:

https://sudomod.com/forum/viewtopic.php?f=42&t=4585

To add this into your Gaboze build, you can wire the ADS in much the same way as below:
SpoilerShow
batt mon gaboze.jpg
As for the ADS1015 this is the pinout:
SpoilerShow
ads1015.PNG
To wire the ADS:

You'll definitely need the 10k resistor and this will go from A0 of the ADS1015 to the B+ on the TP4056

V and G will hook into the TP4056. (B+ and B -)

SDA and SCL will need to go to GPIO 2 and 3 as per:

https://pinout.xyz/pinout/io_pi_zero#

There are no alternative points on the Pi Zero for these so GPIO 2 and 3 are fixed.


**Subject to review - Bluup recently advised that changing SDA and SCL might be possible**


By default, the Gaboze image uses GPIO 2 (SDA) for the 'A' button and GPIO 3 (SCL) for 'L1'. To get around this you'll need to do the following:

1) Solder a wire from the breakout point on the PCB for the 'A' button and choose a free pin on the Pi Zero.

Pin 29 (GPIO5) is ideal for this but choose a free one as you see fit.

You will also need to physically cut the 'A' trace above the breakout point to ensure there is no unwanted power draw and interference with GPIO2 afterwards.


2) You will also need to cut the 'L1' trace above it's breakout point. I would recommend doing this even if you do not planning on using triggers. You do not want inference on that pin else the battery monitor script may not work.

Be sure to test the cut traces with a multimeter as I had an issue where pressing 'A' was sending the Pi into manual shutdown when pressed.

Thanks to Wermy we identified that the trace had not be completely severed and thus pressing 'A' caused power draw on Pin 2 causing the Pi to think it was at critical battery and as such, triggering the shutdown.

See below for an example of how it all comes together. Note the wiring as above and trace cut.

You should be able to fit everything in and close the shell without an issue.
SpoilerShow
batt mon gaboze comple.jpg
gaboze 3.jpg

**UPDATE**

You can enable and disable the battery icon if you so desire by pressing and holding a specified button for 2 seconds (default). The button for doing this translates directly from the mintyPi image to 'up' on the Gaboze D-Pad. This is not ideal given most games require long presses of the 'up' key.

Additionally, you can set an 'on-demand' shutdown key to trigger a safe shutdown of the device at any time.

Both of these aspects can be tweaked by editing the fields at the bottom of the 'MintyShutdown.py' file. You can specify the press duration and GPIO that the script should look at. I set mine as follows:

- Enable / Disable battery icon: Select (press for 2 seconds)

- Trigger Safe Shutdown on-demand: R1 (press for 8 seconds)
Hi, thanks for the info.

I have just noticed that GPIO 3 (SCL) in the gaboze pocaio is used for the R1 button and not for the L1 as the guide says.

For those who want to save time, if you decide to use the free GPIO 5 (29) for the A button, the files that should have to be edited are:

/opt/retropie/configs/all/emulationstation/es_input.cfg

Code: Select all

<input name="a" type="key" id="1073742050" value="1"/>
/boot/retrogame.cfg

Code: Select all

A               29  # Left shoulder button
I'm having problems with the ADS1115, did you use the Official Gaboze Pocaio image or a fresh Retropie 4.4?

Re: Gaboze Pocaio - Battery Monitor (UPDATED)

Posted: Sun Sep 30, 2018 8:38 am
by Lphillimore

Hi, thanks for the info.

I have just noticed that GPIO 3 (SCL) in the gaboze pocaio is used for the R1 button and not for the L1 as the guide says.

For those who want to save time, if you decide to use the free GPIO 5 (29) for the A button, the files that should have to be edited are:

/opt/retropie/configs/all/emulationstation/es_input.cfg

Code: Select all

<input name="a" type="key" id="1073742050" value="1"/>
/boot/retrogame.cfg

Code: Select all

A               29  # Left shoulder button
I'm having problems with the ADS1115, did you use the Official Gaboze Pocaio image or a fresh Retropie 4.4?
Thanks for the heads up, you're correct I will amend this now. In my laziness i couldn't remember off of the top of my head so guessed :D

Re: code - yes I left this part out as I assumed anyone making this would already be familiar with the retrogame file :mrgreen:

As for your ADS1115 - this requires a script tweak as noted. The 1015 runs offf the bat. I used the official Gaboze image and installed the script manually. You'll need to ensure there are on conflicts in the retrogame file of blanks for designated buttons.

Good luck!

Re: Gaboze Pocaio - Battery Monitor (UPDATED)

Posted: Sat Nov 17, 2018 2:48 am
by qaz015393
thanks for this. I was looking for this! I definitely needed the safe shutdown info. Now to see if I would need to add the battery monitor for the newly released boards.

EDIT:
How would I use the script for the safe shutdown for my Gaboze Pocaio? don't I need the safe shutdown components that re being sold on sudomods? I saw the video tutorial for the pocket pi f makes and they use those components. I'm a total noob when it comes to this and this will be my first ever built.

Re: Gaboze Pocaio - Battery Monitor (UPDATED)

Posted: Mon Nov 19, 2018 4:09 pm
by insomniamonkey
Would it be possible to setup the safe shutdown script to work with the actual on/off switch up top? Looks as though on the original diagram that what it shows.