Calculate battery percentage remaining #1437
Replies: 7 comments
-
Posted at 2020-08-20 by @gfwilliams The MDBT42Q breakout? Unfortunately the problem is it's connected to a voltage regulator, so it only 'sees' the regulated voltage. You'll be able to use code like that to see when the voltage starts to drop from 3.3v (meaning the LiPo voltage is near or below that), but by that time the battery is only 10% full or so. Best bet is to add two 1MOhm resistors to the battery voltage to create a 'potential divider', then feed the new (halved) voltage into an analog pin - and then you can use some code a bit like you posted (even in JS) to work out how much battery is left |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-09-06 by saj42 Thanks... I was wondering which 'side' the battery level would be reading if I connect to 12v leisure battery (ie unregulated). I'm going to build a simple campervan battery monitor when I receive my pixl.js. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-09-09 by user91203 Thanks. Yes, I'm using the breakout board. So, with the potential divider, you're just measuring the voltage of the battery? What's the difference between that and using |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-09-09 by user91203 Hmm. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-09-10 by parasquid I think Gordon already mentioned this:
There's also https://www.espruino.com/Tips+and+Tricks#common-issues-and-questions
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-09-10 by user91203 @parasquid thanks for explaining that. I totally missed it, somehow. I guess I need to find those parts for the potential divider. I'll report back if I get something working... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-09-10 by parasquid You can also refer to http://forum.espruino.com/conversations/353421 which is similar to your issue. I would again recommend the INA219 or INA226 for voltage detection if you're not familiar with voltage dividers, because there is a big risk of you frying your device if you mess up the voltages. At least with the INA219/INA226 they're cheap so even if you fry them they don't cost that much :P |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2020-08-20 by user91203
I've got an MDBT42Q connected to a LiPo battery. Is there any way to calculate the percentage of the battery that's remaining? The build-in function only works for Puck, Pixl and Bangle.
Can I do something similar to what they have?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions