Page 1 of 17

On-Screen Battery Monitor Options

Posted: Fri Nov 10, 2017 2:45 am
by VeteranGamer
rodocop has recently finished his 7th build (double digits just around the corner) :)

http://sudomod.com/forum/viewtopic.php?f=43&t=4577

and he used one of the battery monitor add-ons for the mintyPi in his build, which give him a battery status on screen while only having a simple common ground pcb (enabled by HoolyHoo script)

Image

Image


this got me thinking :? .....
that there must be an option out there for others that would like to do something similar, bearing in mind that Helder battery monitor add-on is not available to buy....


i had a brief look online, and with my basic knowledge on these things came across some items that might or might not be a viable option
(i need some experienced/expertise feedback on this)


Adafruit do a current sensor (Adafruit INA219)
https://learn.adafruit.com/adafruit-ina ... e?view=all

Image


Aliexpress have the same item for a fraction of the cost
https://www.aliexpress.com/item/-/32676 ... 278.i5KQVy


there is also this that i saw another member mention before (not sure again if its a viable option)
available from Sparkfun
https://www.sparkfun.com/products/12918

Image


Aliexpress have the same item for a fraction of the cost
https://www.aliexpress.com/item/MCP4725 ... 285.i5KQVy


now i could be barking up the wrong tree here......
but if i am, i would appriciate it if some input can be given on this (especially from HoolyHoo)


if these are viable options....

1) will they work with HoolyHoo current script or any script (for the mintyPi)
2) if they do work with the script, how will that impact the build if you plan to have one of Cambles Safe Shutdown (as a shutdown function is already written into the script)


if these are not a viable option what would be, or can there be a board made available to the community for Game Boy builds or other similar builds.....


Thank you

.

Re: On-Screen Battery Monitor Options

Posted: Fri Nov 10, 2017 4:55 am
by HoolyHoo
Ok, let me try to take your questions in order.

Respective to the two boards you linked, the first, as far as I know, doesn’t have a python library to interface with. My script is pure python based, as it makes it easier to communicate with the pi. That being said, perhaps builds with atmega32u4 chips could benefit from this board but a total rewrite of the python interface script would need to be written as well as the Arduino code for your micro controller.

Board number two is not an option. That board is a DAC. What you want is an ADC board to read the battery voltage.

The breakout board you seek is more in line with this one.
https://rover.ebay.com/rover/0/0/0?mpre ... 1983738594

Keep in mind that that the script I wrote for the latest MintyPi image was specifically coded for it since the combos are integrated with the battery monitoring. The Mintypi uses Retrogame for the controls, so if your build uses GPIO’s for button control, then it’s possible as Rodocop did. Otherwise a rewrite of the code is needed with Arduino builds.

As far as using with Camble’s Safe shutdown, I have not dived deep enough into his code to see if conflicts would occur but my guess that it would be possible but merging or rewrites of code would also be necessary.

The short of it is, if using a plain button control setup as rodocop did and using the linked board, you should be able to get it going.

Hope this helps 😉

Re: On-Screen Battery Monitor Options

Posted: Fri Nov 10, 2017 5:00 am
by dryja123
Hey, I linked the sparkfun board in another thread and found that it will not work. You need to find an i2c ADC, not DAC, with SDA and SCL channel pinouts. I did some searching and was not able to find a viable option.

Maybe if we make the pitch to Helder he could stock a few of his battery monitor boards for those who would like to use them for other projects. I know I'm working on a few custom gaming projects right now and would like to have 1 or 2.

Re: On-Screen Battery Monitor Options

Posted: Fri Nov 10, 2017 5:13 am
by Abunchahicks
I'm very interested in this as well.

Re: On-Screen Battery Monitor Options

Posted: Fri Nov 10, 2017 5:39 am
by codeman0624
You could use this:
https://www.sparkfun.com/products/10617

It has a very similar IC to what I've been using on my SP AIO boards. It has an I2C interface, so in theory all you would need to do is change the I2C address, and change the register read in the script and it should work.

It measures the voltage for you, but it also has a cool option of providing an actual percentage value, rather than just the battery voltage. I've found this to be more accurate than just reading the battery voltage since LiPo voltage curves can be complicated

Re: On-Screen Battery Monitor Options

Posted: Fri Nov 10, 2017 7:14 am
by Thump52
Lets ask Helder to bring back the battery monitor, I would really like to use it in my next GBZ Build, I PM'd helder yesterday to ask if the battery monitor is still available, he said no but with enough interest he might bring it back, so lets show him that we are very interested, I know if he brings them back I will buy 4 to start with, HOW MANY WOULD YOU BUY?

Re: On-Screen Battery Monitor Options

Posted: Fri Nov 10, 2017 7:53 am
by joeygbsn
The battery fuel gauge linked by codeman seems ideal. Im using this coulomb counter in another project that could be made to work although you need to use interrupts so might not be as easy to use as the fuel gauge. https://www.sparkfun.com/products/12052

Re: On-Screen Battery Monitor Options

Posted: Fri Nov 10, 2017 8:10 am
by VeteranGamer
HoolyHoo wrote:
Fri Nov 10, 2017 4:55 am
Ok, let me try to take your questions in order.

The breakout board you seek is more in line with this one.
https://rover.ebay.com/rover/0/0/0?mpre ... 1983738594

Keep in mind that that the script I wrote for the latest MintyPi image was specifically coded for it since the combos are integrated with the battery monitoring.

As far as using with Camble’s Safe shutdown, I have not dived deep enough into his code to see if conflicts would occur but my guess that it would be possible but merging or rewrites of code would also be necessary.

The short of it is, if using a plain button control setup as rodocop did and using the linked board, you should be able to get it going.

Hope this helps 😉
Really appreciate the reply....

providing that my controls are via GPIO (using retrogame)
and for now i dont have one of cambles safe shutdown installed

firstly
the breakout board you suggested....
could that work out of the box with your script (even if its with an older version of the script)...
or is it just an example of the type of board that could be made to work with your script....

secondly
if it does work out of the box, is there a way to edit or mute (turn off) the safe shutdown part of the script or just not have that part of the script installed.....


or something like this
(maybe slightly modified to work, if it doesnt already work out of the box)

Image

https://www.aliexpress.com/item/ADS1015 ... 9f227b67f4


.

Re: On-Screen Battery Monitor Options

Posted: Fri Nov 10, 2017 8:18 am
by HoolyHoo
Really appreciate the reply....

providing that my controls are via GPIO (using retrogame)
and for now i dont have one of cambles safe shutdown installed

firstly
the breakout board you suggested....
could that work out of the box with your script (even if its with an older version of the script)...
or is it just an example of the type of board that could be made to work with your script....

secondly
if it does work out of the box, is there a way to edit or mute (turn off) the safe shutdown part of the script or just not have that part of the script installed.....
Yes, it would work out of the box, just need to make sure you wire it correctly, obviously.

On the second question, if you are referring to my script, then yes, that is totally possible and easy enough to do with a few minor edits to the script.

Re: On-Screen Battery Monitor Options

Posted: Sat Nov 11, 2017 6:12 pm
by rodocop
Glad my project sparked this thread. I'd be interested to implement battery monitors in upcoming builds as well.