Battery Level
WanaGo opened this issue · 25 comments
Hello,
I know this has been discussed a bit, but just curious what the software side of the Wixel is doing with the xBridge2 27K/10K voltage divider, and what the levels are.
4.2V with a 27K/10K comes out 1.135V on the analog input of the Wixel.
3.0V (battery turns itself off) comes out 0.811V on the Wixel.
So that is 0.324V range only.
Just curious why these resistors were chosen.
Wixel is 7bit to 12bit resolution I believe, what resolution is being used for this? 0-128 or 0-4096, or something in between?
Wixel Analog input is 0-3.3V, and we are using at best 0.811-1.135V.
Can we improve this?
For example if it was changed from 27K/10K, to be 4K/10K, then
4.2V would be 3.0V on the Wixel
3.0V would be 2.143V on the Wixel
giving 0.857V range, instead of 0.324V range.
Could likely even be better than this, but this is just an example..
Maybe 3.3V is the 0% limit, given that is what the reference is based on, I am not sure.
Like my battery currently is 4.11V and its saying 80%, when in reality its more than that.
Can you tell me where in the software these bits are and if they are changeable, so I can experiment with different resistor values?
Does the xBridge2 send the 0-100% reading to the xDrip/xDrip2, or is the 0-100% calculated in the xDrip/xDrip2 application itself?
Thanks
oh hmm. is the Internal Reference 1.25V for the Wixel, not 3.3V ?
Ok that explains a few things.
Thanks very much. I just found the bits in the code a moment ago and tried to find the formula being used (rather than just stated in comments) but havent spotted it yet. But what you have said sounds good anyway. Yes aware the drain is not linear on these batteries.
Understand it was made so non technical people can build and use without too many issues, but for those of us who want to take it a step further, I was just curious if there are better ways of doing it.
I am no expert on the wixel at all, but am comfortable with hardware. A battery management chip would be ideal, one with battery gauge, but implementing the comms to it in the wixel I am stuck on. I saw in another issue post about I2C options, but it was mentioned the flash/ram space is likely limited.
Finding one which doesnt talk I2C but instead outputs a linear analog voltage which the Wixel could then read, would be nice to find. 0-1.25V is a bit sad on the Wixel side though.
Would be really neat to make a techy version of the xBridge which is more of a challenge for those who want to do it, if there is an advantage of doing so.
Appreciate the response anyway, thanks.
Its just curious as my Battery is sitting at 4.18V, fully charged. 3.3V rail on Wixel is bang on 3.3V. ADC is reading 1.134V, yet xDrip+ is show xBridge Battery: 80%
Is this due to the learning algorithm or something?
I would have thought since my battery is over 4.1V it should be reading 100%.
If the maximum is adapting and it thinks it should be higher to be 100%, how do you restart the process?
I leave my xBridge2 powered while charging, could this have affected the logic for max stored in Flash ?
Thanks
Hi John
This all sounds awesome, and yes I 100% agree with the packet capture stuff and how it is the most important.
Regarding the battery % thing, I left it charging for hours and it was sitting at full charge of 4.21v for quite a long time. xDrip+ still reported 80% though. Couldnt get it to budge and change to 100%.
Ended up reflashing the Wixel and that solved the problem.
Keep up the good work, I cant wait to see what comes next with all this.
I am an Electronics Engineer by trade and do PCB layout/design daily using Altium, so if you would like me to join in with the new design effort, please let me know.
Thanks
Lurking. And super excited about your improvements @jstevensog, especially improved packet capture and battery monitoring/life. I'm keen to help with testing, or anything else you might need :)
As long as battery life of the G4 is 4 times that of the G5 (and of course they are still being sold), xBridge will stay strong :)
Love the idea of a network of receivers too.
I hope this is a good place to report it, but I seem to have an issue on my xBridge2 circuit where the learning algorithm (which I only understand at a high level) appears to render the xBridge useless. The result is constant warnings from xDrip that my battery has dropped to an unsatisfactory level. Charging the xBridge makes no improvement to the error state, even when the hardware charger indicates the battery is charged with a green light.
This led me to believe my battery was borked. But after chatting with WanaGo offline he suggested a reflash would reset my max and min values. This worked and xDrip suddenly played nicely. A few weeks later and it's happened again.
As far as I can tell something happens when the battery goes below a certain perceived charge. From memory this latest time I got down to about 40% before it started giving me wild values, even after a charge.
At least there is a workaround, but I've already busted one solder joint dismantling my xBridge to get to the Wixel USB for reflashing.
Yeah mine has done it again too. Reflashing solves it. The code suggests (to me) if it sees a value higher or lower than the current max and min, then it saves these new readings in its place. So if there is for some reason a random reading, it seems it might save it, and then the battery values are stuffed. I dont know why or how this might happen, but it certainly seems to happen. When I reflashed it, the Wixel app said I had something like 12 bytes different between the Wixel and the code I was going to load. Unsure if this is significant.
I have heat shrink over my resistor configuration. I'll try to get a picture when I next have everything splayed out - which should be soon since I need to re-solder a joint.
It might also be worth noting I'm using Chinese copy charger and Bluetooth units. These could be failing of course. But they work perfectly fine after a reflash (as does @WanaGo's by the looks - who is on official hardware).
Hi John
Sorry but that is not the issue. I hand solder 0402's all the time, these 0603's are large and there is nothing wrong with the soldering. They are rock solid, there is good solder coverage and there are no shorts. I have looked at these under a 20x lens and there is nothing wrong with them at all.
Side note, old square eyes is using standard metal film resistors and has the same exact problem, so I think its safe to say the problem isnt the SMT resistors.
Also, that little piece of solid core wire, is solid... and with 2 resistors between it and the pads, it does not budge at all.
Just checking in on progress. Very interested in the projects you've mentioned above John.
Sorry to hear that. Can I get you offline? I might have some ideas.