On-Screen Battery Monitor Options

General GBZ-related chat goes here. Share ideas, tips and tricks, or ask questions that don't fit into the hardware/software help forums.
Talc
Posts: 3
Joined: Sun Dec 30, 2018 10:38 pm
Has thanked: 3 times

Re: On-Screen Battery Monitor Options

Post by Talc » Mon Dec 31, 2018 12:02 am

*EDIT: see the revisions below for a better diagram

Thank you to everyone above for the diagrams and discussions. I'm not sure if this should go in it's own post under support, but I am piecing together my first build and am wanting to include an ADS1015 with HoolyHoo's battery monitor script. I think I have figured out how to add this in with my other parts, but was wondering if someone could look at my diagram and let me if it looked like it would work. The post above by hueblo helped me out a lot, but as I'm not using an "all-in-one" board or camble's board, I still have some spots I'm unsure about.

Thanks in advance!
ADS1015_Wiring-Power.png
ADS1015_Wiring-Power.png (251.15 KiB) Viewed 1206 times
I think this configuration of parts may be common, so hopefully this will help other people as well.
Last edited by Talc on Mon Dec 31, 2018 1:41 pm, edited 1 time in total.

User avatar
rodocop
Posts: 1628
Joined: Mon Aug 22, 2016 3:14 pm
Location: Saskatchewan
Has thanked: 588 times
Been thanked: 578 times

Re: On-Screen Battery Monitor Options

Post by rodocop » Mon Dec 31, 2018 7:36 am

I notice a few things with you diagram. The ads needs battery voltage to a0 not 5v like seen. Also your dpdt switch, you only need en and ground you do not need to switch bat power to the pi. (Grounding EN turns the powerboost off).

I would wire en and ground as you have, and then wire bat + to the other side of the switch then to a0, that way the battery will be cut off from the ads when the switch is off.

Also, sda and scl on the ads need to go to the pi's gpio's.

I also reccomend a power strip. Run 5v and ground to the power strip, then power all components from that power strip.

Talc
Posts: 3
Joined: Sun Dec 30, 2018 10:38 pm
Has thanked: 3 times

Re: On-Screen Battery Monitor Options

Post by Talc » Mon Dec 31, 2018 1:35 pm

rodocop wrote:
Mon Dec 31, 2018 7:36 am
I notice a few things with you diagram. The ads needs battery voltage to a0 not 5v like seen. Also your dpdt switch, you only need en and ground you do not need to switch bat power to the pi. (Grounding EN turns the powerboost off).

I would wire en and ground as you have, and then wire bat + to the other side of the switch then to a0, that way the battery will be cut off from the ads when the switch is off.

Also, sda and scl on the ads need to go to the pi's gpio's.

I also reccomend a power strip. Run 5v and ground to the power strip, then power all components from that power strip.
Thanks rodocop! I updated the diagram per your review above and based on doing more research on the adafruit website. Also, I decided to pull the vdd and ground for the ADS1015 from the USB connector pads of the Powerboost (Like how hueblo did it).
ADS1015_Wiring-Power_3.png
ADS1015_Wiring-Power_3.png (252.46 KiB) Viewed 1207 times
For the power strip, is there any difference between running 5v and ground to a power strip and running 5v and ground to the common ground board?

Thanks again for the support.

User avatar
rodocop
Posts: 1628
Joined: Mon Aug 22, 2016 3:14 pm
Location: Saskatchewan
Has thanked: 588 times
Been thanked: 578 times

Re: On-Screen Battery Monitor Options

Post by rodocop » Mon Dec 31, 2018 1:38 pm

I guess tinkerboys board has a built in power stip kinda. Just run 5v and gnd to his board. And power components from the various 5v and gnd pads . Or add a standalone power strip. Up to you.

Talc
Posts: 3
Joined: Sun Dec 30, 2018 10:38 pm
Has thanked: 3 times

Re: On-Screen Battery Monitor Options

Post by Talc » Wed Feb 06, 2019 6:15 pm

So, since my last post I have constructed my Game Boy Zero, except I used a raspberry pi 2B board instead of the zero...

I wanted to report back on the diagram I posted before, and say it works, but I'm having an issue that I would like some help solving.

The script is triggering a safe shut down after <1 min. of playtime currently. I think the culprit is the 10k Ω resistor based on a previous post in this thread and my multi-meter readings, but I wanted to get some advice on this before I remove it. currently the script and pi run perfectly when the system is plugged into the charger (5v 3A) and while plugged in, I get a reading of 4.2~ish volts at the switch and at A0 on the ADS1015. However, while running on battery power this drops to 3.4~ish volts. The 5V pins on the pi are still reading at 5.00 volts while the pi is powered (whether by the battery or by the charger), and once the sctipt triggers and shuts down the pi, the 5V pins still read at 5.1~ish volts. This is what makes me suspect the resistor and not the power boost or the battery (measured the battery and it is putting out 3.7+volts after the script says it is dead).

I intend to remove the resistor this weekend, but would appreciate any advice or suggestions of other things to check as the thing is burred deep in the system and its going to be a pain to remove. Should I replace it with a smaller resistor? Does using a pi2 require changing the settings in the script? Any advice is appreciated.

User avatar
Helder
Trailblazer
Trailblazer
Posts: 2769
Joined: Thu May 05, 2016 8:33 am
Location: Fall River, MA
Has thanked: 1407 times
Been thanked: 3075 times

Re: On-Screen Battery Monitor Options

Post by Helder » Fri Feb 08, 2019 1:57 pm

Measure the voltage after the resistor and going into the ADS1015 chip, it's very likely the voltage is hitting the threshold of the script values. Either check the values with the multimeter and make adjustments to the script or use a lower value resistor (but you will still need to get proper values for the script anyways)
My Sale Threads:

