Old BMS Software Thread

Threads relating to the BMS system begun by Peter Perkins

Moderators: GregsGarage, retepsnikrep

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

Re: Old BMS Software Thread

Postby GregsGarage » Wed Sep 29, 2010 7:30 pm

I think I have found the answer to the timing problem and it may even be possible to include it in the master if memory permits. Have a look at this site; http://darreltaylor.com/DT_INTS-14/intro.html, in particular the Timer Template page. If I understand it correctly it would use around 250-300 words of program space on the pic, but shouldn't interfere with the rest of the program operation. Still that won't leave any room for other neat stuff in the master so I think instead I will see if I can get the elasped timer example to run on the watchdog.
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: Old BMS Software Thread

Postby GregsGarage » Wed Sep 29, 2010 8:52 pm

Here is my first attempt at new watchdog code. I need to get a newer version of pbp as even V2 won't compile properly, so this is not tested. You need to add the include files from the link in the previous post to your pbp enviroment. If I have done this right it should toggle pin 7 (GPIO.0) on the watchdog once per second, but the original functionality of the program remains the same.

EDIT: Removed incorrect code and instructions on using the DT_INTS-14.bas file. I had said you need to uncomment certain lines in the file. That was incorrect, if you did please reinstall a unmodified DT_INTS-14.bas version to your pbp folder. New code to be posted shortly, it may already have been posted depending when you read this. :wink:
Last edited by GregsGarage on Wed Oct 06, 2010 9:58 pm, edited 1 time in total.
Reason: incorrect code example.
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: Old BMS Software Thread

Postby retepsnikrep » Thu Sep 30, 2010 7:25 am

Well done Greg.

I havent tried it but most of darrells stuff needs the MPASM assembler and not the PB one which i have been using. MPASM is included with PBPRO, you have to set up microcode studio to call MPASM instead of PB assembler. There is a bit of fiddling about to do.

Looks hopeful see if you can get it running.

If you alreday have pbpro you can update it to the latest versions here http://melabs.com/support/patches.htm
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: Old BMS Software Thread

Postby GregsGarage » Thu Sep 30, 2010 7:53 am

retepsnikrep wrote:MPASM is included with PBPRO, you have to set up microcode studio to call MPASM instead of PB assembler.

I compiled one of the sample codes with microcode studio and what it did when it got to compiling the parts of the code requiring MPASM was to automatically search for the required assembler, then launched it and completed the process. This took under a minute on my pc and once it has found it, everything is setup automatically so any future compiles with MPASM happen automatically. What I would recommend is to compile one of his examples with the chip type set to the pic you are using. This will highlight any changes you may need to make to the DT_INTS-14.bas file for it to run properly on that chip. I will look at the patches and see if I can get it to compile properly. If it works and we can afford the code space in the master, we could try it in the master directly and see how it behaves.
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: Old BMS Software Thread

Postby retepsnikrep » Fri Oct 01, 2010 10:30 am

I have now programmed by 50 cell multislave boards A123 20ah pack with the new serial code. No issues so far. Ditto Master.

Killed the master when some slaves were balancing to simulate a fault and the slaves switched loads off after 5 seconds as planned! :) So that removes that potentially nasty issue.

Need to check alarms over V under V etc are functioning correctly. Slave update mode seems to work fine.

Here is a quick video of the Excel spreadsheet data logging from my 8 cell test setup on bench.

http://www.youtube.com/watch?v=Hxb5OA1kfJo
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: Old BMS Software Thread

Postby GregsGarage » Fri Oct 01, 2010 4:16 pm

Peter, you have been making better progress than me. Tried my new watchdog software today and its a mixture of good news and bad news. The good news is that the watchdog function still works :) the bad news is pin 7 doesn't toggle once a second. :( At least I haven't broken anything. :shock: Hoping it is something simple like not configuring a pin correctly. :? I don't think I will be able to do anything this weekend, will have another look next week.
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: Old BMS Software Thread

Postby retepsnikrep » Fri Oct 01, 2010 4:45 pm

Good luck, with the timer stuff, I got thoroughly peeded off with it. Now I have my 50 cell system up and running i shall just time my main loop over 30 loops and add a delay to give one loop per second :lol: It should be pretty consistent once running.

I may change the Excel data logging output to once every 30 seconds or once every minute. What do we think? One issue i haven't tackled is that PLX-DAQ only supports 26 columns so we might have to use two rows per cycle for 50 cells worth of data.

