On-Screen Battery Monitor Options
Re: On-Screen Battery Monitor Options
Hey just wanted to let you know that I finally had a chance to reinstall hoolyhoo's script and use it with the ads1115. I can confirm that the only changes needed are changing line 24 to adc = Adafruit_ADS1x15.ADS1115() and changing line 55 to voltage = float(sensorValue) * (4.09 / 32767.0). At first i thought the range wasnt right because i was getting readings of ~2.6V but when I double checked with my meter the voltage actually was 2.6v on the 3.3v rail from the raspberry pi. I was powering my BW screen off of the 5V rail and it was causing a lot of voltage drop. It's drawing 350mA. I switched it to a separate 5V supply and my readings went up to 3.3V along with all my voltages.
- 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
Noob question.....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
i've got a couple ADS1015 and a couple of ADS1115 in hand now......
i know the ADS1015 (if wire correctly) only needs the script installed and is good to go....
i want to try the ADS1115
after i wire it up and install the script
how do i go about editing the script, so thats it more geared towards the 16bit chip....
a complete noob in this department, so as much info as possible would be appreciated.....
Thanks.
.
Re: On-Screen Battery Monitor Options
If you installed the original script to your pi then you could just ssh and edit using nano (ex. sudo nano pathoffile/file). Then it’s just a matter of changing the values mentioned above and then saving the file. Keep in mind that with python, indents matter so make sure those stay as is. Simply then, reboot, and hopefully it should work for you.VeteranGamer wrote: ↑Mon Dec 11, 2017 6:48 amNoob question.....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
i've got a couple ADS1015 and a couple of ADS1115 in hand now......
i know the ADS1015 (if wire correctly) only needs the script installed and is good to go....
i want to try the ADS1115
after i wire it up and install the script
how do i go about editing the script, so thats it more geared towards the 16bit chip....
a complete noob in this department, so as much info as possible would be appreciated.....
Thanks.
.
Re: On-Screen Battery Monitor Options
Hi HoolyHoo, if I use the same ADS1015 for battery monitor (channel 2) and joystick (channel 0 and 1). Using both your script (changing the readVoltage() function to read channel 2) and the Joy Bonnet from Adafruit, the system starts giving me wrong values and due to this I get a shutdown even with full battery.
Do you have any ideas how can I solve this?
Do you have any ideas how can I solve this?
Re: On-Screen Battery Monitor Options
I suspect there may be a conflict as they are both accessing the ADS1015. I used Adafruit's library for the chip which made it easy to read while the joy bonnet script accesses the ADS1015 in script without library. I would try to merge the script so that its all in one either using the library or as in the joy bonnet script.joao wrote: ↑Mon Dec 11, 2017 9:37 amHi HoolyHoo, if I use the same ADS1015 for battery monitor (channel 2) and joystick (channel 0 and 1). Using both your script (changing the readVoltage() function to read channel 2) and the Joy Bonnet from Adafruit, the system starts giving me wrong values and due to this I get a shutdown even with full battery.
Do you have any ideas how can I solve this?
Re: On-Screen Battery Monitor Options
Thank you. That was also my idea. Now I just need to see if I can do it
And thanks for sharing the script.

And thanks for sharing the script.
-
- Posts: 392
- Joined: Thu Jun 09, 2016 4:17 am
- Location: uk
- Has thanked: 76 times
- Been thanked: 51 times
Re: On-Screen Battery Monitor Options
has this been mentioned/used?
https://fr.aliexpress.com/item/1S-Singl ... 0.0.ferk1G
i saw it on a french youtube build guide
https://fr.aliexpress.com/item/1S-Singl ... 0.0.ferk1G
i saw it on a french youtube build guide
Check out my modding and repair channel of retro and modern consoles:
https://www.youtube.com/channel/UCFz7yW ... GtQ/videos
https://www.youtube.com/channel/UCFz7yW ... GtQ/videos
- 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
not really on-screen....Lpoolm wrote: ↑Thu Dec 14, 2017 11:23 amhas this been mentioned/used?
https://fr.aliexpress.com/item/1S-Singl ... 0.0.ferk1G
i saw it on a french youtube build guide
20171214_182413.jpg
i have seen those....
and i've seen them in some builds (dont look great, IMHO)
and i think they're impractical, you have to turn the system around to see what you've got left....
and you have to accommodate another bit of hardware.....
but its an option if people want there builds to look like that.....
.
Re: On-Screen Battery Monitor Options
Continuing the conversation from the other thread...
While it my not be an ideal situation, it seems like just powering the module from 5v without removing any pull-ups should work fine. The raspberry has 1.8k ohm pull-up resistors to 3v3 on the sda and scl lines on board. The module has 10k pull-ups to 5v on the same sda and scl lines. So the actual circuit for one of the lines is something like this: I used 5.11v because that's what i measured with my DVM. Simulating this we get around 3.58v on the data line: I have verified this with my DVM I'm seeing 3.58v. Seeing as its not very high above the 3.3v rating of the pi's pins it seems like it wont hurt anything. This does work perfectly so far on my breadboard.
While it my not be an ideal situation, it seems like just powering the module from 5v without removing any pull-ups should work fine. The raspberry has 1.8k ohm pull-up resistors to 3v3 on the sda and scl lines on board. The module has 10k pull-ups to 5v on the same sda and scl lines. So the actual circuit for one of the lines is something like this: I used 5.11v because that's what i measured with my DVM. Simulating this we get around 3.58v on the data line: I have verified this with my DVM I'm seeing 3.58v. Seeing as its not very high above the 3.3v rating of the pi's pins it seems like it wont hurt anything. This does work perfectly so far on my breadboard.
- 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
Thanks for the info! I'm making a control board rright now with an ads1115/1015 circuit integrated. I placed a 1n4001 diode in series with the 5v vdd to (theoretically) drop down to around ~~ 4.3v . So that the output is below the 3.3v required of the pi. If there is a flaw in my logic please let me know hahajoeygbsn wrote: ↑Thu Jan 11, 2018 11:57 amContinuing the conversation from the other thread...
While it my not be an ideal situation, it seems like just powering the module from 5v without removing any pull-ups should work fine. The raspberry has 1.8k ohm pull-up resistors to 3v3 on the sda and scl lines on board. The module has 10k pull-ups to 5v on the same sda and scl lines. So the actual circuit for one of the lines is something like this:
IIC.PNG
I used 5.11v because that's what i measured with my DVM. Simulating this we get around 3.58v on the data line:
Graph.PNG
I have verified this with my DVM I'm seeing 3.58v. Seeing as its not very high above the 3.3v rating of the pi's pins it seems like it wont hurt anything. This does work perfectly so far on my breadboard.
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
Who is online
Users browsing this forum: No registered users and 1 guest