Retro PSU, 3.5A output!


Chat with me and other members


Don't contact me about obtaining my board files (as you will not get them). Don't contact me about any of my boards if they are sold out, they will be restocked as soon as I can get them.


Don't support thieves like ckliang who copied my AIO to resell and is now cloning the mintyPi, support the original creators and not the thieves!

User avatar
Patrizio
Posts: 5
Joined: Mon Mar 18, 2019 12:15 am
Has thanked: 3 times
Been thanked: 3 times

Re: On-Screen Battery Monitor Options

Post by Patrizio » Tue May 14, 2019 3:20 pm

Thanks, everyone for this thread!

I added an ADS1015 to my build (Followed this: https://github.com/Gameboypi/SPW) as well.
I installed HoolyHoo's script (https://github.com/HoolyHoo/Mintybatter ... /README.md) and added the 10k resistor to A0, but for some reason, I can't get it to work.
1) The battery indicator doesn't show
2) The audio from the speaker now blasts very loud and I no longer can control the volume

Any suggestion on how to debug the issues?

User avatar
rodocop
Posts: 1628
Joined: Mon Aug 22, 2016 3:14 pm
Location: Saskatchewan
Has thanked: 588 times
Been thanked: 578 times

Re: On-Screen Battery Monitor Options

Post by rodocop » Tue May 14, 2019 4:05 pm

Patrizio wrote:
Tue May 14, 2019 3:20 pm
Thanks, everyone for this thread!

I added an ADS1015 to my build (Followed this: https://github.com/Gameboypi/SPW) as well.
I installed HoolyHoo's script (https://github.com/HoolyHoo/Mintybatter ... /README.md) and added the 10k resistor to A0, but for some reason, I can't get it to work.
1) The battery indicator doesn't show
2) The audio from the speaker now blasts very loud and I no longer can control the volume

Any suggestion on how to debug the issues?
So, you have the SDA and SCL wired to the pi properly, and you have battery voltage to A0, and power and ground as well?

Also, in the script, there are gpios used to turn the icon on and off, and shut down, seen in the link below:

https://github.com/HoolyHoo/Mintybatter ... hutdown.py

shutdown_btn = Button(7, hold_time=1)
monitor_btn = Button(19, hold_time=2)

If you are using GPIO 19 for something, such as a button press or possibly audio that would cause an issue, you are using i2s audio? If so GPIO 19 is used (LRCLK is GPIO 19 ). I'd change the values in the script first. The fact that audio is messed up is very strange, but if you are using i2s this may be the reason why, and would also explain the icon not showing up as well.

User avatar
Patrizio
Posts: 5
Joined: Mon Mar 18, 2019 12:15 am
Has thanked: 3 times
Been thanked: 3 times

Re: On-Screen Battery Monitor Options

Post by Patrizio » Tue May 14, 2019 5:05 pm

rodocop wrote:
Tue May 14, 2019 4:05 pm
Patrizio wrote:
Tue May 14, 2019 3:20 pm
Thanks, everyone for this thread!

I added an ADS1015 to my build (Followed this: https://github.com/Gameboypi/SPW) as well.
I installed HoolyHoo's script (https://github.com/HoolyHoo/Mintybatter ... /README.md) and added the 10k resistor to A0, but for some reason, I can't get it to work.
1) The battery indicator doesn't show
2) The audio from the speaker now blasts very loud and I no longer can control the volume

Any suggestion on how to debug the issues?
So, you have the SDA and SCL wired to the pi properly, and you have battery voltage to A0, and power and ground as well?

Also, in the script, there are gpios used to turn the icon on and off, and shut down, seen in the link below:

https://github.com/HoolyHoo/Mintybatter ... hutdown.py

shutdown_btn = Button(7, hold_time=1)
monitor_btn = Button(19, hold_time=2)

If you are using GPIO 19 for something, such as a button press or possibly audio that would cause an issue, you are using i2s audio? If so GPIO 19 is used (LRCLK is GPIO 19 ). I'd change the values in the script first. The fact that audio is messed up is very strange, but if you are using i2s this may be the reason why, and would also explain the icon not showing up as well.
Thanks so much for helping out! I made some progress.
You're right, the build is using i2s audio, so I was able to fix the audio issue by changing the buttons to:
shutdown_btn = Button(13, hold_time=1) ---> Mode Button
monitor_btn = Button(5, hold_time=2) ---> Select Button

I had initially inverted SDA and SCL (and I was getting the i2c not found error), but they should be ok now (I followed this image posted by the person that created this build initially: https://imgur.com/gallery/Y3OOpzn).

I can successfully press and hold the mode button, which will trigger the shutdown.
I tried with the Select button to trigger the on/off battery indicator but no luck.

I have tested with both usb only and battery only. During the tests, the system did randomly shut down twice, which makes me think that something is happening behind the scenes.

if I connect to the usb and run i2cdetects -y 1 I get the following, not sure if this means anything:
Screen Shot 2019-05-14 at 3.10.02 PM.png
Screen Shot 2019-05-14 at 3.10.02 PM.png (55.7 KiB) Viewed 714 times

User avatar
rodocop
Posts: 1628
Joined: Mon Aug 22, 2016 3:14 pm
Location: Saskatchewan
Has thanked: 588 times
Been thanked: 578 times

Re: On-Screen Battery Monitor Options

Post by rodocop » Tue May 14, 2019 5:41 pm

Hmm. I would try to bypass the a0 on the pcb. Try wiring a0 on the ads1015 direct to the b+ out on the tp4056 and see if that helps. Is there any other scripts running that might be causing interference?

Also, can you confirm, are you using an ads1015, or 1115, since the 1115 would need modification to the script too.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest