Multi-Cell Slave-Version 2
Moderators: GregsGarage, retepsnikrep
- retepsnikrep
- Posts: 1387
- Joined: Sat May 26, 2007 4:50 pm
- Location: North Yorkshire England
- Contact:
Re: Multi-Cell Slave-Version 2
This compilies correctly and might work
- Attachments
-
- SLAVE_V12_29032012_12F1822.zip
- (4.3 KiB) Downloaded 1373 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.
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.
-
- Posts: 870
- Joined: Tue Apr 01, 2008 5:27 pm
- Location: Galashiels, Scottish Borders
- Contact:
Re: Multi-Cell Slave-Version 2
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;
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.
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
Daewoo Matiz
http://www.evalbum.com/4191
-
- Posts: 870
- Joined: Tue Apr 01, 2008 5:27 pm
- Location: Galashiels, Scottish Borders
- Contact:
Re: Multi-Cell Slave-Version 2
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. 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.
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
Daewoo Matiz
http://www.evalbum.com/4191
- retepsnikrep
- Posts: 1387
- Joined: Sat May 26, 2007 4:50 pm
- Location: North Yorkshire England
- Contact:
Re: Multi-Cell Slave-Version 2
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.
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.
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.
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.
-
- Posts: 870
- Joined: Tue Apr 01, 2008 5:27 pm
- Location: Galashiels, Scottish Borders
- Contact:
Re: Multi-Cell Slave-Version 2
retepsnikrep wrote:Lets see how accurate it is first. Linear or not it has worked very well so far.
Agreed, it does work fine, we'll leave it as is for now. What do you think about my crazy ideas for a analogue version?
Greg Fordyce
Daewoo Matiz
http://www.evalbum.com/4191
Daewoo Matiz
http://www.evalbum.com/4191
- retepsnikrep
- Posts: 1387
- Joined: Sat May 26, 2007 4:50 pm
- Location: North Yorkshire England
- Contact:
Re: Multi-Cell Slave-Version 2
GregsGarage wrote:What do you think about my crazy 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.
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.
-
- Posts: 870
- Joined: Tue Apr 01, 2008 5:27 pm
- Location: Galashiels, Scottish Borders
- Contact:
Re: Multi-Cell Slave-Version 2
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 ). 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
Daewoo Matiz
http://www.evalbum.com/4191
- retepsnikrep
- Posts: 1387
- Joined: Sat May 26, 2007 4:50 pm
- Location: North Yorkshire England
- Contact:
Re: Multi-Cell Slave-Version 2
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 (80.22 KiB) Viewed 31192 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.
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.
-
- Posts: 870
- Joined: Tue Apr 01, 2008 5:27 pm
- Location: Galashiels, Scottish Borders
- Contact:
Re: Multi-Cell Slave-Version 2
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
Daewoo Matiz
http://www.evalbum.com/4191
-
- Posts: 870
- Joined: Tue Apr 01, 2008 5:27 pm
- Location: Galashiels, Scottish Borders
- Contact:
Re: Multi-Cell Slave-Version 2
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 beIt was reporting software as V10.
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;
It won't save huge amounts of space but I think it makes the code slightly easier to understand.
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
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 but I think it makes the code slightly easier to understand.
Greg Fordyce
Daewoo Matiz
http://www.evalbum.com/4191
Daewoo Matiz
http://www.evalbum.com/4191
Who is online
Users browsing this forum: No registered users and 7 guests