Multi-Cell Slave-Version 2

Threads relating to the BMS system begun by Peter Perkins

Moderators: GregsGarage, retepsnikrep

User avatar
retepsnikrep
Posts: 1387
Joined: Sat May 26, 2007 4:50 pm
Location: North Yorkshire England
Contact:

Re: Multi-Cell Slave-Version 2

Postby retepsnikrep » Thu Mar 29, 2012 3:02 pm

This compilies correctly and might work ;)
Attachments
SLAVE_V12_29032012_12F1822.zip
(4.3 KiB) Downloaded 1356 times
Regards Peter

Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.

GregsGarage
Posts: 870
Joined: Tue Apr 01, 2008 5:27 pm
Location: Galashiels, Scottish Borders
Contact:

Re: Multi-Cell Slave-Version 2

Postby GregsGarage » Thu Mar 29, 2012 6:14 pm

Looks good Peter. I've got an idea for implementing the LoadVol for checking the status of the slave load. In the following sections of code;

Code: Select all

   if Command = 2 then       'If command = 2 then Load off
   VData = Command         'set VData to Command
   low Load         'Turn off bypass resistor and bypass led
***   if LoadVol = 0 then VData = 99   ***
   endif

   if Command = 3 then       'If command = 3 then Load on as reqd
   if CellS > CutInV then      'If stored cell voltage CellS > CutInV then
   high Load         'Turn on bypass resistor and bypass led
   endif
   VData = Command         'set VData to Command
   endif


Check for the correct value of LoadVol and if it isn't correct set VData = 99. Then the master can be programmed to recognise code 99 as a fault. I've inserted a sample code for command 2, syntax is probably not correct but it should give you an idea of what I mean. Command 3 can also have the same check, but it needs to check for both a load off and load on condition.
Greg Fordyce

Daewoo Matiz
http://www.evalbum.com/4191

GregsGarage
Posts: 870
Joined: Tue Apr 01, 2008 5:27 pm
Location: Galashiels, Scottish Borders
Contact:

Re: Multi-Cell Slave-Version 2

Postby GregsGarage » Thu Mar 29, 2012 10:12 pm

retepsnikrep wrote:I think we might get slightly worse accuracy using the FVR 1.024V reference compared to the 1.235v we had before as the calcuation for the constant yields a smaller number. :?

RefVADC con 52377 'Fixed Ref Voltage Calibration 1.024v * 1023 * 100 / 2 = 52377

RefVADC con 63200 'Fixed Ref Voltage Calibration LM385 1.235v * 1023 * 100 / 2 = 63200


I was looking at the effect of the 1.024 vref on resolution and noticed something a bit strange. The formula is not linear. :shock: I was expecting that it was. Is it a case that we have gotten away with it because the curve is fairly flat in the region that we are using, that is mainly 2.5 - 3.5? Here's some graphs of both formulas.

externalVref.jpeg
1.235vRef
Cell voltages along the bottom, raw adc up the side.
externalVref.jpeg (14.85 KiB) Viewed 30652 times


internalVref.jpeg
1.024vRef
Cell voltages along the bottom, raw adc up the side.
internalVref.jpeg (14.3 KiB) Viewed 30652 times


The reason I was looking at this was to see if a simpler formula could be used to convert raw adc to voltage. With a 1.024 vref and a 10 bit adc (1024) we should have something like 10mv per bit, which should enable us to use a lookup table or a much simpler formula. I can't remember how we got to the formula that we have used all these years, might be time to dig through the old posts, unless you have some notes handy Peter?
Greg Fordyce

Daewoo Matiz
http://www.evalbum.com/4191

User avatar
retepsnikrep
Posts: 1387
Joined: Sat May 26, 2007 4:50 pm
Location: North Yorkshire England
Contact:

Re: Multi-Cell Slave-Version 2

Postby retepsnikrep » Fri Mar 30, 2012 6:39 am

I don't have any notes on the formula. It came from a picaxe forum thread years ago.
How it works was discussed in the first BMS thread we started so searching that may help.

We might need to take some adc raw readings with known very accurate cell voltages and then work it out backwards to establish a new formula.

Lets see how accurate it is first. Linear or not it has worked very well so far. :wink:
Regards Peter

Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.

GregsGarage
Posts: 870
Joined: Tue Apr 01, 2008 5:27 pm
Location: Galashiels, Scottish Borders
Contact:

Re: Multi-Cell Slave-Version 2

Postby GregsGarage » Fri Mar 30, 2012 10:18 am

retepsnikrep wrote:Lets see how accurate it is first. Linear or not it has worked very well so far. :wink:

Agreed, it does work fine, we'll leave it as is for now. What do you think about my crazy :P ideas for a analogue version?
Greg Fordyce

Daewoo Matiz
http://www.evalbum.com/4191

