On-Screen Battery Monitor Options
- erik_gee
- Posts: 356
- Joined: Thu Jun 16, 2016 12:57 am
- Location: United States
- Has thanked: 137 times
- Been thanked: 193 times
Re: On-Screen Battery Monitor Options
You could probably get away with any basic ADC or even just a voltage comparator if you aren't worried too much about resolution.
With the ADC you can get continuos input of data and read it over i2c, and either write your own code or try to modify one of the existing scripts to trigger battery icon changes at certain values. Or use the voltage comparator as I've stated before, in conjunction with some voltage dividers to compare the voltage output of the battery with a reference voltage (I think 3.2v is when it's too low? Atleast That's what I've read, haven't tested). The downside here being these are hard wired values, where the ADC is continuos input. Either way make sure to bring down the voltages to an acceptable 3.3v or lower power voltage so you don't fry your pi gpio
With the ADC you can get continuos input of data and read it over i2c, and either write your own code or try to modify one of the existing scripts to trigger battery icon changes at certain values. Or use the voltage comparator as I've stated before, in conjunction with some voltage dividers to compare the voltage output of the battery with a reference voltage (I think 3.2v is when it's too low? Atleast That's what I've read, haven't tested). The downside here being these are hard wired values, where the ADC is continuos input. Either way make sure to bring down the voltages to an acceptable 3.3v or lower power voltage so you don't fry your pi gpio
GBC AIO kit Sales Thread:https://www.sudomod.com/forum/viewtopic.php?f=38&t=9928
Bunch of different shoulder button kits Sales Thread:viewtopic.php?f=38&t=6233&p=63192#p63192
AIO board for DMG Sales Thread:
viewtopic.php?f=38&t=6431
6 Button Common Ground Board Sales Thread: viewtopic.php?f=38&t=4811
Bunch of different shoulder button kits Sales Thread:viewtopic.php?f=38&t=6233&p=63192#p63192
AIO board for DMG Sales Thread:
viewtopic.php?f=38&t=6431
6 Button Common Ground Board Sales Thread: viewtopic.php?f=38&t=4811
- VeteranGamer
- Posts: 1738
- Joined: Thu Jan 26, 2017 11:12 am
- Location: London, UK
- Has thanked: 528 times
- Been thanked: 909 times
Re: On-Screen Battery Monitor Options
ok....erik_gee wrote: ↑Sun Nov 12, 2017 2:33 amYou could probably get away with any basic ADC or even just a voltage comparator if you aren't worried too much about resolution.
With the ADC you can get continuos input of data and read it over i2c, and either write your own code or try to modify one of the existing scripts to trigger battery icon changes at certain values. Or use the voltage comparator as I've stated before, in conjunction with some voltage dividers to compare the voltage output of the battery with a reference voltage (I think 3.2v is when it's too low? Atleast That's what I've read, haven't tested). The downside here being these are hard wired values, where the ADC is continuos input. Either way make sure to bring down the voltages to an acceptable 3.3v or lower power voltage so you don't fry your pi gpio
so what are you say here....
the ADC that HoolyHoo recommended/suggested isnt a good option and cant be used out of the box....
and if so what are your recommendations instead (12Bit or 16Bit) please provide something that we can work with....
.
- erik_gee
- Posts: 356
- Joined: Thu Jun 16, 2016 12:57 am
- Location: United States
- Has thanked: 137 times
- Been thanked: 193 times
Re: On-Screen Battery Monitor Options
Oh I didn't say it wasn't a good option. I think what he suggested should work just fine, as well as any other ADC. I just offered another option, the voltage comparator, for those who don't want to work with i2c as it can be a little more complicated. The voltage comparator would just output a high when it reaches predetermined voltages, set by using voltage dividers. So if you are looking for an easier coding experience, the comparator is much simpler as you don't have to worry about i2c communication . But you won't be able to fine tune it as you are working with the voltages you set, where the ADC is constantly reading the voltage and you can adjust at what voltage you want a certain action to happen much easier.VeteranGamer wrote: ↑Mon Nov 13, 2017 12:52 amok....erik_gee wrote: ↑Sun Nov 12, 2017 2:33 amYou could probably get away with any basic ADC or even just a voltage comparator if you aren't worried too much about resolution.
With the ADC you can get continuos input of data and read it over i2c, and either write your own code or try to modify one of the existing scripts to trigger battery icon changes at certain values. Or use the voltage comparator as I've stated before, in conjunction with some voltage dividers to compare the voltage output of the battery with a reference voltage (I think 3.2v is when it's too low? Atleast That's what I've read, haven't tested). The downside here being these are hard wired values, where the ADC is continuos input. Either way make sure to bring down the voltages to an acceptable 3.3v or lower power voltage so you don't fry your pi gpio
so what are you say here....
the ADC that HoolyHoo recommended/suggested isnt a good option and cant be used out of the box....
and if so what are your recommendations instead (12Bit or 16Bit) please provide something that we can work with....
.
But either resolution should be fine for your ADC when determining how many bits. I'm not quite as experienced with monitoring via ADC, so perhaps someone else here can she'd a little more light. I know there has been quite a bit of discussion using the mcp3008 ADC and that there is some code floating around for that. That might be a good start since it's been developed on already
GBC AIO kit Sales Thread:https://www.sudomod.com/forum/viewtopic.php?f=38&t=9928
Bunch of different shoulder button kits Sales Thread:viewtopic.php?f=38&t=6233&p=63192#p63192
AIO board for DMG Sales Thread:
viewtopic.php?f=38&t=6431
6 Button Common Ground Board Sales Thread: viewtopic.php?f=38&t=4811
Bunch of different shoulder button kits Sales Thread:viewtopic.php?f=38&t=6233&p=63192#p63192
AIO board for DMG Sales Thread:
viewtopic.php?f=38&t=6431
6 Button Common Ground Board Sales Thread: viewtopic.php?f=38&t=4811
Re: On-Screen Battery Monitor Options
As I mentioned before, the link I posted earlier will work "out of the box". If your happy with the way the battery monitoring works on Wermy's minty image, then you will have the same experience.
That being said, if you want 16bit precision vs 12bit, then use this:
https://www.ebay.com/itm/ADS1115-4-Chan ... SwzgRW1510
Same board, just uses a 16bit chip instead of the 12bit. Only slight modification to the code would be needed.
That being said, if you want 16bit precision vs 12bit, then use this:
https://www.ebay.com/itm/ADS1115-4-Chan ... SwzgRW1510
Same board, just uses a 16bit chip instead of the 12bit. Only slight modification to the code would be needed.
- VeteranGamer
- Posts: 1738
- Joined: Thu Jan 26, 2017 11:12 am
- Location: London, UK
- Has thanked: 528 times
- Been thanked: 909 times
Re: On-Screen Battery Monitor Options
For me it's just having a rough idea of what your left with (battery capacity) rather than suddenly being presented with a low battery message....HoolyHoo wrote: ↑Mon Nov 13, 2017 6:29 amAs I mentioned before, the link I posted earlier will work "out of the box". If your happy with the way the battery monitoring works on Wermy's minty image, then you will have the same experience.
That being said, if you want 16bit precision vs 12bit, then use this:
https://www.ebay.com/itm/ADS1115-4-Chan ... SwzgRW1510
Same board, just uses a 16bit chip instead of the 12bit. Only slight modification to the code would be needed.
Plus it looks good on a build...
As long as their aren't any major issues with the mintyPi setup and people are happy with the way it performs, the 12bit ads1015 should be fine...
I've have ordered both, but would rather not get into too many script changes (it's a bit out of my wheelhouse)....
.
Re: On-Screen Battery Monitor Options
I have one of the 16bit boards so may be able to test the script at some point if I have time. Looking at the code though I think that you only need to change one line. Change adc = Adafruit_ADS1x15.ADS1015() to adc = Adafruit_ADS1x15.ADS1115() and I think it will work.
- VeteranGamer
- Posts: 1738
- Joined: Thu Jan 26, 2017 11:12 am
- Location: London, UK
- Has thanked: 528 times
- Been thanked: 909 times
Re: On-Screen Battery Monitor Options
I'm not sure if it's that simple (could be wrong)joeygbsn wrote: ↑Mon Nov 13, 2017 8:54 amI have one of the 16bit boards so may be able to test the script at some point if I have time. Looking at the code though I think that you only need to change one line. Change adc = Adafruit_ADS1x15.ADS1015() to adc = Adafruit_ADS1x15.ADS1115() and I think it will work.
Because you get a higher resolution with 16bit, maybe some of the parameters need to be adjusted (could be wrong)
But if you've got it, there's no harm in testing it out...
.
Re: On-Screen Battery Monitor Options
You would also need to change the resolution as of right now the range is from -2048 to 2047. The 16bit uses a resolution from -32768 to 32767.joeygbsn wrote: ↑Mon Nov 13, 2017 8:54 amI have one of the 16bit boards so may be able to test the script at some point if I have time. Looking at the code though I think that you only need to change one line. Change adc = Adafruit_ADS1x15.ADS1015() to adc = Adafruit_ADS1x15.ADS1115() and I think it will work.
Editing the 2047 to 32767 in this bit of the script might be all thats needed other than the what joeygbsn mentioned.
Code: Select all
def convertVoltage(sensorValue):
voltage = float(sensorValue) * (4.09 / 2047.0)
return voltage
Re: On-Screen Battery Monitor Options
Ok awesome yeah i was just about to post that bit and see if that was the only other change, but you edited your post and confirmed.HoolyHoo wrote: ↑Mon Nov 13, 2017 9:07 amYou would also need to change the resolution as of right now the range is from -2048 to 2047. The 16bit uses a resolution from -32768 to 32767.joeygbsn wrote: ↑Mon Nov 13, 2017 8:54 amI have one of the 16bit boards so may be able to test the script at some point if I have time. Looking at the code though I think that you only need to change one line. Change adc = Adafruit_ADS1x15.ADS1015() to adc = Adafruit_ADS1x15.ADS1115() and I think it will work.
Editing the 2047 to 32767 in this bit of the script might be all thats needed other than the what joeygbsn mentioned.
Code: Select all
def convertVoltage(sensorValue): voltage = float(sensorValue) * (4.09 / 2047.0) return voltage
- YaYa
- Posts: 1719
- Joined: Mon Jun 26, 2017 12:42 pm
- Location: brittany - France
- Has thanked: 871 times
- Been thanked: 689 times
- Contact:
Re: On-Screen Battery Monitor Options
Sticking here... i must confess that it’s harder to understand than i thought.
I’m really new to the whole stuff.
I’m really new to the whole stuff.
Who is online
Users browsing this forum: No registered users and 1 guest