On-Screen Battery Monitor Options
Re: On-Screen Battery Monitor Options
Hey I finally got a little time to try hoolyhoos script with my ads1115 board and it works. I just have it hooked up to my test breadboard so I'm not monitoring a battery. Just hooked up the A0 input on the adc to a potentiometer. I can turn the wheel and make the battery icon change. I had to change a lot of values around in the script because of the different voltage range though.
- 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
can you show what changes you made to the script.....joeygbsn wrote: ↑Wed Nov 22, 2017 9:24 pmHey I finally got a little time to try hoolyhoos script with my ads1115 board and it works. I just have it hooked up to my test breadboard so I'm not monitoring a battery. Just hooked up the A0 input on the adc to a potentiometer. I can turn the wheel and make the battery icon change. I had to change a lot of values around in the script because of the different voltage range though.
20171122_211903~01.jpg
20171122_220743.jpg
.
Re: On-Screen Battery Monitor Options
Hey sorry I'm using an older version of the adafruit library so i needed to change some of the commands to get it to work. I need to start with a fresh image I think because I couldn't get it to run the newer examples. I also had to change all the volts25, volts50, etc to make the bar change between 0 and 3.3v because all i had was a pot hooked up. I will post the code later though but I really don't think you will have too much trouble getting it to work. Setting debug = 1 in the battery monitoring script prints the value of the adc to the command line. If you do this you should probably edit /etc/rc.local and comment out the line that runs the mintystart script at boot otherwise its annoying having the values pop up every time you want to enter a command. Just try the two changes we talked about before and see if the values printed make sense. I will hopefully have time to start fresh and try to get the original code working soon though.VeteranGamer wrote: ↑Wed Nov 22, 2017 11:49 pmcan you show what changes you made to the script.....
-
- Posts: 109
- Joined: Wed Nov 23, 2016 10:19 am
- Has thanked: 3 times
- Been thanked: 74 times
Re: On-Screen Battery Monitor Options
It will give you a very rough gauge of the remaining battery capacity. But just keep in mind that when your measurement says it's at 50% capacity, it could actually be anywhere from ~35% to ~75% for actual capacity, and then your measurement is going to drop of very fast toward the bottom end! The voltage graphs give a lot of information about how it will behave. Just keep it in mind when you're measuring battery capacity this way.VeteranGamer wrote: ↑Wed Nov 22, 2017 7:59 am
for me personally im not looking for great accuracy, as long as there is a rough gauge of whats left that will work for me
.
That's too bad! These parts have been working great for me. I've been using the max17048 for a while. On my latest boards I got the max17040 assembled on the boards from china, and they seem to be working fine. From the datasheets it looks like for performance the 17040 is equivalent to the 17043, but the 43 has a battery alert output.kite wrote: ↑Wed Nov 22, 2017 11:52 amHahastill kinda annoyed about those chips as on paper that would be perfect, easy to design and put on a board but the legit part (which is quite hard to find IN China, so would mean expensive shipping + import from US in the first place).. it's a shame but like i think was posted here on on discoord (e.g. this http://www.ti.com/product/BQ27621-G1/samplebuy) would be really good but it's BGA which is a little less friendly
![]()
- kite
- Posts: 972
- Joined: Thu May 12, 2016 4:30 am
- Location: UK
- Has thanked: 246 times
- Been thanked: 361 times
- Contact:
Re: On-Screen Battery Monitor Options
Do you use a dev board for that chip? Do you have a link to one?codeman0624 wrote: ↑Thu Nov 23, 2017 10:14 amIt will give you a very rough gauge of the remaining battery capacity. But just keep in mind that when your measurement says it's at 50% capacity, it could actually be anywhere from ~35% to ~75% for actual capacity, and then your measurement is going to drop of very fast toward the bottom end! The voltage graphs give a lot of information about how it will behave. Just keep it in mind when you're measuring battery capacity this way.VeteranGamer wrote: ↑Wed Nov 22, 2017 7:59 am
for me personally im not looking for great accuracy, as long as there is a rough gauge of whats left that will work for me
.
That's too bad! These parts have been working great for me. I've been using the max17048 for a while. On my latest boards I got the max17040 assembled on the boards from china, and they seem to be working fine. From the datasheets it looks like for performance the 17040 is equivalent to the 17043, but the 43 has a battery alert output.kite wrote: ↑Wed Nov 22, 2017 11:52 amHahastill kinda annoyed about those chips as on paper that would be perfect, easy to design and put on a board but the legit part (which is quite hard to find IN China, so would mean expensive shipping + import from US in the first place).. it's a shame but like i think was posted here on on discoord (e.g. this http://www.ti.com/product/BQ27621-G1/samplebuy) would be really good but it's BGA which is a little less friendly
![]()
Stock clearance - CLOSED: viewtopic.php?f=38&t=12064
Kite's Mailing List: https://goo.gl/forms/e97uUvPOfUxPWdz82
Kite's FAQ: https://kiteretro.com/faq/





