`Battery Management System Slave Module by Peter Perkins `Picaxe 08M PIC12F683 - 180708 - www.150mpg.co.uk - V0.51 Beta `********************* General Information ************************** `The BMS modules carry no warranty or guarantee, and are used `at the owners own risk. No claims or liablity will be entertained in any `shape whatsoever. The modules and software have been produced free for the `benefit of the EV and electronic community worldwide. The software, hardware `code and source files, inc pcb layouts are made 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 voltages then do not experiment with/use this system. `******************* Slave Module Specification ********************* ` Supply/Cell Voltage 1.75 - 5.00V DC ` Average Supply Current at 4.00v <100ua ` Voltage Ref LM 385 1.235V accuracy 1% ` Supply/Cell Voltage sensing accuracy +/- 30mv ` Maximum balancing/bypass current 333ma at 5.00V ` Serial data rate 2400 baud ` Maximum Cell Capacity 65ah ` Maximum 128 Slave Modules per Master Module ` CPU Speed 4mhz with internal resonator ` Permitted Working Cell Voltage Range 1.75 - 4.30V ` RefVADC should be 1263 but can be adjusted to compensate for variations. `******************************************************************** `Variables Constants and I/O definitions symbol VoltageData = b0 ;b0=Voltage data byte (8bit value) (Sent to Master via serial link) symbol CellVoltage = w0 ;w0=Corrected Raw Cell Voltage (16bit value) symbol RefADC = w1 ;w1=Raw Adc input data variable range 0-1024 10bit symbol RefVADC = 1270 ;RefVADC = Fixed Ref Voltage LM385 1.235v * 1023 = 1270 (Can be ajusted 1250-1280) symbol MaxCellVoltage = 370 ;Maximum Cell Voltage 3.70v (Balancing load/bypass cut in point) symbol Led = 4 ;Red Interrupt Indicator Led on Output 4 symbol Load = 1 ;2W 15R Transistor driven load/bypass resistor on Output 1 symbol Delay = 10 ;Interrupt and data delay time in milliseconds (10ms) symbol DiscardLow = 175 ;Cell correction value 175 or 1.75V subtracted from CellVoltage symbol DiscardHigh = 430 ;Cell correction value 430 or 4.30V (If Cell V>430 or <175 then error) `Disable Pic Chip Brown Out Detection to enable function at lower supply Voltage disablebod `Activate interrupt when pin3 goes high `Data request received from Master or previous Slave and cascades through Slave Pics setint %00001000,%00001000 `Main program loop Main: `Measure voltage reference readadc10 2, RefADC `Cell Voltage Calculating routine to ascertain CellVoltage `Multiply/Divide *25/25 to improve integer math accuracy CellVoltage = RefVADC *25 /RefADC * 100 /25 `If Cell V > MaxCellVoltage (3.75v) then turn on load (and load indicator led If fitted) if CellVoltage > MaxCellVoltage then high Load else low Load endif `Convert (CellVoltage) data into single byte (VoltageData) for transmission `If CellVoltage >4.30V or CellVoltage <1.75V then set out of range condition (b0=0) if CellVoltage >DiscardHigh or CellVoltage