Also the onboard eeprom now only stores Alarm data once every second.
It stores the alarm number and the cell with the error if any. So two bytes every second. It has a 65000 byte capacity so can store 32500 seconds worth of data (9hrs). As we know it is stored every second and it stores data if there isnt any error as well as if there is, when we read it back we can work out when the alarm occured 8) This same alarm data is relayed via the remote link to the remote display. I simplified that a lot until we get it working properly.

I thought about just getting the program to read back the eeprom data on BMS startup and show any alarms from the previous cycle and when they occured? Very easy to implement. Once it has checked and displayed alarms if any then it start as normal and begins overwriting the old data.

I could just start a once a second loop counter when the BMS starts and just store data in the eeprom when an error occurs, but include the loop counter count i.e time in seconds since BMS activated! That way we have a huge capacity. I'll look into that and it makes the start up eeprom checking much quicker. :)
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.

User avatar
f.mendes
Posts: 19
Joined: Fri Sep 24, 2010 10:40 am

Re: Old BMS Software Thread

Postby f.mendes » Sat Oct 02, 2010 5:34 am

Hi there.

Greg, the time issue probably is because the watchdog timer does not have sufficient resolution, which causes several errors. What you think?

I talked with some people about PIC16 and PIC18, there is one PIC18 with the same characteristics and some more, PIC18F258, as the PIC16F886.

It does the same things, but has more memory, more functions, more timers, etc...

And you can choose about the compiler language, or Assembly or C language.

So I think we only have to gain from the update of the PIC16 to PIC18, maybe for Master board V3?!

Regards,

Francisco.

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

Re: Old BMS Software Thread

Postby retepsnikrep » Sat Oct 02, 2010 6:32 pm

Francisco

I don't want to change the main chip yet I don't understand this one fully yet :shock:

I have done quite a bit of work on the master software and chopped a few IMHO Unecessary options in preparation for a new master board. We now have over 2000 words of code space available for new functions including voltage control of cheap charger etc!!

It is running happily on my master V2 i'll post it after a bit more checking.

1) Alarm Transmission to remote display is always on. Removed menu option to toggle on/off
2) Data transmission to spreadsheet is always on. Removed menu option to toggle on/off
3) Removed alarm dumping to spreadsheet from eeprom. Removed menu option to toggle on/off
4) Removed Analog temp sensors code. Removed menu option to toggle analog/digital temp
5) Shuffled remaining menu options and removed Sub menu 3

6) Program now logs Alarms, the cell with the error (if any) and the time in seconds since BMS start to the eeprom. So each Alarm condition stores a maximum of 4 bytes of data to the eeprom per second. It does not record normal cycles.

7) Start up error check routine now displays errors recorded in eeprom from last BMS operating cycle. So you can see if an error occured during last cycle and see what it was and when it occured. I may make this an option available at any time from within main loop. So if charge ended normally you can see this immediately.

I may have explained this already but the end of charge can be detected in several ways.

1) A cell goes over Abs max V in which case the charger relay is cut and a (Cell > Abs Max V) Alarm recorded.

2) The charger terminates independently anyway and pack voltage then falls away triggering a (Voltage Drop) Alarm.

3) Each cell now has a FB (Full Bit) this is set when a cell reaches the balancing voltage. When every cell has reached the balancing voltage for that charge cycle and the bit has been set for each and every cell then the charge is terminated and a (Charge End OK) Alarm recorded.

Any Alarms during a charging cycle kill the charging relay and force the charge control opto to max voltage reduction. All Alarms are now recorded in the EEprom for posterity. 8)
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.

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

Re: Old BMS Software Thread

Postby retepsnikrep » Sun Oct 03, 2010 10:16 am

OK

Here is the latest Master code for use with serial slaves only.

http://www.solarvan.co.uk/bms/PBP_SERIA ... 011010.txt
http://www.solarvan.co.uk/bms/PBP_SERIA ... 011010.hex

25% (2000 words) program space remaining for Greg's controller comms and any other goodies :D

This has the alarm logging to I2C eeprom code. 8)

It also stores the basic BMS data in the I2C EEprom so you don't have to reset the number of cells after you re-program the Master. From now on the numbers of cells, soc, odo, trip meter etc are all stored in the off pic eeprom. This preserves all the data between flashing so you don't lose your mileage and other stats/info if program is updated!

Youtube video showing Alarm logging to follow this afternoon. :shock: Uploading at present.

http://www.youtube.com/watch?v=erlo9eOFc2A
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.


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 46 guests