User avatar
retepsnikrep
Posts: 1387
Joined: Sat May 26, 2007 4:50 pm
Location: North Yorkshire England
Contact:

Re: Multi-Cell Slave-Version 2

Postby retepsnikrep » Fri Mar 30, 2012 1:57 pm

GregsGarage wrote:What do you think about my crazy :P ideas for a analogue version?


I haven't thought about it but you can trip the slave bus or master bus as you wish with an analogue version.

Personally I prefer a cut down master using a 12F683 and serial 16x2 lcd
Regards Peter

Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.

GregsGarage
Posts: 870
Joined: Tue Apr 01, 2008 5:27 pm
Location: Galashiels, Scottish Borders
Contact:

Re: Multi-Cell Slave-Version 2

Postby GregsGarage » Fri Mar 30, 2012 2:54 pm

retepsnikrep wrote:Personally I prefer a cut down master using a 12F683 and serial 16x2 lcd

That would work for me as well. If you get a schematic drawn I can work on a pcb layout (no guarantees on how quickly I would get it done :shock: ). I am using Kicad, which is open source and free, but it should be able to import netlists from other programs.
Greg Fordyce

Daewoo Matiz
http://www.evalbum.com/4191

User avatar
retepsnikrep
Posts: 1387
Joined: Sat May 26, 2007 4:50 pm
Location: North Yorkshire England
Contact:

Re: Multi-Cell Slave-Version 2

Postby retepsnikrep » Sat Mar 31, 2012 4:49 am

OK this schematic has no Ah counting but is very simple, if we bin the buzzer we could have Ah counting using one of the little hall effect chips?
Attachments
SimpleMaster.jpg
SimpleMaster.jpg (80.22 KiB) Viewed 30625 times
Regards Peter

Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.

GregsGarage
Posts: 870
Joined: Tue Apr 01, 2008 5:27 pm
Location: Galashiels, Scottish Borders
Contact:

Re: Multi-Cell Slave-Version 2

Postby GregsGarage » Sat Mar 31, 2012 7:07 am

Can you generate a netlist? I'm not sure what format it needs to be for Kicad, maybe do a google search. I'm away today for 3 days, then back for 3 and then away again for a week, so it will probably be after that before I can work on it.
Greg Fordyce

Daewoo Matiz
http://www.evalbum.com/4191

GregsGarage
Posts: 870
Joined: Tue Apr 01, 2008 5:27 pm
Location: Galashiels, Scottish Borders
Contact:

Re: Multi-Cell Slave-Version 2

Postby GregsGarage » Tue Apr 03, 2012 1:14 pm

I'm back for a couple of days. Had a look at V12 of the software and have a couple of suggestions.

This section should be

Code: Select all

   if Command = 8 then       'If command = 8 then report software version number
   VData = 12              'Set VData to 12 (Software Version Number)
   endif
It was reporting software as V10. :o

We can get rid of the CellS word variable if we define VData as its own byte variable and not the low byte of CellV. The code would look like this;

Code: Select all

'Variables Constants and I/O definitions

'------------------------ Variables 16bit --------------------------------------

CellV   var Word          'Cell Voltage (16bit value)
RefADC   var Word          'Raw Adc input data variable range 0-1023 10bit
CutInV  var Word         'Balancing load/bypass cut in Voltage 
FailLow var Word         'Fail Safe Minimum Load voltage Cut off (Default 3.35V)
FailHigh var Word         'Fail Safe Maximum Load voltage Cut in (Default 3.85V)

'------------------- Variables 8bit --------------------------------------------

VData   var byte           'VData is slave data returned to master on master bus
CountB  var byte         'General 0-255 byte ADC loop counter variable
Command var byte         'Command 0-255

Code: Select all

Incomming:            'Incomming Command

       If Command < 1 Or Command > 13 Then Main
       
   if Command = 1 then       'If command = 1 then send voltage data on Master Bus
   if CellV >DHigh or CellV <DLow then   'If V >4.30V or V <1.75V set out of range    
   VData = 0         'Set VData = 0 Cell error out of Voltage range condition
   else
   VData = CellV - DLow      Convert Cell voltage to Byte (VData) for output
   endif     
   endif
   
   if Command = 2 then       'If command = 2 then Load off
   VData = Command         'set VData to Command
   low Load         'Turn off bypass resistor and bypass led
   endif

   if Command = 3 then       'If command = 3 then Load on as reqd
   if CellV > CutInV then      'If stored cell voltage CellV > CutInV then
   high Load         'Turn on bypass resistor and bypass led
   endif
   VData = Command         'set VData to Command
   endif   


It won't save huge amounts of space :shock: but I think it makes the code slightly easier to understand.
Greg Fordyce

Daewoo Matiz
http://www.evalbum.com/4191


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 24 guests