CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

ADC for "very rough" lipo level indicator; disconn

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
RoGuE_StreaK



Joined: 02 Feb 2010
Posts: 73

View user's profile Send private message

ADC for "very rough" lipo level indicator; disconn
PostPosted: Wed Mar 14, 2012 10:12 pm     Reply with quote

I'm sure this has been done to death, but after hours of searching and reading I'm still unsure.

Just for the hell of it, I'm looking at adding a simple "battery level indicator" to my project, with a multi-purpose RGB LED giving a rough indicator of maybe five levels, from "fresh" @ 4.2V (ish) to "recharge" @ around 3.4V. Battery feeds an LDO providing 3.3V to all devices. Intention is for the project to be "always on" when the battery is in, but in a deep sleep when not used. Battery will be a single 2400mAh 18650 lipo, or a capacity thereabouts.

Simple method is a voltage divider; say a 1:3 ratio, eg. 100K and 300K? But that means there's a constant slow draining of power; question being is it really enough to worry about, and should I be trying to disconnect it somehow when not in use? I only intend checking the battery level maybe every 30sec, though it shouldn't need anywhere near that regularity of checking.
Should I use an extra pin and a PNP transistor to only connect the divider when it's about to be needed? eg, [url=http://www.electricstuff.co.uk/picavrstuff.html#Measuring battery voltage]this circuit[/url]? Or is there a "better" way to do this?

In this thread, SherpaDoug describes a voltage divider for a 5V system running off 12V, using 700k and 500k resistors with a 0.1uF cap to ground, stating that it will only drain 10uA; if so, is that sort of figure worth worrying about?

MCU is a PIC24FJ64
Ttelmah



Joined: 11 Mar 2010
Posts: 19328

View user's profile Send private message

PostPosted: Thu Mar 15, 2012 2:54 am     Reply with quote

3.4, is a bit 'high'. 3.0v, is more normal for a "don't discharge below" limit. Sanyo use 2.75v, in their recommendations. Though 3.4, is pretty close to the 'knee' of the battery curve (where it starts to drop sharply), on low discharge rates, there is still something like 10% of the available power below this, and even more if you are discharging harder, where this voltage will be hit much further up the curve.

On the resistors, problem is that the accuracy of the ADC is less good with big resistors. The current drawn on the ADC pin varies slightly when the ADC connects and disconnects, with some internal leakage in the circuit. This is why very high impedance sources are not really recommended. This varies with PIC model (for instance, the 18F2620, quotes 100nA, while the 16F887, quotes 500nA). Much better to use lower resistances, and switch off when you are not sensing. The battery available capacity also falls sharply in cold conditions, so even a small discharge may become increasingly significant.

I use the little AQV112AL photo mos device for this. You can just connect this to your battery line, have a divider tree that draws something more like perhaps a couple of mA, and turn it on when you want a reading. A bit expensive (there are cheaper alternatives), but small, and easy to use. However only really worthwhile when using much higher pack voltages.

The little divider you show, should work well for you, and given you don't have the higher rail voltage involved in the example, you don't need the capacitor.

Best Wishes
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Thu Mar 15, 2012 3:17 am     Reply with quote

Some general remarks on the project itself:

LiPoly batteries have a very flat discharge curve, only changing voltage immediately after charge and just before full discharge. This makes a simple voltage measuring method worthless.

Worse than that these batteries are prone to violent failure when deep discharged (i.e. beyond about 3V or there abouts) or overcharged. It is unsafe, as in explosive and/or violent uncontrollable burning with extremely toxic smoke, to use them with anything other than charge and discharge circuits specially designed for these batteries.

Suitable battery monitors are available, which generally use "coulomb counting" to give a much more accurate state of charge, i.e. a meaningful % figure. These are a worthy project ot interface to and run in themselves, as they generally use SMBus which is a cloase variant of I2C. These and bettery protection circuits, which disconnect batteries in the event of short circuits and low/high voltage, are normally fitted inside LiPoly battery packs and are in just about every mobile phone and laptop PC "battery".

So, dealing with these batteries is a potentially dangereous business, and its pretty unresponsible for students to be expected to use them without being fully aware of the dangers and the precautions that are needed for safety.

I've used these batteries in handheld devices, and seen what can happen. Please learn about and be fully aware of the dangers, respect these things!

RF Developer.
Ttelmah



Joined: 11 Mar 2010
Posts: 19328

View user's profile Send private message

PostPosted: Thu Mar 15, 2012 4:19 am     Reply with quote

