#REM Li-Ion Battery Management System Remote Display & PC Data Logging Module By Peter Perkins. Picaxe 08M - PIC12F683 - 301209 - www.150mpg.co.uk - V0.24 **************************** 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. ******************** Remote Display Picaxe 08M Pinouts ************************ Top _____ (+ Supply) +Ve -1| ^ |8- -Ve (- Supply) (Program In) Rxd -2| 0 |7- Txd (Program Out & Txd to Pc) (16x2 Lcd Display Out) Output 4 -3| 8 |6- Output 1 (Data OK Led Out) (Rxd Serial Data In) Input 3 -4| M |5- Output 2 (Spare) ----- ********************** Watchdog Module Specification ************************** Supply Voltage 5.00V DC same as Master Average Supply Current at 5.00v 10ma CPU Speed 8mhz with internal resonator 2400 baud serial comms via 433mhz wireless link with Master 9600 baud serial comms via Pc USB lead Wireless range 75M approx Audible alarm sounds 0-5 seconds after Alarm received or data/signal failure Alarm delay 0-5 seconds adjustable via 100k pot ******************************************************************************* *********************** Program Size 234 out of 256 Bytes ********************** ******************************************************************************* #ENDREM #picaxe 08M ;Set editor to Picaxe 08M Mode `Variables Constants and I/O definitions `Variables `Variables 8bit (Byte) ;Note some Word variables converted to byte variables by Master ;for transmission to remote display to save variables symbol AlarmByte = b0 ;Alarm Type Byte (0-255 number of different Alarms) symbol AlarmCount = b1 ;Alarm Counter Byte (0-255 number of times an Alarm has occured) symbol Temp1 = b2 ;Temp1 Sensor LM335 (0-100C) symbol Temp2 = b3 ;Temp2 Sensor LM335 (0-100C) symbol PackVoltage = b4 ;Pack Voltage (0-255V) symbol Soc = b5 ;Pack Soc (0-100%) Rounded down to nearest % symbol ErrCell = b6 ;Number of the Cell with any Error condition symbol AmpData = b7 ;Amp Data to nearest Amp (-100 to +100A) `AlarmByte (b0) Additional Information (255 possible Alarms) 0 = No Alarms `If AlarmByte = 0 then (No Alarms Set) `If AlarmByte = 1 then (Cell over AbsMax V) `If AlarmByte = 2 then (Cell under AbsMin V) `If AlarmByte = 3 then (Cell data serial transfer timeout error) `If AlarmByte = 4 then (Battery Pack over AbsMax Temp) `If AlarmByte = 5 then (Alarm Test Condition) Used to simulate Alarms `If AlarmByte = 6 then (End Charge & Battery Fault Condition) (Pack Voltage Drop) `Constants symbol Delay = 50 ;Pause for 50ms at 4mhz symbol AlarmActivate = 3 ;Number of times Alarm must occur before Alarm activates symbol BaudN2400 = N1200 ;Baud rate 2400 at 8mhz (T=True Idle High)(N=Inverted Idle Low) `Pins used for I/O and designations `*** Digital high/low Outputs *** symbol Txd = 0 ;Serial 4800 baud out to PC via prog cable on Output 0 symbol Led = 1 ;Data OK Led on Output 1 symbol Lcd = 4 ;Serial 2400 baud out to 16x2 Lcd on Output 4 `*** Digital high/low Inputs *** symbol Rxd = 3 ;Serial 2400 baud in from Master via 433mhz link on Input 3 `******************************************************************************* `******************************************************************************* setfreq m8 ;Setfreq CPU Freq to 8mhz with internal resonator sertxd(13) ;Send a lone CR to ensure PLX-DAQ buffer is ready serout Lcd,BaudN2400,(254,128,"No Signal!") ;Transmit data to Lcd Start: ;Program Start high led ;Turn off data Led (Sink driven) serin Rxd,BaudN2400,("bms"),b0 ;Receive qualifier & control code from Master (0) = Normal (1) = Dump Data if b0 = 0 then ;If control code (b0) = 0 then Normal Data for Display on lcd screen serin Rxd,BaudN2400,(b0,b1,b2,b3,b4,b5,b6,b7) ;Receive data via 433mhz link from Master sertxd("DATA,TIME",",",#b0,",",#b1,",",#b2,",",#b3,",",#b4,",",#b5,",",#b6,",",#b7,",",13) ;Txd data to PC 9600 baud if AlarmCount >= AlarmActivate and AlarmByte > 0 then DisplayAlarms ;If conditions met goto DisplayAlarms low led ;Turn on data Led (Sink driven) serout Lcd,BaudN2400,(254,128,#PackVoltage,"V ",#Soc,"% ",#AmpData,"A ") ;Transmit data to Lcd serout Lcd,BaudN2400,(254,192,#Temp1,"C ",#Temp2,"C ") ;Transmit data to Lcd else ;Control code (b0) = 1 then Dump Data from eeprom to PC low led ;Turn on data Led (Sink driven) Prevents audible alarm during data transfer do while b0 <> 255 ;Do Loop until b0 = 255 end of data marker serin Rxd,BaudN2400,(b0) ;Receive data via 433mhz link from Master sertxd(#b0,",") ;Txd data to PC via usb cable 9600 baud loop ;Loop until b0 = 255 (End of data) endif goto Start ;Goto program start DisplayAlarms: ;255 different possible Alarms!) serout Lcd,BaudN2400,(254,1) ;Transmit data to Lcd serout Lcd,BaudN2400,(254,128,"Alarm ",#b0," Cell ",#b6,254,192," * Check BMS! * ") ;Transmit data to Lcd if b0 = 6 then ;If Alarm = 6 (End Charge) then pause 5000 ;pause for 5 seconds to allow audible alarm to sound low led ;Turn on data Led (Sink driven) Silence audible Alarm endif