#REM Li-Ion Battery Management System Remote Display & PC Data Logging Module By Peter Perkins. Picaxe 08M - PIC12F683 - 100909 - www.150mpg.co.uk - V0.16 **************************** 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 4mhz with internal resonator 2400 baud serial comms via 433mhz wireless link with Master 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 191 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 AmpSign = b7 ;Amp Sign (+ or -) symbol AmpData = b8 ;Amp Data to nearest Amp (-100 to +100A) symbol WhMile = b9 ;Wh/Mile Data (0-255 wh/mile) `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 `Constants symbol Delay = 50 ;Pause for 50ms at 4mhz symbol AlarmActivate = 3 ;Number of times Alarm must occur before Alarm activates `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 `******************************************************************************* `******************************************************************************* sertxd(13) ;Send a lone CR to ensure PLX-DAQ buffer is ready Start: ;Program Start high led ;Turn off data Led (Sink driven) serin Rxd,N2400,("bms"),b0,b1,b2,b3,b4,b5,b6,b7,b8,b9 ;Receive data via 433mhz link from Master sertxd("DATA,TIME",",",#b0,",",#b1,",",#b2,",",#b3,",",#b4,",",#b5,",",#b6,",",#b7,",",#b8,",",#b9,",",13) ;Transmit data to PC if AlarmCount >= AlarmActivate and AlarmByte > 0 then DisplayAlarms ;If gosub Alarms Display low led ;Turn on data Led (Sink driven) serout Lcd,N2400,(254,128,#PackVoltage,"V ",#Soc,"% ",b7,#b8,"A ") ;Transmit data to Lcd serout Lcd,N2400,(254,192,#Temp1,"C ",#Temp2,"C ",#b9,"wh/m ") ;Transmit data to Lcd goto Start ;Goto program start DisplayAlarms: ;255 different possible Alarms!) serout Lcd,N2400,(254,1) ;Transmit data to Lcd pause Delay ;Pause for 50ms at 4mhz serout Lcd,N2400,(254,128,"Alarm ",#b0," Cell ",#b6,254,192," * Check BMS! * ") ;Transmit data to Lcd