Peak detection and/or thermal sensing

hi all, first post on the grovy new forum! (i used the old one a while back)

i drive RC cars, but i don't want to fork out £100+ for a decent charger, as i have a perfectley good power supply. but to charge at any decent power i explode batteries (done it before, whole garage was filled with black soot). so i thought, could i make a peak detection module for the power supply? it would need to detect a 5mv voltage drop that happens when the batteries reach full capacity. i think a thermal one would be easier, but i am unsure of the codeing. what is the input measured in? is it just degrees centegrade? so i could just tell the mosfet on the power to switch off when the temperature reaches 40 degrees C? or is it a more complicated method?

thanks,
joe

P.S i only did on project using an 08 chip in DT. i was top of the class for that though, just don't expect me to know too much.
 

BeanieBots

Moderator
Delta T (temperature rise) is the LAST RESORT when charging batteries and should not be used as the primary cut-off mechanism.
Delta V should be your first port of call. Positive for NiMh and negative for NiCd. DO NOT try L ion or Li poly unless you really know what you are doing.

You are looking for rates of change, NOT absolute values.
A PICAXE and an op-amp or two makes a great battery charger but please read up about how to do it. This has been covered to death on this forum so I'll not say any more and just point you here.

http://www.batteryuniversity.com/index.htm
 

BeanieBots

Moderator
Glad to hear you will be avoiding lithium:)
After a little research, you will soon discover that the "experts" cannot agree on the best ways to recharge batteries:(
If I give my opinion, somebody will quickly give theirs as well.
I'm afraid to say, you will have to read up and make a choice.
One thing over which there is no contention is that if you want to charge NiMh or NiCd in less than about 14hrs, you should use a constant current and determine end of charge by voltage delta peek. Temperature and total charge time should also be monitored as fail safes.
The contention comes in what values should be used and if there is any benefit with extras such as burp charging.
Good luck and do come back with any specific questions you may have.
 
Last edited:

hippy

Technical Support
Staff member
I did some experimenting with charging a single NiMh / NiCd cell direct ( via R's ) from an 08M using multiple I/O pins ( search the forum ) and that was VERY instructive. It's a good way to experiment with Delta-V detection, and you can then try pulse charging, charge/mini-discharge/charge, and all other manner of fancy things.

Search out Microchip Application Notes, other reference designs for battery chargers, and dig through a Search Engine for better examples of user projects ( some are pure rubbish ). You'll come out of it a lot more knowledgeable about batteries than when you went in. It was one of the most enjoable experiments I've worked on getting theory and practice to match up.
 

BeanieBots

Moderator
Nor really. Take it one step at a time.
Decide what features you want. How to get the PICAXE to interface to your supply. Code to do it.
This forum can help every step of the way.
 

boriz

Senior Member
The internal resistance of a battery gets higher as the remaining charge gets lower. I have thought about possibly using this as a charging management system for the high capacity NiMh AAs I use in my digital camera.

Something like this: Charge for say 20 minutes at about C/3, rest for 1 minute, test internal resistance, if below threshold change to trickle/maintenance charge, if above threshold then start another cycle. A thermal cut off and a ‘max number of cycles’ would be used as backups for faulty batteries. Each cell would have is own charge manager to ensure best results for cells of different capacity/condition.

Does this seem like a workable system?
 

Michael 2727

Senior Member
i could just tell the mosfet on the power to switch off when the temperature reaches 40 degrees C?
I think the 40 Deg may be a little low, I would
have thought more like 50 or 55 Deg.
You will find lots of info on the web to help you
decide what to use. 40 Deg is a warm sunny
afternoon here in OZ, between Jan to Feb :)
 

hippy

Technical Support
Staff member
actually, reading up on it, it all seems very complicated... maybe too complicated.
That's what I thought when I started but it's relatively straight forward, although you can make it as complicated as you want. As BeanieBots says, take it one step at a time. It takes a bit of time for everything to sink in, but you can try a bit, see how that fits with what application notes describe, and it will all hopefully start to make sense.

That was the beauty of a single cell setup to start with. One can charge at 25mA using just a single PICAXE I/O line and you can watch the battery voltage rise with a DMM. Nothing more than an 08M, a battery, a resistor and a HIGH command :)

You can add an ADC connection and read the voltage into the PICAXE and send it to the PC using SERTXD. A bit of maths and you can determine actual voltage and display that rather than some 'abstract number'.

You can then charge the battery for a while, stop charging it ( make the pin low which also conveniently puts a load on the battery ), do the READADC, then put the charging line high again. You'll find that gives a much more accurate voltage reading for the battery.

