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 » Sun Oct 03, 2010 1:19 pm

retepsnikrep wrote: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.


Thinking about this problem and one solution is that you could combine the byte data from each cell into word data. So cell 1 is the low bit of word one and cell 2 is the high bit of word 1. Cell 3 is the low bit of word 2 and cell 4 is the high bit of word 2, etc. Transmit the word data to the spreadsheet and then calculate the raw cell data. So for example if cell one is 3.35 volts the bms raw data would be 160 (335-175) and if cell 2 was 2.80 volts the raw data value would be 105. Expressed as a hex value 160 = A0h and 105 = 69h. So you send A069h (which in decimal is 41,065). In theory you can combine 3 or 4 cells this way although that might not be as straight forward with the pic. I can work on the spreadsheet formula for this if you want to pursue it.

The other option is to not use PLX-DAQ. Instead capture the data using hyperterminal to save it to a file and open after in a spreadsheet. Of course you lose out on live data capture, but are only limited by the spreadsheets capabilities.
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 » Sun Oct 03, 2010 4:12 pm

Interesting ideas but i do like the live data chugging into excel!! Need to try and get round that first.
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 » Sun Oct 03, 2010 9:17 pm

Have a look at this,

http://www.live-graph.org/index.html

Looks like it might do what we need, and shouldn't have any limits on the amount of data. I haven't downloaded it yet (got to get the 1 second timing loop working first and don't want to get distracted) but it looks like you would use HyperTerminal to capture data from the usb port to a file. Then LiveGraph will read the file periodically and plot the values. The data format is plain ascii text, and since you have used Hyperterminal to save the file it can also be looked at later with Excel or any other spreadsheet. I have used HyperTerminal for capturing data from my controller and it is straight forward to use.

EDIT: Since the analogue temp sensors are gone, I ordered 4 of the DS18B20 sensors and while I was at it a couple 18F2580 to have a play with. These are recommended replacements for the 18F258 that Francisco suggested.
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 » Mon Oct 04, 2010 6:45 am

Interesting.

Live graph may be the way to go. Logging to terminal is a breeze or anything that can take the serial data.

I see the chips mentioned one has double the code space which is nice. If they are a pin for pin replacement for the 16F886 then that's great. The initial config will be the killer for the new chip one bit in the wrong place screws the whole thing. :shock: I'm rounding off the rough edges on the master v3 schematic. 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.

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

Re: Old BMS Software Thread

Postby GregsGarage » Mon Oct 04, 2010 8:52 pm

Peter, The 18F2580 should drop into the existing master. I am making some progress with the watchdog, bit of a steep learning curve but hope to have something by the end of the week. I have 2 of the 18F2580 pics coming, I can post one to you if you want to have a play.
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 » Tue Oct 05, 2010 9:16 pm

retepsnikrep wrote: The initial config will be the killer for the new chip one bit in the wrong place screws the whole thing. :shock:


I don't know if this is useful but have a look at this header wizard on the pbp forums. A link to the app is in the first post of this thread. Or to save time get it here.

http://www.picbasic.co.uk/forum/showthread.php?t=13663&pagenumber=
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:

watchdog software

Postby GregsGarage » Wed Oct 06, 2010 4:12 pm

I have cracked the 1 second pulse problem. :D Here is some working software that keeps Peters watchdog code working but uses the Instant Interupt routines by Darrel Taylor to provide a pulse on pin 7 of the watchdog that toggles once per second.

Watchdog_061010_V03.hex

I still need to do some work on it so just the hex file for now. One problem that I had was this section of Peters code;

Code: Select all

@ DEVICE PIC12F683,MCLR_OFF
@ DEVICE PIC12F683,BOD_OFF
@ DEVICE PIC12F683,PROTECT_OFF
@ DEVICE PIC12F683,WDT_ON


It was giving me complier errors, maybe because I had to use MPASM for the assembly portion instead of the MC compiler. In the end I have just commented it out for now, what this means is a special programming procedure, at least until I sort the problem. :?

Here's what to do. Using PICkit 2, connect the programmer and insert the 12F683. Make sure chip is recognized [Tools - Check Communication, if chip not recognized]. Import the hex file using the File menu. Now before you program it, to the right of Device: PIC12F683 you will see "Configuration: 3FFC". Change that to 3CDC by clicking on "Configuration". That will open a window, click the configuration bits in the BitEdit section so you get "1100 1101 1100". Save and now you should have 3CDC on the screen. Now load the program.

Pin 7 should toggle and watchdog functions remain the same. Please report any problems, I will post a revised version with source code once I tidy the code up a bit and figure out the configuration settings. Peter, you where right, figuring out the config bits takes a bit to get your head around (pun not intended or very good :twisted: ).

So now that I have a working output on pin 7, I am not sure we should use it! :shock: Since Peter has freed some memory space I may try the routine in the master code and see if it works without breaking anything.
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 » Wed Oct 06, 2010 7:47 pm

Many hand make light work and all that. I think your config/compiler/assembler error issues are common. Have a search on the pbpro site I think it is a simple fix. Good luck wh the master code :shock:
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 » Wed Oct 06, 2010 8:25 pm

retepsnikrep wrote:I think your config/compiler/assembler error issues are common. Have a search on the pbpro site I think it is a simple fix.

My hunch was right, if you use MPASM the method for setting the configuration bits is different. Found this. 8) I am starting to think the best way to set these is to manually set them using PICkit 2 and when you find the configuration that works, write it down and put it into the code using the instructions above.
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:

Watchdog V04

Postby GregsGarage » Fri Oct 08, 2010 10:27 pm

New watchdog code. :D

http://www.go-ev.co.uk/projects/bms/Watchdog_081010_V04.txt
http://www.go-ev.co.uk/projects/bms/Watchdog_081010_V04.hex

This code now has the configuration bits set in the hex file. 8)

The MPASM uses the command __config where as the PM compiler uses the DEVICE command. Where I was having problems is you can only use one __config command and pbp defines a default __config setting in its include file for the 12F683 ( and I assume all other chips as well). So if you are going to compile from the source code you need to comment out the __config line in your pbp 12F683.INC file. I have explained all of this in the comments in the code. Of course you can just program the pic with the hex file above and not worry about any of this.

Although I have programmed the chip, I can't test it until Tuesday. Let me know if there are any problems, but it should work as the actual program is still the same, only the config settings have been changed.

I am going to see if I can get this to work directly in the master next. :shock:
Greg Fordyce

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


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 23 guests