Old BMS Software Thread

Threads relating to the BMS system begun by Peter Perkins

Moderators: GregsGarage, retepsnikrep

steiner
Posts: 89
Joined: Mon Sep 08, 2008 1:50 am
Location: Florida

Re: BMS Software

Postby steiner » Wed Apr 14, 2010 4:03 am

Peter,

These look good. I haven't had a chance yet to try them so I have just been looking at the logic. I have two questions though.

1. On the master software you have a "pause 100" between the command 2 and the command 1. I assume this is to allow sufficient time for all of the slaves to finish executing command 2 before you move on to command 1. If this is correct, would it be possible to tie the pause to the number of cells? I am only running 24 cells vs your 48.

2. In the slave software under command 1 you set "CellV=CellV-DLow". I remembered we did this to reduce the data from a word to a byte to speed up the data flow. However, we now have VData=to the lowbyte of CellV. Do we still need to subtract DLow?

By the way, I really like the way you write code. The logic flows very well.

Rick

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

Re: BMS Software

Postby retepsnikrep » Wed Apr 14, 2010 8:04 am

steiner wrote:1. On the master software you have a "pause 100" between the command 2 and the command 1. I assume this is to allow sufficient time for all of the slaves to finish executing command 2 before you move on to command 1. If this is correct, would it be possible to tie the pause to the number of cells? I am only running 24 cells vs your 48.
Correct try altering it until it doesn't work. You might get away with pause 50

steiner wrote:2. In the slave software under command 1 you set "CellV=CellV-DLow". I remembered we did this to reduce the data from a word to a byte to speed up the data flow. However, we now have VData=to the lowbyte of CellV. Do we still need to subtract DLow?
I think so, but there is a logic error near there so i will post an updated slave version.

steiner wrote:By the way, I really like the way you write code. The logic flows very well.
I think lots of comment lines is the answer to aid understanding.

Try this.

www.solarvan.co.uk/bms/PicMultiSlaveV26_140410.txt
www.solarvan.co.uk/bms/PicMultiSlaveV26_140410.hex
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.

steiner
Posts: 89
Joined: Mon Sep 08, 2008 1:50 am
Location: Florida

Re: BMS Software

Postby steiner » Fri Apr 16, 2010 12:17 am

Peter,

I noticed you increased the number of A/D conversions from 10 to 100 in the slave software. Is the "pause 100" in the master software still going to be enough time for all of the slaves to finish before moving on to command 1?

How do you typically determine the amount of "pause" needed? Do you use a scope or just some basic math? I can see the math would allow 200,000 instructions to be executed in 50 msec if the processor is running at 4 Mhz. It is my understanding just because we use one line in PicBasic, the software may in fact create several lines of instructions. So how do you count the number of instructions?

I hope to test the software this evening. I will let you know what I find.

steiner
Posts: 89
Joined: Mon Sep 08, 2008 1:50 am
Location: Florida

Re: BMS Software

Postby steiner » Fri Apr 16, 2010 3:00 am

OK...I tried the new code for the slaves and the master. I am getting some strange results but it might be due to my setup. For starters I am still running version 1 of the master. However, I have the code stripped down to do nothing but run the "Check voltage" and "Check current". I belive these portions of the two master boards are similar.

Here is what I am getting. Every channel on the slave is turning on its load resistor. The display is showing both the high cell and low cell at 1.75 volts. The display is also flashing the alarm screen that a cell is below absolute minimum voltage.

I remed out the lines of code that pertain to command 3 (turn on load resistors as needed). This turned off all of the load resistors on the cells.

I am sure what I am about to explain has a reason as I went back and looked at some previous versions of the master software and they are identical in this area. However, I can't seem to make sense of it.

In the "CheckVoltage" routine of the master, you create a loop to bring in each individual cell voltage. Then a little farther down you create a second loop to check each cell voltage to determine the highest and lowest cell voltage. In this loop you set "CellVoltage = 0". Then a little farther down you have "CellVoltage=CellVoltage + DiscardLow". I understand why we are adding "DiscardLow" back in. The problem I have is that I don't see where we ever put the byte value back into "CellVoltage". If we don't do this then the above addition will always equal DiscardLow which happens to be 175.

Like I said, I am sure I am missing something as this basic portion of the code hasn't changed in a while. I am just trying to figure out why all of my cells are reading 1.75 volts.

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

Re: BMS Software

Postby retepsnikrep » Fri Apr 16, 2010 4:49 am

I suspect the problem must be in the slave code as in order to turn the loads on in repsonse to command 3 then the voltage measurement in the slave must have produced a voltage stored in CellS that is above the load turn on point.

Have you used the slave with command software before?

Do the other commands work?

I assume you are getting data back when sending command 1 and not a data timeout error.

The slave software does state it is for master Mk2 but i can't remember if the changes are really significant.

I'll need to look at the problem.

Re the 100 adc checks i timed them by using a scope on the slave alive pin and one loop took 1.8ms if i remember correctly. that's very quick and the slave will do many adc measurements before the master gets back round with command 2. But we could change this back to 10 if we suspect it is the issue.

