#REM Li-Ion Battery Management System Remote Display & PC Data Logging Module By Peter Perkins. Picaxe 08M - PIC12F683 - 240809 - www.150mpg.co.uk - V0.09 **************************** 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 (Not used) (Rxd Serial Data In) Input 3 -4| M |5- Output 2 (Data OK Led Out) ----- ********************** 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 134 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 Capacity (0-255Ah) Rounded down to nearest Ah symbol ErrCell = b6 ;Number of the Cell with any Error condition `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 = 2 ;Times Alarm must occur before Alarm activates (Must be set same as in Master) `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 Piezo = 1 ;Audible Alarm Warning on Output 1 symbol Led = 2 ;Data OK Led on Output 2 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 `******************************************************************************* `******************************************************************************* Start: ;Program Start high led ;Turn off data Led (Sink driven) serin Rxd,N2400,("bms"),b0,b1,b2,b3,b4,b5,b6 ;Receive data via 433mhz radio link from Master sertxd(#b0," ",#b1," ",#b2," ",#b3," ",#b4," ",#b5," ",#b6) ;Transmit data to PC via programming lead if AlarmCount >= AlarmActivate then DisplayAlarms ;If AlarmsCount >= AlarmActivate then low led ;Turn on data Led (Sink driven) serout Lcd,N2400,(254,128,"Volts ",#PackVoltage," Soc ",#Soc," ") ;Transmit data to Lcd serout Lcd,N2400,(254,192,"Temp ",#Temp1," ",#Temp2," ") ;Transmit data to Lcd goto Start ;Goto program start DisplayAlarms: ;Action taken depends on Alarm Bits (8 different Alarms max!) serout Lcd,N2400,(254,1) ;Transmit data to Lcd pause Delay ;Pause for 50ms at 4mhz serout Lcd,N2400,(254,128,"Alarm ",#b0) ;Transmit data to Lcd serout Lcd,N2400,(254,192,"Cell ",#b6) ;Transmit data to Lcd