At some point you'll see the voltage curve you're plotting from the data shown on your DMM / PC start to drop rather than go up. That's the Delta-V peak ( or whatever it's actually called ). Then all you need to do is write some code to have the PICAXE detect that and deal with it - stop charging, or go to trickle charge.

You can add all sorts of improvements, like not charging an already charged cell, initially not testing for Delta-V for a while after starting charging because it's not very reliable then, initially trickle charging so you can better handle duff batteries. You can also add a discharge option, over temperature checks and most important of all ( I believe anyway ) a timeout so charging stops after N minutes regardless so even if everything goes wrong you won't find your battery exploding ( the timeout should probably be based upon initial voltage ).

The simplest charger just applies charge, a safer one just applies charge for N minutes. The next improvement is Delta-V. Then you can add fancy stuff, over-temperature and Delta-T.

This simple one cell charger can be expanded to multiple cells and packs charged from higher voltages with relevant hardware changes. As I say, you can learn a lot from a very simple setup and a bit of experimentation.
 

BeanieBots

Moderator
@ Hippy. Spot on.
Single cell is a lot easier to manage. Measuring V when the current is off is the most accurate method. For NiCd, the moment the voltage drops is the best point to stop. For NiMh, it should be a bit earlier. The method I use for NiMh is to stop when the voltage rises by less than a certain amount in a given period. Might result in very slightly undercharging but kinder to the battery.

@ Boriz. In breif, no.
Sort of works in theory but the characteristic you want to use is an unknown for each battery and depends on charge state and varies with age. If you serial numbered all the cells and kept a log of their characteristics which was keyed into the charger each time, then maybe.
 

leftyretro

New Member
@ Hippy. Spot on.
Single cell is a lot easier to manage. Measuring V when the current is off is the most accurate method. For NiCd, the moment the voltage drops is the best point to stop. For NiMh, it should be a bit earlier. The method I use for NiMh is to stop when the voltage rises by less than a certain amount in a given period. Might result in very slightly undercharging but kinder to the battery.

@ Boriz. In breif, no.
Sort of works in theory but the characteristic you want to use is an unknown for each battery and depends on charge state and varies with age. If you serial numbered all the cells and kept a log of their characteristics which was keyed into the charger each time, then maybe.

Single cell is much simpler. Multicell smart charges have to be able to detect shorted cells or unbalanced cells, so they usually have to be told via the user interface what kind of battery and the nominal voltage. State of the art smart charges are pretty complex and pricy. You can find out a lot about possible features and capacity of smart charges if you research the radio control hobby sites as they are always pushing battery usage to the very edge :)

Lefty
 

VK3PK

New Member
NiMh charging should use NDV

Hi all,
I am currently reworking a base charger for a Quanshang handheld radio with NiMh batteries (using 08M) and I came accross the following quote, concerning charge termination using Positive Delta Voltage for NiMh batteries. This is contrary to how it should be done.

Delta T (temperature rise) is the LAST RESORT when charging batteries and should not be used as the primary cut-off mechanism.
Delta V should be your first port of call. Positive for NiMh and negative for NiCd. DO NOT try L ion or Li poly unless you really know what you are doing.
http://www.batteryuniversity.com/index.htm

Both NiCd & NiMh batteries exhibit Negative Delta Voltage at full charge. Reading www.batteryuniversity.com will confirm this.

If PDV is used, the battery charging will either terminate immediately as the voltage will have Positive slope as it starts charging or if a larger Positive slope is looked for, it may never detected it and the battery will probably cook.
I find with my charger that there is approx 25mV negative change, which is easily picked and consistantly being detected by my algorithm.
Of course, in addition to to NDV termination, there should be a timeout mechanism.

Incidentily, I scale the voltage with two resistors & connect it into the PICAXE via LM741 a unity buffer. This is essential as the input current to the input of the ADC causes inaccuracy which is hard to mop up in code.


Regards,
Lee
________
medical marijuana dispensary
 
Last edited:

hippy

Technical Support
Staff member
Both NiCd & NiMh batteries exhibit Negative Delta Voltage at full charge.
You're right, and for those who aren't familiar with what that means; while the battery is being charged its voltage increases, when it reaches full charge its voltage will start to drop. A nice picture of the effect can be found here ...

http://www.mpoweruk.com/images/nickel_chargers.gif

Note that the drop for NiMh is a lot less than for NiCd which can make it harder to detect. Rather than just considering the drop from last sample also check the drop from its peak. With good electronics it is also possible to use Zero Delta Voltage checking for NiMh; that is looking for when the voltage stops rising during charging so it never gets to the point where it starts dropping again.
 

Fowkc

Senior Member
What, in the opinon of people here, is the best indicator of whether a given cell is already charged?
 

hippy