Kite's Mailing List: https://goo.gl/forms/e97uUvPOfUxPWdz82
Kite's FAQ: https://kiteretro.com/faq/





-
- Posts: 109
- Joined: Wed Nov 23, 2016 10:19 am
- Has thanked: 3 times
- Been thanked: 74 times
Re: On-Screen Battery Monitor Options
No I just designed it directly into my board. But the sparkfun board could be useful for development.
datasheet:
https://datasheets.maximintegrated.com/ ... X17041.pdf
on mouser:
https://www.mouser.com/ProductDetail/Ma ... Oks15HnB1L
- 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
How much amp can the sparkefun board sustain ? I need something able to get around 7A in his face without crying lol
-
- Posts: 109
- Joined: Wed Nov 23, 2016 10:19 am
- Has thanked: 3 times
- Been thanked: 74 times
Re: On-Screen Battery Monitor Options
Probably not 7A through the small traces they have on that board...but the nice thing about these maxim battery monitors is they don't actually go in the current path, so they don't care how much current you're drawing from the battery
-
- Posts: 128
- Joined: Sat Sep 09, 2017 6:06 am
- Location: Germany
- Has thanked: 60 times
- Been thanked: 37 times
Re: On-Screen Battery Monitor Options
Hi, i like to share some experience/knowledge on adc's in general.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....
.
A resolution of an adc in bits is the smallest amount of voltage difference, the adc can detect.
To make it a little bit simplier, i excluded things like adc accurancy, temperature dependencies and so on.
Examples for 5V ADC reference voltage:
8 Bit ADC: 8 Bit = 256 Steps -> 5V / 256 steps = Resolution: 0,01953125 V. ADC(0) = 0V, ADC(1) = 0,01953V, ADC(2) = 0,0391V, ... , ADC(255) = 5V
10 Bit ADC: 10 Bit = 1024 Steps -> 5V / 1024 steps = Resolution: 0,0048828125 V. ADC(0)= 0V, ADC(1) = 0,0049V, ..., ADC(1023) = 5V
I think any adc with a resolution >= 8 Bit would be ok for liion battery monitoring.
If you want to perfectly measure the remaining battery capacity in percent, you have to
measure voltage and current flow, because the voltage of a battery under load is lower than without load.
See the attached graph for more details (from lygte-info.dk, a battery review specialist):

A pragmatic way to measure the capacity would be to measure your average current flow with a multimeter,
and use the correct line from the graph for your battery overlay.
Maybe i missed something, but why do you want to use a separate ADC, if you can use
an arduino leonardo for controls and battery monitoring? It has a 10 Bit ADC build in,
i use it in my build and it works perfectly.
Re: On-Screen Battery Monitor Options
Well probably because not everyone uses an arduino with their build. Some prefer to go bare bones GPIO for their controls. As the saying goes, there is more than one way of skinning a cat. This thread is just about another option.Maybe i missed something, but why do you want to use a separate ADC, if you can use
an arduino leonardo for controls and battery monitoring? It has a 10 Bit ADC build in,
i use it in my build and it works perfectly.

Who is online
Users browsing this forum: No registered users and 1 guest