New challenge with battery monitor

edmunds

Senior Member
Dear all,

Since I have now decided to power everything except for the motor itself from 2.8V in my vehicle decoder to suit the VL6180X distance sensor supply and logic requirement, I have a new kind of problem with single cell LiPo battery monitor. I learned back then, I could use a simple calibdac command, compare the reading to internal fixed voltage reference and thus get the actual LiPo battery voltage. It did not work great, since it produced very varied readings, but I averaged it out from 10 readings and got reasonable results.

Now, with the 2.8V regulator, there is plenty of power always. Down to a dead battery (the lowest "safe" voltage for a LiPo seems to be 3.8V). Taking a direct connection from the LiPo seems scary as that would make ADC input more than the supply voltage. But maybe that is ok?

Another solution would be a voltage divider, I guess.

One more solution and probably the best would be this clever IC. It requires I2C, which I already have, but some extra components and board space, which I don't really have.

Edmunds
 

AllyCat

Senior Member
Hi,

that would make ADC input more than the supply voltage. But maybe that is ok?
You can take any pin slightly above Vdd, but it's not useful in your case as the ADC will simply indicate "maximum" (255 or 1023). However, there are "ESD protection" diodes from almost every PICaxe pin to Vdd, so if you try to take a pin significantly higher (than a Vfwd above Vdd), then it will either pull the Vdd higher or cause damage in some other way.

So yes, adding a potential divider to one of the ADC input pins (or an internal comparator) is probably the simplest solution. An on-chip comparator, in association with the DAC (and the FVR), can give a direct digital (Good/Bad) signal, or even generate an interrupt.

However, the CALIBADC command should give a consistent result, so are you sure that your Vdd rail itself was constant? Also, a safe minimum of 3.8 volts seems unduly pessimistic for a LiPoly cell. I believe 3.6 is a "safe" minimum and many users accept 3.3 (or even 3.0 volts), at least if not aiming for a maximum number of recharge cycles.

Cheers, Alan.
 

edmunds

Senior Member
Alan,

Thank you for your insightful reply. As always :).

I don't have access to any of the comparator pins anymore and there is no easy way for me to shuffle them around. Interrupt is not really interesting in my case, since I don't need to detect anything immediately or urgently and the action that needs to be taken is "start emitting "I'm low on juice" IR signal", so the systems on the layout can route the car to the nearest "fuel station". The otherwise high threshold of 3.8V seems adequate for this kind of situation. The car might have to travel some distance before it actually finds a free charging station. A little like driving around the city, looking for a parking space with opera tickets in your pocket :). Anyway, this would be easy to adjust.

I'm not sure if the issue has been the stability of the rail itself. I have not connected the scope to it yet, but I tried it quickly with a multimeter that showed 4.2 alternating to 4.1 sometimes. The debug screen however, showed frequently alternating 4.2 and 4.1 and something like 3.2 on a few occasions that screw everything up, of course. The battery is 20C 600mA and the maximum power draw of the circuit is 60mA. So, it is a mystery for now, but also, I must admit I did this in the middle of trying to adjust the BackEMF thing and have not allocated time for proper research there.


Regards,

Edmunds
 

AllyCat

Senior Member
Hi,

You are always likely to get "dither" between two adjacent values because of PICaxe's Integer maths (and limited resolution when dividing).

It happens that at this very moment I'm writing some code to give better resolution than 0.1 volt when using CALIBADC. The simple solution is to use a Constant of 52500 or similar (instead of the "magic number" 10500), then multiply the result by two to give hundredths of a volt. But I may have something a little better to offer. ;)

Cheers, Alan.
 
Top