Page 1 of 5

[GUIDE] Battery icon indicator guide with MCP3008

Posted: Sun Dec 18, 2016 5:03 am
by activex
Hi all!

I'we finally found some spare time to do a short rough guide on how to add a battery indicator on your GBZ with a MCP3008.
This guide include the hardware installation of the MCP3008 chip, hardware/software part for using LEDS, software part for using videoclips for warnings and shutdown, and software part for having a onscreen battery icon.

Some skills with hardware, and software is required for getting this to work properly!

https://github.com/joachimvenaas/gbzbatterymonitor

It's very rough, so if you have some problems, let me know!
Also, modify as you like! And if you make it better, make sure everyone to post it here so everyone can take advantage of it!

Re: Battery icon indicator guide with MCP3008

Posted: Sun Dec 18, 2016 7:27 am
by BenOfTheNorth
Very nice, thanks! Is it worth going from the 100/75/50/25 values to more detailed levels, or does the accuracy of the voltages not really make this feasible?

Re: Battery icon indicator guide with MCP3008

Posted: Sun Dec 18, 2016 8:58 am
by Helder
Made a simple board for this project so it's a little easier for the novice or to make it tidy:

https://oshpark.com/projects/hd9tu1Lp

Re: Battery icon indicator guide with MCP3008

Posted: Sun Dec 18, 2016 9:24 am
by activex
BenOfTheNorth wrote:Very nice, thanks! Is it worth going from the 100/75/50/25 values to more detailed levels, or does the accuracy of the voltages not really make this feasible?
I tried using 10% steps, but that was too unstable with my 2000mAh battery, with a bigger battery and/or another controller it might work better

Re: Battery icon indicator guide with MCP3008

Posted: Sun Dec 18, 2016 9:25 am
by activex
Helder wrote:Made a simple board for this project so it's a little easier for the novice or to make it tidy:

https://oshpark.com/projects/hd9tu1Lp
Excellent :D

Re: [GUIDE] Battery icon indicator guide with MCP3008

Posted: Tue Dec 20, 2016 11:36 am
by Fleder
Really great work, thank you!
Does this work on every Raspbian based OS?

Re: [GUIDE] Battery icon indicator guide with MCP3008

Posted: Tue Dec 20, 2016 11:39 am
by activex
Fleder wrote:Really great work, thank you!
Does this work on every Raspbian based OS?
I guess so, but you may have to install some extra packages. I have only tested on retropie

Re: [GUIDE] Battery icon indicator guide with MCP3008

Posted: Tue Dec 20, 2016 9:54 pm
by johweb
Thanks for this guide, it's interesting me for a future build !
Just two questions :
1/ in the guide picture, you're wiring the mcp3008 directly to the battery. Is it possible to connect from somewhere else ine the build ? From the powerstrip instead of the battery for example ?
2/ just for my information on how it works : the first time I looked at the picture, it seemed strange to me to connect both anode and cathode from the battery to the same pin of the mcp3008. Doesn't it make a short ? How is it working ?
Thanks a lot for your answers, and for the guide !

Re: [GUIDE] Battery icon indicator guide with MCP3008

Posted: Tue Dec 20, 2016 10:03 pm
by activex
johweb wrote:Thanks for this guide, it's interesting me for a future build !
Just two questions :
1/ in the guide picture, you're wiring the mcp3008 directly to the battery. Is it possible to connect from somewhere else ine the build ? From the powerstrip instead of the battery for example ?
2/ just for my information on how it works : the first time I looked at the picture, it seemed strange to me to connect both anode and cathode from the battery to the same pin of the mcp3008. Doesn't it make a short ? How is it working ?
Thanks a lot for your answers, and for the guide !
1: it will not work while connected to the powerstrip. Thats because the powerstrip is always 5V. The battery is somewhere between 4.2-3.2V, depending on how much juice there is left
2: its not connected directly. Its a resistor on both wires. The reason being we need to get a lower voltage value than 3.3V for monitoring. With the two resistors I used in the example, 4.2V (full battery) will be divided to 3.2V. Read more about voltage divider to learn some more :D

Re: [GUIDE] Battery icon indicator guide with MCP3008

Posted: Tue Dec 20, 2016 10:14 pm
by johweb
Yes, I really need to learn some more ! ;)