Smile

If you think they are fun, try the Lithium Thionyl Chloride batteries in really big capacities (quad cell packs giving 76Ah). Get a cell to rupture, and then while standing back and watching it 'fume' gently, have a 'helpful' person, throw a fire bucket of water onto it....

Fortunately, with only a single cell, 90% of the problems get a lot smaller in this case (the biggest problem is that unlike many chemistries that are 'self balancing' if charged, without individual cell monitoring, these cells can become very dangerous indeed if a cell voltage rises even a fraction of a volt above their maximum charging voltage...). Also as well as being liable to electrical damage, many designs are built for minimum weight, and have almost no mechanical protection on the actual cells (designed to be built into a suitable case), and quite surprisingly small impacts can give 'interesting' results....

On the charge/monitoring circuits, Sanyo, as well as being one of the largest providers of the batteries themselves do a whole family of chips supporting monitoring/protecting everything from 1 cell to about 24cells (biggest I have used).

Best Wishes
RoGuE_StreaK



Joined: 02 Feb 2010
Posts: 73

View user's profile Send private message

PostPosted: Thu Mar 15, 2012 5:09 am     Reply with quote

Yeah I've been running lipos in RC helis for a few years, and been hanging around the candlepowerforum flashlight forum for a while, so there's been lots of changes in proposed powering solutions.
As Ttelmah says, the major issues usually arise when there are multiple cells and an imbalance is there; hence why I changed my plans from using 2x RCR123A's (half the length of an 18650) to using a single 18650. Also I realised I didn't need that much overhead voltage.

The cells themselves are "protected", in that they have an inbuilt circuit board to offer some protection. The charger I plan to ship with them (if I ever get that far) is a commercially made one with it's own protection as well. While not foolproof, it's a combo that at least gives some sort of tested protection.
The 3.4V cutoff (some say 3.2V) seems to be the recomendation on various forums of heavy lipo usage, for least failures and longest battery lifetime. Also means I don't need a boost circuit for anything, as it's all 3.3V max, including the Vf of the Cree power LEDs at the CC levels I'm aiming at driving at.

RF_Developer, so are you saying that I won't see much change in voltage level through the usable section of the lipo, so not worthwhile? I'm mainly looking at doing this as a "may as well" addition, as I plan on using an RGB LED as the main feedback interface for any mode selection etc. Figured I may as well make a heartbeat that actually gave some sort of info as well as looking cool.

Ttelmah, I got a googlewhack with AQV112AL; the only existing reference in the entire internet is this topic! Wink
RE: PNP transistors, what sort of numbers should I be on the lookout for for a suitable one? At this stage I'm just sourcing my SMD components through ebay for cheap shipping for a sufficient quantity, eg. I'll buy 100x 0603 0.1uF caps for $2 shipped; Here is a result for SMD PNP transistors, there are some 50x or 100x for around the $5-$6 shipped mark, would any of these do the job? I've found spec sheets for a few, but I don't know how to interpret a switching voltage etc.

Thanks for the input guys.
Ttelmah



Joined: 11 Mar 2010
Posts: 19328

View user's profile Send private message

PostPosted: Thu Mar 15, 2012 5:39 am     Reply with quote

Key is to just use AQV112. The 'AL' bit is the package (6pin DIL), and commercial grade. The data sheet has just the generic number. Smile
These are 'opto FETs'. Small mosfets (0.5A max), with an opto driver circuit to turn them on. Provide great isolation (5000V I think), with just a pair of contacts that are 'off' by default, and can be turned on by driving the primary LED. Effectively an excellent 'mini solid state relay'.
At low currents their voltage drop is tiny, and since they default to 'off', they are ideal for applications like this. Downside is cost (about $4 in one off).

Best Wishes
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Thu Mar 15, 2012 6:01 am     Reply with quote

Yes, you don't get much change in the voltage during the usable part of the discharge cycle. http://www.ibt-power.com/Battery_packs/Li_Polymer/Li_Po_DiscGph.JPG shows typical discharge curves for various discharge rates. You might think at first that you'll be OK but the variation of voltage for different discharge rates is about as large as the variation end to end for any one rate. In other words 0% left at 0.2C gives the same voltage as 70% left at 2C.

