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.
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:
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:
To add this into your Gaboze build, you can wire the ADS in much the same way as below:
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:
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.
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)