NightscoutFoundation / xDrip

Nightscout version of xDrip+
https://jamorham.github.io/#xdrip-plus
GNU General Public License v3.0
1.41k stars 1.15k forks source link

Erratic xDrip battery estimates #39

Closed square-eyes closed 7 years ago

square-eyes commented 7 years ago

I recently updated my circuit to suit the xBridge2 firmware with battery charge indicator resistors. Initially it appeared to be working fine, but after my first charge/discharge cycle I'm getting weird results.

Overnight off a low amp (computer) USB port it wouldn't go above around 40% charge. This morning it depleted quickly to 20%. I just now plugged it into a 1A phone charger and it immediately jumped to 79%. It quickly charged to 100% after that, but when I disconnected it dropped almost immediately to 84%.

What troubleshooting steps can I take? Any ideas on what might be wrong?

I'm using the recommended resistors from the pdf (10k and 27k, 1/2 Watt metal film). But I'm not using the Adafruit charger. I'm using a Chinese alternative, battery in parallel with the Wixel, and a 1A Li-Po if it helps.

jamorham commented 7 years ago

Which wixel firmware are you using exactly?

square-eyes commented 7 years ago

This one https://github.com/jstevensog/wixel-sdk/tree/master/apps/xBridge2

I'm not sure how to find the exact version though.

tzachi-dar commented 7 years ago

I would start with measuring the voltage that the battery has. Can you measure the voltage when charging and when you think it is fully charged?

square-eyes commented 7 years ago

Sure. Will do. That's just a multimeter across the battery in parrallel while it's charging and connected to the Wixel yeah?

tzachi-dar commented 7 years ago

By the way, 2 things: 1) What is the maximum current of the charger? 2) I think that the parallel approach is not correct (I understand that parallel means that if there is no charging the battery will continue to supply power to the wixel until it is completely empty. As far as I know, this is not allowed to do to a lipo battery, although some batteries might be protected against that).

square-eyes commented 7 years ago
  1. Not too sure I got this one. I'm trying to dig up a little more info but my question on http://electronics.stackexchange.com was removed :( - I'll see what I can find
  2. I used the circuit from the PDF. The only difference is the Wixel takes power off the battery. Does the Adafruit have a special switching circuit behind those load terminals? Is that the difference? I got my Li-Po out of a mobile charge bank of a reputable manufacturer so it's probably a pretty decent battery. i.e. it wasn't a no name Ali Express quad copter Li-Po.
tzachi-dar commented 7 years ago

The adafruit has 6 pins: 2 input, 2 battery 2 for the load. This one: http://www.hotmcu.com/tp4056-micro-usb-5v-1a-lithium-battery-charger-with-protection-p-176.html also has 6 pins. If yours does not have 6 pins than I think it can not be used with all batteries. (I don't know if your battery is short protected.

According to: http://thedronegirl.com/2015/02/07/lipo-battery/

  1. Never discharge a LiPo battery below 3.0v per cell. Ideally you never want to go below 3.2v per cell to maintain a healthy battery. 2.9v per cell and lower is causing permanent damage.

I would try doing a short circuit on the battery. If it will start burning, my advice is don't use it. if nothing happens, you can see if voltage goes under 3.0 volts. Please note a short circuit of a lipo is very dangerous. See https://www.youtube.com/watch?v=RVlqaMGDNcI for example.

square-eyes commented 7 years ago

OK I'll look to get a 6 pin one for safety. I'm not planning on shorting my Li-Po any time soon :) Back to the question, could my implementation conceivably be causing the odd readings?

I see the page you linked also says "8. Never overcharge a LiPo battery. Typically a full charge is 4.2v per cell. Never “trickle” charge a LiPo battery." - I wonder if a low amp USB charger is considered trickle charging.

tzachi-dar commented 7 years ago

I did a short on a few lipos. For most of them nothing happened. One kind started burning immediately, and I simply don't use it. Better to know what you are using than hope there will be no short circuit.

jamorham commented 7 years ago

I am assuming that the issue originally raised here is related to the xBridge hardware and that xDrip+ is displaying the battery level as supplied to it by the xBridge device and so there isn't a bug in the app which would need resolving.

square-eyes commented 7 years ago

Maybe, maybe not. It's possible my battery is flakey. I still see it charge from ~50% up to 100 very quickly .Then when taken off the charger it drops back to 80% within about 30 minutes. I understand though there are limitations with a voltage divided circuit for this purpose. Additionally under about 50% it drops off pretty quickly (timewise).

square-eyes commented 7 years ago

I have since replaced the charger which more closely resembles the Adafruit. Still based on the same chip, but one which has load terminals so the Wixel isn't in parrallel with the battery any more. I think it's better but the battery still seems to accelerate in either direction both ends of the scale.

jstevensog commented 7 years ago

Please note, the xBridge2 battery indication is NOT a truly accurate measurement of battery capacity, it is only an indication.based on battery voltage, not a measurement based on current in/out like most mobile phones. Why? Because we do not have the circuitry available in off-the-shelf lipo charger boards, or the code in the wixel to interrogate them.

Therefore, if you have the bridge on charge, it will show 100% well before this capacity level is actually reached. And as soon as you take it off charge, the battery voltage will drop rapidly (ie in the next packet capture) to a lower stable value.

The Adafruit charger includes a red/green LED indication to show if the battery is charging/charged. You should not remove the bridge from charging until the green LED is lit. The indication will then stay at 100% for a fair period of time.

Under the current design, using off the shelf components, we cannot do better than this rough indication. Cheers

On Thu, Jan 12, 2017 at 12:15 PM, Mark Francis notifications@github.com wrote:

I have since replaced the charger which more closely resembles the Adafruit in which has load terminals so the Wixel isn't in parrallel with the battery any more. I think it's better but the battery still seems to accelerate in either direction both ends of the scale.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/NightscoutFoundation/xDrip/issues/39#issuecomment-272047489, or mute the thread https://github.com/notifications/unsubscribe-auth/AIQs8yO9Rqca6pc_S3-pBnCFt7z-Vk11ks5rRX6vgaJpZM4K6H3d .

-- John Stevens "You are how you live, not what you have."

square-eyes commented 7 years ago

Thanks for the explanation!