The situation becomes far worse as temperature varies, and these batteries heat up a fair bit if they are rapidly discharged, So voltage tells you very little, and is downright misleading over a practical temp range and with varying discharge rates. So coulomb counting "gas gauging", which measures and integrates all charge and discharge currents, is the only useful way to go with these extremely useful and high energy density batteries. ICs to do this are fairly easily available, Ti for example have many that'll do everything, all the math, even learning individual battery pack capacities on the fly. All you need to do is interface to them by I2C. These monitors are designed to stay at all times in close contact with the battery. That's what cell phone batteries actually are, a close coupled battery, safety circuit and monitor all in one: never divided. The monitor stays with the battery for life.

By the way, most of the safety issues with these batteries, including fires, have been seen, and often seen first, in the RC community. Partly as they appeared to treat them just like they had always treated batteries, and partly as they tended not to read and unfortunately not fully appreciate the fine detail of the datasheets, at least at first. From your description things seem to have moved on somewhat in the right direction in the last few years.

RF Developer
Ttelmah



Joined: 11 Mar 2010
Posts: 19328

View user's profile Send private message

PostPosted: Thu Mar 15, 2012 9:06 am     Reply with quote

Yes. Now (of course), if you can also measure _or have a good estimate_ of the current while reading the voltage, things get easier.
However have to repeat that the problems are a lot less with one cell.

If you work with a pack of cells, and don't check the cell by cell voltage when discharging, the cell with slightly higher internal resistance discharges first, and after a few (very few) cycles, you can get reverse biasing on the cell, and the result can then be 'explosive'. This can happen as cells age, and also because of manufacturing tolerances between the cells.
Proper monitor systems, monitor both the maximum voltage per cell when charging, and the minimum voltage per cell when discharging, cutting the connection if either gets 'out of spec.
The tendency in RC systems, is to balance the cells when charging, but not when discharging (extra weight....). Especially given the massive discharge currents that can be involved (figures like 10C!....), a fault can soon become 'catastrophic'.
If currents are relatively low (perhaps 0.2C) 90% of the problems disappear, and with a single cell, this should be reasonably OK.

Forgetting anything in the protection with large capacity versions of these cells can be very educational. Not long ago I was watching a demo of a new electric 'jet ski', where the designers had forgotten to handle the situation where the inlet gets partially obstructed, and cooling therefore disappears.

Best Wishes
RoGuE_StreaK



Joined: 02 Feb 2010
Posts: 73

View user's profile Send private message

PostPosted: Thu Mar 15, 2012 7:30 pm     Reply with quote

Well I guess you guys have rekindled my fear of something going "poof", so will have to dedicate some time to finding a "proper" battery management solution.

RF_Developer, yeah I'm getting to be quite fond of TI, they've got some nice cheap bits that give a lot of bang for the buck, and will happily send out samples. Going through their Battery Fuel Guage selector and selecting single-cell and I2C, I get 11 results, all under $1.50 each. Possibly the BQ27200 might be useful, but at this stage I've only glanced over the spec sheets and haven't quite grasped the requirements and proper usage.

Ttelmah, I have reasonable estimates of current, as the vast majority of power will be feeding a Cree LED from a CC source, of either 2A or 3A max depending on the LED I end up with. Does get a little trickier in that there's PWM of the CC, and the CC drivers will have several level modes.
Being 2400mAh or so batteries, 2A or 3A is only drawing at maybe 1.5C max, a looooong way from the power used by some of the RC stuff nowadays; it's not uncommon to find 3cell 5000mAh lipos with C-ratings of 40+! Hell, some of the nano-tech ones are burst-rated at 130C!

Anyway, looks like lots more research to come.
Ttelmah



Joined: 11 Mar 2010
Posts: 19328

View user's profile Send private message

PostPosted: Fri Mar 16, 2012 3:48 am     Reply with quote

I built my first electric RC helicopter, long before LiPo batteries, and before things like miniature gyros existed. Was over 30 years ago. Tiny (under 18" rotor diameter), and with a maximum battery like of about 6 minutes. Jittery as hell, flying it was like trying to balance a plate on your nose, while standing on a Pogo stick. The hot smells from battery pack and motor after it landed were 'interesting'. I built everything, from rotors, to the RC itself, to keep weight down. It went to a couple of shows here in the UK, and was at the time the smallest flying RC electric helicopter that anyone had seen.
I agree about the battery ratings commonly used now for RC, _but_ most helicopters manage over 10minutes flight duration now, which corresponds to under 6C current consumption 'in use'. The instantaneous ratings tend to only apply when something goes wrong. The higher discharge ratings, go along with lower cell resistances, and so help overall efficiencies.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group