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

Postby steiner » Wed Jul 08, 2009 11:08 pm

Peter,

Thanks for your help. Your solution fixed the problem. The mistake that I made was that I changed the line of code that was originally
"symbol Baud2400 =T1200" to
"symbol Baud2400 =N1200". I did this because instead of the display that you are using I was using a typical 16x2 LCD display. I have used them many times and it always required an inverted baud rate. What I failed to notice was that the same symbol "Baud2400" is used in the "check cells" routine when it reads in the data from the slaves. This didn't produce any error messages as it is a legitimate command but an incorrect one for this application.

Since I have several lines of code throughout the program that are used for the LCD display, I left the symbol statement set to N1200 and simply inserted T1200 in the line of code

"serin [TimeOut,DataError],MasterBus,T1200,@ptrinc"

Everything is working properly now.

As for the "InitialSoc and SocMax being set to 9000 you may also notice that in the "CalcSoc" routine I changed to the following:

CountW = Soc / 100
CountX = Soc // 100

These were originally divided by 1000. If my thinking is correct this will now allow a max battery pack capacity to go to 650 Ahr (mine is 90 Ahr). I will loose the hundredths place but I don't think that resolution is required.

Thanks again for the help. It was driving me nuts.

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

Postby retepsnikrep » Thu Jul 09, 2009 7:14 am

Rick

Glad you got sorted. Can I suggest you mark any changes you make in the code with ;Rick (Comment) on each line so they are easy to spot.

CountW = Soc / 100 ;Rick Change in current Calc
CountX = Soc // 100 ;Rick Change in current Calc

I can do find "Rick" then as well to help debugging.

Be careful the byte (0-255) variable SocCounter does not overflow as the current measurements accumulate over a minute.

The lower number of cells you have the faster the main loop will run accumulating current data with an increased sample rate. If it does 60 loops a minute, (That's what mine runs at approx) that's fine, however if it manages > 255 loops a minute then the loop counter SocCounter will overflow causing an error as it is used to divide the accumulated current to work out the average charge/discharge for the minute.
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

Postby steiner » Fri Jul 10, 2009 1:00 am

Yes, adding the comment to lines that I modify is a very good idea.

Thanks for pointing out the possible overflow on SocCounter. I will keep an eye on it.

Since I can not view the latest vsm files, could you send them to me as jpeg?

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

Postby steiner » Sun Jul 12, 2009 2:57 am

Peter,

When you put your BMS in your car what portions of the software did not work properly due to the EMI issues? I was just curious if everything had errors or just one portion. I would assume most of the problem was the signal being transmitted from the slaves to the master causing erroneous cell voltage readings. I just wanted to have an idea of what problems you ran into.

Rick

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

Postby retepsnikrep » Sun Jul 12, 2009 7:22 am

The problem I had was that the Honda Insight emi or whatever caused such noise on the master bus that it upset the Master Pic causing it to reset etc.

The problem was the Master bus wanders all around the cells and I did not use twisted pair or any screening!!! The program ran fine with engine off and would run to some degree with car ticking over but as soon as IMA system started drawing large current and noise increased it would reset. It almost ran and worked about 60% of the time, so the problem was not terminal. I still havent had time to re-do my connections and relocate my Master/add filtering etc. Too many other projects on go.

I suspect my problem will be cured by

1) Screening/twisted pair on Master interconnects.

2) Stronger pull down on Master bus and possible zener 5.1v spike clamps across it at Master.

3) A possible additional layer of opto isolation at Master board where master bus comes in.
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

Postby steiner » Sun Jul 12, 2009 9:31 pm

I was just curious what type of errors you got. I have mine hooked up with only two slaves and so far everything is working fine. I did use twisted pair unshielded wires between the slaves and master though.

I was also curious if you ever tried the "count" function prior to your series of buttons. I had used this in a previous program with PicBasic and it worked very well. It only requires one button and simply measures how many times it is pressed in a certain time period.

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

Postby steiner » Sun Jul 12, 2009 10:54 pm

Peter,

I also forgot to mention that I just ordered a display similar to yours. Can you point me in a direction that will help me understand the numeric codes that are in the serout lines to the video display? Here is a typical one:

serout Video,Baud9600,(27,83,0,8,"Pack> Max Temp") ;Video Display

The numbers that I am referring to are (27,83,0,8). They seem to be different from the typical 16x2 LCD display codes.

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

Postby steiner » Sun Jul 12, 2009 11:23 pm

I knew as soon as I asked the question about the display codes, I would find the answer. I had forgotten about the SV2000 chip. Once I went to their web site guess what I found....... the codes.

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

Postby retepsnikrep » Mon Jul 13, 2009 4:45 am

Remember I had it working fine on the bench with 50 slaves and the Master even with my rubbish wiring.

The codes as you have found are the control codes for the SV2000. They mean things like cursor position x,y or clear screen etc etc.

The single button idea is ok but I wanted a simple multi button solution where a specific button = a specific function. Feel free to change it.

The issue you may have if you say count how many times it is pressed is that it will hold up the program at that point until your time period has elapsed.
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.

wjdennis
Posts: 17
Joined: Tue Aug 05, 2008 5:27 pm

understanding serial

Postby wjdennis » Sat Jul 18, 2009 5:21 am

Can someone help me understand the serial communication between the slaves and master? Here's what I think I know.

1) Master uses 5V as Mark and 0V as Space
2) For Master Bus, all slave optos are connected in parallel
3) On Master, Rx is tied to 0V when all slave optos are off
4) When any slave pulls pin 5 low, its opto turns on and Master sees 5V

So if all that is correct, the next part is where I get confused. In the slave interrupt routine:

1) The software pulls pin 5 low, which sends a Mark (5V) to the master
2) serout is called, which I assume sends a Space, 8 bits, then Mark
3) The software pulls pin 5 high, which sends a prolonged Space to Master--until next slave starts transmitting

That last step is what I don't understand. Why doesn't the Master see that final Space as a new start bit and try to start reading data again? Shouldn't the Master bus stay high (e.g. in Idle) until the next slave is ready to send data, and only then go to Space for a start bit?

Thanks.

Bill


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 5 guests