check lipo battery level?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
IHOXOHI
Posts: 112
Joined: Sat Apr 25, 2020 7:31 am

check lipo battery level?

Post by IHOXOHI » Sun Aug 02, 2020 2:56 pm

Hi,

I would like use a pybstick from mchobby shop in a mobil way, so with a battery... On this board, there isn't a vbat pin... So I have connected a lipo battery of 3.7V - 400mAh on the vin pin... Powering is ok, and reload too... But it's not perfect, I can't known battery level for save the battery... without a too big breakout for this tiny board.

If someone know a "simple" way for known level battery?

Dogostyle
Posts: 3
Joined: Fri Feb 08, 2019 4:33 pm

Re: check lipo battery level?

Post by Dogostyle » Sun Aug 02, 2020 4:18 pm

I think you would need a estabilized reference voltage for ADC measurements, a simple way would be to use a zener diode as a voltage regulator in the range of battery level and use it as a reference. It will draw a bit of current if you're thinking about power saving though.

User avatar
Roberthh
Posts: 2682
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: check lipo battery level?

Post by Roberthh » Mon Aug 03, 2020 7:46 am

You can connect Vin to one of the ADC inputs using a voltage divider (two resistors) to get the battery voltage. That does tell you much about the charge level, but gives you at least a warning before the battery is empty.

IHOXOHI
Posts: 112
Joined: Sat Apr 25, 2020 7:31 am

Re: check lipo battery level?

Post by IHOXOHI » Mon Aug 03, 2020 11:08 am

Thanks.

I will try...

All the best.

IHOXOHI
Posts: 112
Joined: Sat Apr 25, 2020 7:31 am

Re: check lipo battery level?

Post by IHOXOHI » Mon Aug 03, 2020 7:09 pm

Yop,
I tested with just 2 resistors of 10K for try something quicly. For moment, it looks perfect.

The count of my adc passed slowly, and clearly from 2449 to 2380 for 4 hours.

I will test with a zen diode too...

THANKS.

User avatar
Roberthh
Posts: 2682
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: check lipo battery level?

Post by Roberthh » Mon Aug 03, 2020 7:35 pm

This test path adds a constant load to the battery. So make it high impedance, like 1MOhm. You can add a capacitor (~10nF) to the ADC input have a lower dynamic impedance during sampling.

IHOXOHI
Posts: 112
Joined: Sat Apr 25, 2020 7:31 am

Re: check lipo battery level?

Post by IHOXOHI » Sun Aug 09, 2020 8:55 am

Hey,

Finally, voltage divider works perfectly with just an oled display. I think that you can check correctly the level bat. But when I add 2 sensors (sgp30 and mcp9808), voltage fall down to a little value. Difference between full bat and empty bat is much more lower and it isn't possible to check correctly the level bat.

With an average of 60 values (one per sec), it works fine for just check if batt is closer of empty or full state, 30 min before ultimate state. I use a bat of 3.7 V and 400mh.

IHOXOHI
Posts: 112
Joined: Sat Apr 25, 2020 7:31 am

Re: check lipo battery level?

Post by IHOXOHI » Wed Aug 12, 2020 9:14 am

Yep,

Finally it's a little bit dangerous. It depends of the power of the computer which is charging.
For me it's allright with a raspberry computer, but just with a laptop, battery is very hot during charging.

I will try to add a voltage regulator, but maybe this will stop the charging ability???

Thanks.

User avatar
pythoncoder
Posts: 5195
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: check lipo battery level?

Post by pythoncoder » Thu Aug 13, 2020 8:39 am

LiPo batteries need a specially designed chip for charging. There is a risk of fire or explosion if you use DIY methods unless you really know what you're doing.
Peter Hinch

Post Reply