Edit Just had a look at master and slave can't see anything obviously wrong.

The code below from the master is correct.

CellVoltage = 0 ;Clear CellVoltage Variable
VoltageData = @ptrinc ;Load VoltageData (b2) with value from Scratchpad Ram and inc data pointer

It clears the CellVoltage word variable and then loads the first byte of stored data from the scratchpad ram into the low byte (Voltagedata) of the CellVoltage word variable. Later it then adds on 175 to this to recreate the slave cell voltage. If you look at the variable definitions at the top of the program it might be clearer.

You have the picbasic compiler I suggest change the slave back to 10x adc oversampling and see if that helps.

Please confirm exactly which known versions of the slave & master software you were using prior to this problem developing with the new ones.

Edit

I will program a test pic later and try and do some testing myself. But i'm away for two weeks shortly and running out of time. I will be available via internet for advice etc whilst away.
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.

steiner
Posts: 89
Joined: Mon Sep 08, 2008 1:50 am
Location: Florida

Re: BMS Software

Postby steiner » Sat Apr 17, 2010 7:07 pm

Peter,

I found the problem. On my slave software I reduced the number of A/D samples to 10 but forget to reduce the division (CellV = CellV / 100). I went ahead and changed the A/D samples back to 100. That seems to have everything working properly right now. I am currently charging and I will let you know how the load resistors work as each one of them activate.

Initially it doesn't make sense to me why the load resistors were turning on since my A/D was 1/10 of what it should be. I need to look at the code to see why it was happening.

Update: This new software seems to work very well. I charged a 24 cell pack until all of the cells were bypassing. When a particular cell turned on its bypass load, I didn't see any sign of adjacent cell loads turning on. Each one waited until the cell reached its designated turn on voltage of 3.65 volts. The load resistors were bypassing 1 amp and my sense leads are 24 ga. wire.

Thanks for the help...

Rick

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

Re: BMS Software

Postby retepsnikrep » Sun Apr 18, 2010 5:18 am

Rick

That's good news can you just confirm you are using the PicMultiSlave v26 software now and it's OK?

Please descrive how it is operating as your cells reach full charge. I'm especially interested in the load on period out of each cycle.

Could you please post your now working slave and master code so i can have a look. Can we also please have some pics of your setup.

Thanks Peter
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.

steiner
Posts: 89
Joined: Mon Sep 08, 2008 1:50 am
Location: Florida

Re: BMS Software

Postby steiner » Sun Apr 18, 2010 4:43 pm

Peter,

Yes, I am using the PicMultiSlave software v26. The only modification that I did was to rem out "Toggle SlaveAlive" since my slaves don't have anything connected to GPIO.5.

When a cell initially reaches the cut in load value, the LED lights for only a moment as I am sure when the load is turned on the cell voltage probably drops enough such that the load is turned off. It only does this for about 30 seconds although I am sure this would be a function of your charge rate. I was charging 90 Ahr cells at 8 amps which I manually reduce as the highest cell reaches 3.7 volts. After the initial 30 seconds, the LED comes on continuously with a short time off that I am sure coincides with the pic taking the voltage reading. I would guess the duty cycle to be about 80% on and 20% off (I will try to measure it more accurately today). Keep in mind that my master software is currently configured with "Check Temp", "CheckSpeed" and "MenuButtons" all remed out. It is basically only running the "CheckVoltage" and "CheckCurrent" routine. I'm sure if all of the software was running the duty cycle would be higher.

I will e-mail you my code and some pics for you to post.

I have to spend some time on the "CheckCurrent" routine. It is calculating the current correctly but I believe the SOC data is in error. I'm using a LEM Hass 300-S for the current sensor.

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

Re: BMS Software

Postby retepsnikrep » Sun Apr 18, 2010 6:40 pm

steiner wrote:The only modification that I did was to rem out "Toggle SlaveAlive" since my slaves don't have anything connected to GPIO.5.


I do suggest leave that in as it provides a useful scope check and timing point if you suspected a slave was not working. Now you won't know if a slave is running unless the load is at the trigger point etc. The toggle command takes virtually no time to execute and it doesnt matter if the pin is not connected to anything.

Sound slike the new code is working a lot better which is a relief! :shock:

I have to spend some time on the "CheckCurrent" routine. It is calculating the current correctly but I believe the SOC data is in error. I'm using a LEM Hass 300-S for the current sensor.


If the amps/current are displayed correctly then hopefully the code can't be too far out.

Soc is tricky. Remember the main program loop should only execute one per second. If it is running faster it will draw down the soc faster etc. Can you explain in more detail what the problem is with it.
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.

steiner
Posts: 89
Joined: Mon Sep 08, 2008 1:50 am
Location: Florida

Re: BMS Software

Postby steiner » Sun Apr 18, 2010 8:14 pm

When I am charging at 8 amps into a 90 Ahr pack, I would think the SOC would increase at 8.8% per hour (8/90). I am getting a considerably higher rate than 8.8% per hour.

Edit:

Initially I did a quick calculation in my head. This time I recorded the data and the SOC calculation looks good.


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 26 guests