Battery Discharge Protector

srnet

Senior Member
This is a circuit primarily designed to prevent Lithium Polymer (LIPO) batteries from being over discharged.

I have a few LIPO batteries, they are used in a lot of RC models these days. A 3 cell LIPO battery puts out a voltage of 12.6V fully charged and are quite handy for powering battery powered gear requiring 12V.

LIPO batteries, however, really do not like being discharged below 3V per cell, and for long life you really ought not to discharge below about 3.3V per cell. A LIPO battery left connected to a piece of gear left switched on can discharge the LIPO to such an extent that not only is the battery ruined, it can be dangerous to attempt re-charge.

Of course you could perform the same function as this PICAXE circuit with a pure analogue design, but using a PICAXE does make it rather easy to configure for the battery in use, and the particular cut off voltage you want.

This circuit uses a 08M2 to monitor the battery voltage and switch off the power via a MOSFET if the battery falls below a set limit. There are two switches, one for on and one to manually switch off. There is a LED which flashes briefly when the battery is checked, about once every 20 seconds or so. The LED flashes several times when the battery is measured below the limit. The battery has to be low for a period (about 5 x 20 seconds) before its shuts down. You can fit a piezo sounder which will give you sound effects too.

The poly fuse acts as both a current limiter, and via D1 will also protect against reverse battery connection. It can be omitted and D2 fitted to protect against battery reversal. Take care if using LIPO batteries without a fuse, a typical LIPO designed for RC model use can easily put out 100A or more when shorted, cause a fire, or burn you if you are holding the wires at the time.

There is no over voltage protection, the LP2950 has a maximum input voltage of 30V, so dont exceed that. Also make sure that the capacitor C2 has a voltage rating that exceeds the voltage of the incoming battery supply.

The resistor divider puts approx 1/10th the supply voltage at the PICAXE AD input, and with the 2.048V reference in use the maximum input voltage that can be read is 20V.

At a current consumption of 500mA, I measured 1.2mV across the MOSFET, thats 600uW of dissipation, so at 5A, the MOSFET would still only be dissipating 6mW, which would raise the junction temperature a mere 0.21C above ambient.

There are 3 pads for the PICAXE programming connection on the edge of the PCB, either make a adapter of a 3.5mm stereo line socket and 3 test clips and hook into the pads holes, or fit a DIL socket for the 08M2 and program it elsewhere.
 

Attachments

Last edited:

srnet

Senior Member
Code;

Code:
'Battery Protector.bas
'Software for the battery protector PCB.
'Designed to act as a on\off switch and battery monitor. The sofware monitors the battery supply
'and turns off the power when the battery falls below the set limit. 


'circuit current consumption, LED on, 2.5mA.

#no_data
#terminal 4800
#picaxe 08M2

#rem 
Decide on the cut off voltage per cell, and enter the number of cells in the battery. 
The example below is for a 3 cell Lithium Polymer battery.

If you want better accuracy, measure the input voltage with a multimeter, and compare it with
the reported reading. 
Work out the adjustment percentage, and put it in the percentageadjust value below, other wise
just leave the figure at 100 (for 100%) 
#endrem


symbol lowcellvolts = 3300 	'In mV cut off limit per celll
symbol cells = 3 			'Number of cells in the battery
symbol percentageadjust = 103	'Adjustment percentage to compensate for tollerance of PICAXE fixed voltage referance
					'Example, if the voltage needs to be adjusted upwards to 103% of the reading use 103
					'Example, if the voltage needs to be adjusted downwards to 97% of the reading use 97	
	
symbol lowbatcountlimit = 5	'Number of times in a row that a low battery reading triggers power off  

'byte variable definitions
symbol lowbatcount = b2
symbol loopv1 = b3
symbol ADadjusttemp = b4

'word variable definitions
symbol lowbatteryvolts = w13
symbol batteryvolts = w12
symbol wvar1 = w11
symbol wvar2 = w10
symbol ADadjust = w9
symbol ADreading = w8
symbol ADreadingsum = w7

'hardware definitions
symbol forceon = c.4
symbol PXLED = c.2
symbol forceoff = pinc.3



main:

pullup %001000					'Enable pull up on power off switch on c.3

setint %00000000,%00001000			'Setup for interrups on the off switch at 0

high forceon					'Turn power on			'
sertxd (CR,LF,"Power on",CR,LF)

high PXLED						'LED is on whilst power is on


'calculate and display the total voltage of the battery
sertxd ("Battery Protector.bas - Stuart Robinson July 2013",CR,LF)
sertxd (CR,LF,"Cutoff Voltage per cell: ",#lowcellvolts,"mV",CR,LF)
sertxd ("Number of cells: ",#cells,CR,LF)
lowbatteryvolts = lowcellvolts * cells
sertxd ("Battery Cutoff voltage: ",#lowbatteryvolts,"mV",CR,LF,CR,LF,CR,LF)
lowbatcount = 0


pause 2000 						'Wait a while so its obvious power is on

loop1:
	'Main program loop. Battery is checked about once every 20 seconds. The battery needs to be below the limit
	'For the number of these checks defined in symbol lowbatcountlimit before the power is turned off
	
	ADreadingsum = 0
	
	low PXLED						'Flash the LED so we can see the protector is running, this will also cause a
	pause 250						'click if a piezo is fitted
	high PXLED
		
	for loopv1 = 1 to 5				'Read the battery voltage 5 times to get an average
		fvrsetup FVR2048				'Set FVR as 2.048V
		adcconfig %0011 				'Set FVR as FVR = Vref+, 0V Vref-		
		readadc10 c.1, ADreading   			
		sertxd ("AD Reading: ",#ADreading,CR,LF)
		ADreadingsum = ADreadingsum + ADreading
	next loopv1

	ADreading = ADreadingsum / 5			'Average the reading
	
	sertxd ("Average AD Reading: ",#ADreading,CR,LF)
		
	ADadjusttemp = percentageadjust		'Get the percentage adjust into a variable
	
	if ADadjusttemp > 100 then			'Need the absolute value of the percentage change
		ADadjust = percentageadjust - 100  
	else 
		ADadjust = 100 - percentageadjust
	end if		
	
	ADadjust = ADreading * ADadjust / 100	'Turn the percentage change into a percentage of the AD reading
	
	if ADadjusttemp > 100 then			'Add or subtract the percentage variance
		ADreading = ADreading + ADadjust
	else 
		ADreading = ADreading - ADadjust
	end if		
	
	sertxd ("Adjusted Average AD Reading: ",#ADreading,CR,LF)	

	batteryvolts = ADreading * 20			'Convert AD reading to mV
	
	sertxd ("Battery Voltage: ",#batteryvolts,CR,LF)

	if batteryvolts < lowbatteryvolts then	'Battery is below the set limit so increment the fail count	
		sertxd ("Warning ! Battery Low: ",#batteryvolts,"mV",CR,LF)
		inc lowbatcount
		sertxd ("Low Battery Count: ",#lowbatcount,CR,LF)
		for loopv1 = 1 to 5
			low PXLED 				'Flash LED and click piezo to warn of low batter condition
			pause 1000
			sound c.2,(125,10)
			high PXLED
			pause 1000
		next loopv1	
	else
		sertxd ("BatteryOK: ",#batteryvolts,"mV",CR,LF) 'Battery is OK 
		lowbatcount = 0
	end if

	if lowbatcount => lowbatcountlimit then 	'The battery has been below the limit a number of times in a row
		sertxd ("Battery Low Count Limit Reached",CR,LF)
		goto poweroff
	end if
	
	sertxd (CR,LF) 
	pause 19000						'Wait a while befor checking battery again. 

goto loop1
	

poweroff:	
	sertxd ("Low Battery Power off",CR,LF)
	sound c.2,(125,500)				'Make a sound
	pause 1000
	low PXLED
	low forceon						'Turn off the power
	sound c.2,(125,500)
	sertxd ("Warning - Low Battery Power off Fail!",CR,LF)	'Help, we should not get here, the power was turned off
	reset	
end



manualpoweroff:	
	sertxd ("Manual Power off",CR,LF)
	low PXLED
	low forceon						'Turn off the power
	sertxd ("Warning - Manual Power off Fail!",CR,LF)	'Help, we should not get here, the power was turned off
	reset	
end



interrupt:
	'a switch press has been detected
	
	sertxd ("Checking Power off Switch,")			
	setint off						'Dont want more interrupts
	
	'this loop ensures switch needs to be kept pressed for approx 1.2 seconds before the power
	'is actually turned of. If its a momentary switch press, return to normal battery monitoring. 
	for loopv1 = 1 to 12					 	
		if forceoff = 1 then				'Switch is not pressed
			sertxd (CR,LF)
			setint %00000000,%00001000		'Turn interupts back on	
			return					'Return to normal operation
		end if
		sertxd ("Off Selected,")
		pause 100
	next loopv1
	
	'if here the switch has been down for approx 1 second
	sertxd (CR,LF)
	goto manualpoweroff
	
	sertxd ("Warning - Interrupt Error !",CR,LF)	'Help, we should not get here
	reset
		
return   



end
PCB layout;
 

Attachments

Last edited:

techElder

Well-known member
Was reading through your code and noticed the following that caught my eye:

if ADadjusttemp > 100 then 'Add or subtract the percentage variance
ADreading = ADreading + ADadjust
else
ADreading = ADreading + ADadjust
end if

I've just run across a need for such a circuit and was dreading the work involved in getting there. Many thanks!
 

techElder

Well-known member
Uh, yeah. Your comment says " ' Add or subtract the percentage variance ".

Your code just adds the percentage. No subtraction?
 

srnet

Senior Member
See what you mean, it does look odd, no idea how that happened, I have built a few of them and they work just fine.
 

the old fart

Senior Member
Thanks for the project srnet, saved me a lot of programming time.

Built a similar pcb, with on board pieze and terminals for wires.

mosfet ok up to about 5 amps, but above that it heats up very quickly.(using mini fuse not a polyfuse)

I'll have to fit either a heatsink or HD relay.

thanks again for the program.

TOF
 

sniper887

Member
Also, make sure the MOSFET is getting enough voltage on its gate. The gate voltage will affect the on-resistance of the MOSFET. By the looks of the circuit the gate voltage depends on what voltage battery is hooked up.
 

srnet

Senior Member
Also, make sure the MOSFET is getting enough voltage on its gate. The gate voltage will affect the on-resistance of the MOSFET. By the looks of the circuit the gate voltage depends on what voltage battery is hooked up.
Correct, and the battery supply was used to switch the MOSFET on purpose.

The circuit can (just about) work on a single LiPo, the MOSFET was chosen to have a low enough gate threshold to allow this.

For 2S Lipo and above, the gate threshold will be at least 6V and the on resistance is down to 0.005ohms and then changes very little for Lipos above 2S.
 

srnet

Senior Member
So in a thread that is explicity about a discharge protector for Lithium Polymer batteries you think it is a good idea to suggest that people use a safety cutoff circuit for a Lithium Ion battery instead ?

Those so called protection circuits have a cut-off voltage that can be as low 2.44V, and as I mentioned in the first post of the thread, if you want LiPos to last they should NEVER be discharged below 3.0V, and most people would choose not to discharge them below 3.3V. There is little point in letting them go lower in any case, a LiPo has very little capacity left when it gets down to 3.3V.

My LiPo charger will not, because of the fire & explosion risk, allow me to charge a LiPo that has been allowed to discharge to as low as 2.44V.
 
Last edited:

erco

Senior Member
Those so called protection circuits have a cut-off voltage that can be as low 2.44V
"Can be" calls for speculation, counselor. :)

My LiPo charger will not... allow me to charge a LiPo that has been allowed to discharge to as low as 2.44V.
Since your battery charger is not up to the task, you'll revel in the good news that this sophisticated little 28-cent wonder also provides overcharge protection, short circuit protection, and overcurrent protection in addition to over-discharge protection.
 

srnet

Senior Member
"Can be" calls for speculation, counselor
You provided that information, so presuambly you agreed with it. Check out the data in the link you gave.

Anyone interested in what the rest of the World thinks about the lowest voltage a LiPo should go to can search through the results on Google;

https://www.google.co.uk/search?q=lowest+discharge+volts+for+a+lipo&ie=utf-8&oe=utf-8&client=firefox-b-ab&gfe_rd=cr&ei=aOR5V8q1I6Ww7QbNmanICg

If anyone finds comment that 2.44V is OK, let me know.
 

erco

Senior Member
How funny is that, I was nearly about to concede that the 28-cent "power management chip" I linked to was only for Li-Ion cells (the Ebay listing does say it's for 18650 cells) when I saw this similar item from Tenergy: http://www.tenergy.com/32003 , called a Protection Circuit Module: 3.7V Li-Polymer (8A Limit)

Also listed at http://www.batteryjunction.com/prcimopcbfor.html

Tenergy certainly knows a thing or two about Lithium batteries, and the product description says Compatible Chemistry: Li-Ion/Li-Po

Specs:

Over Discharge Protection:
Over Discharge Detection Voltage: 2.5±0.062V (pretty much identical to the Ebay item)
Over Discharge Release Voltage: 3.0±0.075V (not specified on the Ebay item)

Over Current Detection Current: 14.0&#65374;20.0A

So the two items may be similar in specs and function, even if the detection/release terminology is somewhat ambiguous and contributing to the confusion. But certainly we can all agree that the release (cutoff) voltage of 3.0V is better than 2.5V for all Lithium chemistries.
 

techElder

Well-known member
Sometimes I call these anomalies; sometimes "crowd-sourced technical specs."

It's best to quote verified specs from real hardware that solves (or causes) real problems.

Sometimes the crowd is just the crowd and doesn't have the real specs.
 
Top