Gaboze Pocaio - Battery Monitor (UPDATED)

Got an idea for a project? Found a cool project you want to share? Post it here!
Post Reply
User avatar
Lphillimore
Posts: 978
Joined: Sat Jan 07, 2017 7:03 pm
Location: Perth, WA
Has thanked: 760 times
Been thanked: 501 times

Gaboze Pocaio - Battery Monitor (UPDATED)

Post by Lphillimore » 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
batt mon gaboze.jpg (966.89 KiB) Viewed 1180 times
As for the ADS1015 this is the pinout:
SpoilerShow
ads1015.PNG
ads1015.PNG (798.13 KiB) Viewed 1180 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 1180 times
gaboze 3.jpg
gaboze 3.jpg (1.09 MiB) Viewed 1180 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)

Online
User avatar
KonnorJ
Posts: 168
Joined: Thu Jan 11, 2018 1:23 am
Location: United Kingdom
Has thanked: 8 times
Been thanked: 44 times

Re: Gaboze Pocaio - Battery Monitor

Post by KonnorJ » Wed Aug 15, 2018 10:14 am

Thanks for the guide Liam, gonna be using battery monitors in my next builds.

User avatar
ABH
Posts: 168
Joined: Sat May 28, 2016 7:01 pm
Location: Qatar
Has thanked: 60 times
Been thanked: 81 times

Re: Gaboze Pocaio - Battery Monitor

Post by ABH » 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.
Image Image

Check out my GameBoy Pocket RPI3 build Here
Check out my GameBoy SP build Here
Check out my SupaBoy S build Here

Code: Select all

Enjoy your time ..

User avatar
Lphillimore
Posts: 978
Joined: Sat Jan 07, 2017 7:03 pm
Location: Perth, WA
Has thanked: 760 times
Been thanked: 501 times

Re: Gaboze Pocaio - Battery Monitor

Post by Lphillimore » Sat Aug 18, 2018 11:57 pm

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.

User avatar
Lphillimore
Posts: 978
Joined: Sat Jan 07, 2017 7:03 pm
Location: Perth, WA
Has thanked: 760 times
Been thanked: 501 times

Re: Gaboze Pocaio - Battery Monitor

Post by Lphillimore » 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

User avatar
ABH
Posts: 168
Joined: Sat May 28, 2016 7:01 pm
Location: Qatar
Has thanked: 60 times
Been thanked: 81 times

Re: Gaboze Pocaio - Battery Monitor

Post by ABH » Tue Aug 28, 2018 6:42 am

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.
Image Image

Check out my GameBoy Pocket RPI3 build Here
Check out my GameBoy SP build Here
Check out my SupaBoy S build Here

Code: Select all

Enjoy your time ..

Kepsilonz
Posts: 16
Joined: Sun Jul 24, 2016 10:28 am
Has thanked: 15 times

Re: Gaboze Pocaio - Battery Monitor (UPDATED)

Post by Kepsilonz » Sun Sep 30, 2018 6:23 am

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?

User avatar
Lphillimore
Posts: 978
Joined: Sat Jan 07, 2017 7:03 pm
Location: Perth, WA
Has thanked: 760 times
Been thanked: 501 times

Re: Gaboze Pocaio - Battery Monitor (UPDATED)

Post by Lphillimore » Sun Sep 30, 2018 8:38 am


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!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests