#REM Li-Ion Battery Management System Slave (Analogue On/Off Charger Control) By Peter Perkins. Picaxe 08M - PIC12F683 - 171108 - www.150mpg.co.uk - V1.15 Beta. **************************** General Information ********************************* The BMS modules carry no warranty or guarantee of any kind! They are used at your own risk, and I make no claims as to their suitability for a particular function. Prospective users must evaluate the system before using it, and no liability will be entertained by myself in any shape or form whatsoever. The modules and software have been produced at low cost for the benefit of the EV & electronic community. The software is available free via the internet. Users may modify or adapt the system as they see fit. If you are not fully competent to work on potentially lethal battery systems and high voltages, then do not experiment with or use this system. Be aware that vehicle modifications can lead to invalidated insurance and warranty issues. You the end user remain fully liable for any modifications made to your vehicle. ************************* Slave Picaxe 08M Pinouts ******************************* Top _____ (+ Cell Supply) +Ve -1| ^ |8- -Ve (- Cell Supply) (Program In) Rxd -2| 0 |7- Output 0 (Bypass Load Out) (Low V Opto Out) Output 4 -3| 8 |6- Input 1 (RefAdc In 1.235V) (Slave Data Bus In) Input 3 -4| M |5- Output 2 (High V Opto Out) ----- ******************** Analogue Slave Module Specifications ************************ Supply/Cell Voltage 1.75 - 5.00V DC (Pic limits) Average Supply Current at 3.35v <1ma Voltage Ref LM 385 1.235V accuracy 1% Supply/Cell Voltage sensing accuracy +/- 20mv Maximum balancing/bypass current with 15R resistor 333ma at 5.00V CPU Speed 31khz - 8mhz with internal resonator (Lower speed used for power saving) Permitted Working Cell Voltage Range 1.75 - 4.30V Note Slave Opto's are Sink driven therefore (Pic Output Low = Opto On, High = Opto Off) ***************************** Slave Clock Speeds ********************************* *********************** Reducing CPU Speed Saves Power *************************** ******** Use the slowest speed setting that gives acceptable performance ********* %00000000 = 31 kHz 19bps %00010000 = 125 kHz 75bps %00100000 = 250 kHz 150bps %00110000 = 500 kHz 300bps %01000000 = 1 MHz 600bps %01010000 = 2 MHz 1200bps %01100000 = 4 MHz 2400bps %01110000 = 8 MHz 4800bps Example = poke $8F,%01100000 'Set clock to 4 MHz ********************************************************************************** ********************** Program Size 60 out of 256 Bytes ************************** ********************************************************************************** ***************************** Simulation Notes ******************************** Use a generic adc input of 650 to simulate a cell voltage of 1.92V Use a generic adc input of 400 to simulate a cell voltage of 3.16V Use a generic adc input of 300 to simulate a cell voltage of 4.20V #ENDREM `Variables Constants and I/O definitions `Variables 16bit symbol RefADC = w0 ;w0 (b0,b1) = Cell ADC Raw input data 0-1023 (10bit) `To work out the below values use the formula X = 63200 / V * 2 `X is the constant you wish to calculate for use in the symbol section below `V is the voltage reqd `The calculation should be rounded down at each stage and is strictly left to right `e.g. MaxVOptoOn = 336 was calculated from X = 63200 / 375 * 2 (375 = 3.75V) `Constants symbol MaxVOptoOn = 336 ;336 = 3.75V Maximum Cell Voltage Opto On > 3.75V (Charger cut off Voltage) symbol MaxVOptoOff = 350 ;350 = 3.60V Maximum Cell Voltage Opto Off < 3.60V (Charger start up Voltage) symbol LoadOn = 350 ;350 = 3.60V Balancing load/bypass cut in Voltage > 3.60V (Load cut in point) symbol LoadOff = 356 ;356 = 3.55V Balancing load/bypass cut out Voltage < 3.55V (Load cut out point) symbol MinVOptoOn = 526 ;526 = 2.40V Minimum Cell Voltage Opto On < 2.40V (Low Cell V Alarm On) symbol MinVOptoOff = 504 ;504 = 2.50V Minimum Cell Voltage Opto Off > 2.50V (Low Cell V Alarm Off) `Pins used for I/O and designations `*** Digital high/low Outputs *** symbol Load = 0 ;2W 15R Transistor driven load/bypass resistor on Output 0 symbol HighOpto = 2 ;HighOpto on Output 2 symbol LowOpto = 4 ;LowOpto on Output 4 `*** Analogue ADC Inputs *** symbol RefInput = 1 ;LM385 1.235V RefAdc on Input 1 `********************************************************************************** `********************************************************************************** Start: ;Main program start disablebod ;Disable Pic Chip Brown Out Detection to function at lower supply V poke $8F,%00000000 ;Set CPU to 31khz for lower power consumption `********************************************************************************** `Note the reverse if/then logic in the below statements which is correct! `The RefADC input is inversely related to the Pic supply voltage when measuring the lm385 ref `As the Cell voltage rises the value returned for the lm385 1.235v ref drops and vice versa! `Note Slave Opto's are Sink driven, therefore (Pic Output Low = Opto On, High = Opto Off) Main: ;Main program loop label readadc10 RefInput, RefADC ;Measure ADC voltage reference 1.235v LM385 if RefADC > MinVOptoOn then ;If RefADC > MinVOptoOn then Cell Voltage is Lower than min permitted low LowOpto ;Turn on LowOpto (Low Cell V Alarm On ) & led if fitted) endif if RefADC < MaxVOptoOn then ;If RefADC < MaxVOptoOn then Cell Voltage is higher than max permitted low HighOpto ;Turn on HighOpto (Warning/Charger/Controller/Regen Cutback) {Stop Charger} endif if RefADC < LoadOn then ;If RefADC < LoadOn then Cell Voltage is higher than Load switch on point high Load ;Turn on load (and load indicator led If fitted) endif if RefADC < MinVOptoOff then ;If RefADC < MinVOptoOff then Cell Voltage is higher than min permitted high LowOpto ;Turn off LowOpto (Low Cell V Alarm Off) & led if fitted) endif if RefADC > MaxVOptoOff then ;If RefADC > MaxVOptoOff then Cell Voltage is lower then max permitted high HighOpto ;Turn off HighOpto (Warning/Charger/Controller/Regen Cutback) {Start Charger} endif if RefADC > LoadOff then ;If RefADC > LoadOff then Cell Voltage is lower than Load switch off point low Load ;Turn off load (and load indicator led if fitted) endif goto Main ;Goto program main loop