Technical Support
Staff member
To prevent overcharging when fully charged ? Initial voltage is a good first step, then checking it is rising although it may take a few minutes before Neg Delta-V becomes reliable, so best to not charge at full-whack until the battery is stabilised. Also don't charge if battery voltage is not within a valid range. That also helps prevent trying to charge batteries connected the wrong way round.

Microchip have a reasonable App Note which I found enlightening on a few points ...

www.e-radiocontrol.com.ar/?download=picref-2.pdf
 

BeanieBots

Moderator
Both NiCd & NiMh batteries exhibit Negative Delta Voltage at full charge.
You are of course correct.
However, it should be noted that the characteristics are somewhat different between NiCd and NiMh.
NiCd should be terminated as soon as a particular rate of volt-drop is observed. (-dV/dT)
NiMh should be terminated as soon as the rate of RISE in voltage DROPS to a certain level. (+dV/dT)
Sorry if my earlier text was misleading.

@Hippy, Nice document.
 
Last edited:

VK3PK

New Member
Charge termination etc.

Hi all,
I have not fully explored the possibility of teminating with dV/dt=0,
but I will research that.

Today I proved that the software for the NDV work quite reliably using two different battery packs for three discharge cycles.

Both the two battery packs both gave NDV's of 20mV.
One pack terminated consistantly at 8.4 volts and the other at 8.7 volts. Each battery is identical (same age etc.) with 6 cells, so that gives a cell Voltage of 1.4 - 1.45 Volts/cell.

Neither battery was hot when charging terminated, but there was an ever so slight warmth. I cannot get into the packs and I agree with
BeanieBots that Delta Temperature termination is not even worth thinking about.
My charger, charges at C/10 rate for a maximum period of 15 hours before giving up on NDV.
When it terminates, the charge rate goes to C/300 trickle charge to safely overcome selfdischarge.

I will have a go at charging a few packs that belongs to fellow hams at my radio club so that I have a little more data to work with.


The PICAXE puts out some diagnostics at State changes use sertxd and I hope to add the voltage at start of charging & duration of charge.

I will also put in a test, to determine how many minutes before the NDV is reached, that the dV/dt =0 is reached.I

Once that is done & I will post the code should anyone be interested.


Lee
________
marijuana strain strawberry cough
 
Last edited:

BeanieBots

Moderator
Most of my work with PICAXEs and battery charging has been with the PP3 9v type. This is mainly because I don't want to tie up an expensive high current charger doing the job. All the cheapies that "cater for" for PP3s are just C/5 chargers with no time cut-out.

I've tested several dozen batteries of both technologies with good results charging at 60mA. (C/3). The biggest problem with these batteries is that they are not designed for fast charge, have no vent and will hardly warm up at all at such low currents. They are also quite fragile when it comes to overcharge with little tollerance to anything over C/10 once full.

I settled on +3mV/3min. I found -ve sometimes did not occur with NiMh on older batteries. The main reason for that being variation in cell capacity caused by excessive discharge. Each cell may well exhibit the characteristic but the pack as a whole can fail to do so. The disadvantage is that NiCd will sometimes cut-off prematurely, especially if there are large ambient temperature changes such as when left by a window.

I did design in "burp" charging but I do not have enough data to draw any conclusion. IMHO it does help but that is only based on a sample of less than 50 charge/discharge cycles on only three batteries. The batteries tested were over ten years old and may well have scewed the results with "re-forming" recovery added into the wear degredation. To do the tests properly would take up too much time and patience and really needs to be caried out in an environmental chamber to have any validity.
 

hippy

Technical Support
Staff member
@ VK3PK, BeanieBots : What would be really useful is if you could provide circuit diagrams of your charging circuits. The hardware side of things can be a black art to those of us more software oriented. Proven workable solutions may be the difference between people giving it a go and not doing so.

The big advantage of a PICAXE controlled charger is that different charging strategies can be evolved although as BeanieBots notes it's not always easy to measure improvements.

One thing I found very useful was to use SERTXD to output the current voltage every so often and an elapsed time. That allows the charging to be manually put on graph paper or a PC program used to graph the results. StampPlot would probably be ideal for this.

I also found it handy to use a LED to show what mode the charger was in -

Off - Not doing anything
Infrequent Blip on - Discharging
On - Charging
1Hz - Charged / Trickle charging
Fast blipping - fault condition

A bi-/tri-colour LED is even more useful.

The big effort in debugging code is the time taken to charge. I found the easiest thing was to charge cells up on a commercial charger, discharge them slightly then use the PICAXE to charge again. That means Delta-V can be tested without a two day wait :)

Charging PP3's is an ideal application for a PICAXE-08M and I reckon it's possible to create a far better charger than most commercial ones and at a lower price.
 

BeanieBots

Moderator
@ VK3PK, BeanieBots : What would be really useful is if you could provide circuit diagrams of your charging circuits.
Can't speak for VK3PK but I find drawing diagrams of something which to me is simple not worth the effort. I fully appreciate that does not help anyone else but it really does take a lot of time to produce a legible diagram.
In addition to that, it was very much a "design as you build" circuit from whatever was to hand at the time and consequently not the most obvious choice of components. For example, the 60mA charge current is switch with a 200v 25A FET, because I'd just removed one from an old PSU.

It really is quite simple though. Based around PICAXE 18X
Power is 15v @ 1A from 9-18v DC-DC converter. (any good 15v will do)
For charging, 15v - FET - LM317* - diode - battery.
The FET in turn is controlled by 2N2222A controlled by PICAXE.

For discharge, (and Burp)
PICAXE - 2N2222A - LM317* - diode - battery.
There are also LEDs fitted to the PICAXE outputs for monitoring.
AXE033 shows voltage when idle, capacity when charging/discharging.
(never got round to making it show volts during charge)

*LM317 with single resistor to produce constant current. See LM317 app notes in datasheet for details.

Potential divider from Battery to ADC input set to give around 5v for 11v at battery.
Three illuminated push buttons for start/stop and can't remember why 3rd.
Peizo to indicate end of charge/error.

That's pretty much it. I did get around to putting it in a box which is also quite rare for me.

Just to add to my embarrasment, here's the code which might give a little more insight into how it's all hooked up. Undocumented, not neat and no gaurantees.:eek:

Code:
'Battery charger V1.21

pause 500
Start:
w1=0
w2=0
w3=0
w4=0
w5=0
w6=0
pause 50
if pin1=0 then start
serout 0,n2400,(254,1)
pause 50

high 4
serout 0,n2400,(254,128,"BATTERY CHARGER")
serout 0,n2400,(254,192,"V 1.21   ")
w4=0 'reset counter
SERTXD ("") 'initialise serial out
low 5
low 6
'******************************************************
Main:
for b4=1 to 50
low 7
low 3
low 2
pause 50

if pin7=0 then discharge
if pin6=0 then charge
readadc10 0,w0
w1=w1+w0
Next b4

high 3
low 3
pause 5

w1=w1/40
b4=w1/100
b5=w1//100
w1=0

serout 0,N2400,(254,192,"Volts=",#b4,".")
if b5>9 then L2
serout 0,N2400,("0")
L2:
serout 0,N2400,(#b5,"v")

goto main
'******************************************************
charge:
w3=0
for b11=1 to 6
  w2=0
  for b10=1 to 10
    high 3 'charge on
    pause 996
    readadc10 0,w0
    if w0=1023 then Fault
    low 3 'charge off
    pause 3
    readadc10 0,w0
    w2=w2+w0
    high 7 'discharge on
    pause 5
    low 7  'discharge off
    pause 2
    w4=w4+1
  next b10
  w3=w3+w2

  b2=w4/60*50/60

  Gosub Display
next b11

if b2>250 then EndCharge 'time truncate
if w6<=w3 then L1
b3=b3+1
gosub send
if b3 > 3 then EndCharge
goto charge
L1:
b3=0
w6=w3
gosub send
goto charge

EndCharge:
high 5
toggle 2
sound 1,(110,25)
pause 10
sound 1,(90,25)
pause 10
if pin1=0 then start
goto EndCharge

'***********************************************************
discharge:
w2=0
w3=0
for b10=1 to 20
  high 7 'discharge
  pause 2
  readadc10 0,w0
  w2=w2+w0
  pause 998
  low 7
  pause 3
  readadc10 0,w1
  w3=w3+w1
  w4=w4+1
next b10
w2=w2/2
w3=w3/2

b2=w4/60*50/60
gosub display
gosub send

sound 1,(110,2)
if w2<5620 then EndDischarge
goto discharge

EndDischarge:
high 6
toggle 2
sound 1,(110,25)
pause 10
sound 1,(90,25)
pause 10
if pin1=0 then start
goto EndDischarge


'***********************************************************
Fault:
low 3
low 7
serout 0,N2400,(254,128,"CONNECTION FAULT") 
serout 0,N2400,(254,192,"OR DUFF BATTERY")
Goto EndCharge

Display:
pause 1
'serout 0,N2400,(254,128,#w2," ",#w3,"          ")
serout 0,N2400,(254,192,#w4,"    ",#b2," mAh")

return

send:
sertxd(#w4,",",#w2,",",#w3,",",#b2,",",#b3,13,10)
pause 1

return
 
Top