Old BMS Hardware Thread

Threads relating to the BMS system begun by Peter Perkins

Moderators: GregsGarage, retepsnikrep

jackbauer
Posts: 19
Joined: Wed Jan 26, 2011 8:38 pm
Location: Ireland
Contact:

Re: Old BMS Hardware Thread

Postby jackbauer » Tue Feb 08, 2011 7:26 pm

Peter , on the pin diagram at the start of the master code RA6 and RA7 are reversed. Pin 9 is RA7 and Pin 10 is RA6.

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

Re: Old BMS Hardware Thread

Postby GregsGarage » Tue Feb 08, 2011 7:47 pm

retepsnikrep wrote:Looking at the 16F886 chip pinouts I discovered that Pin RA6 & RA7 are not logically placed and are reversed!! :shock:


Never had that problem with the picaxe :lol: :lol:

Glad you found it, lets hope it works.
Greg Fordyce

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

jackbauer
Posts: 19
Joined: Wed Jan 26, 2011 8:38 pm
Location: Ireland
Contact:

Re: Old BMS Hardware Thread

Postby jackbauer » Tue Feb 08, 2011 8:02 pm

Right now its running on the bench with 4 cells. The "M" in mph flashes when not charging and i have a counter incrementing at 1 sec intervals in the top right of the screen. My i2c temp sensors dont seem to want to work anymore even with the correct id! One potential problem is if the 1 sec pulse stops pulsing the program waits forever in a loop.

jackbauer
Posts: 19
Joined: Wed Jan 26, 2011 8:38 pm
Location: Ireland
Contact:

Re: Old BMS Hardware Thread

Postby jackbauer » Tue Feb 08, 2011 8:31 pm

Ok temp sensors up and running. I was a muppet :shock:

One thing that has never work for me is the odometer. The trip counter works fine :?

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

Re: Old BMS Hardware Thread

Postby retepsnikrep » Wed Feb 09, 2011 3:24 am

jackbauer wrote:Peter , on the pin diagram at the start of the master code RA6 and RA7 are reversed. Pin 9 is RA7 and Pin 10 is RA6.


That's where i went wrong. :roll:

I'll post my updated code once i have tested it this morning.

Re the odometer remember the pulses on this pin have to appear within the time allowed by the pulsin command and the define at the begining of the code.

Code: Select all

DEFINE PULSEIN_MAX 20000   'Set PULSIN maximum count to 20,000 (100ms) (Range 0-65535 x 5us units)


If you don't get two edges within the time then it will miss the pulse.

The max pulse length can be lengthened but remember this eats into the main loop.

It works on my setup which gives approx 4000 pulses per minute at 60mph or aboput 67hz
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 Hardware Thread

Postby retepsnikrep » Wed Feb 09, 2011 4:09 am

jackbauer wrote:Right now its running on the bench with 4 cells. The "M" in mph flashes when not charging and i have a counter incrementing at 1 sec intervals in the top right of the screen. My i2c temp sensors dont seem to want to work anymore even with the correct id! One potential problem is if the 1 sec pulse stops pulsing the program waits forever in a loop.


The flashing M is caused by an extra space i put in by mistake. (Corrected in this mornings version)

I added a display of the passing seconds on the top line so i could ensure something was happening during this testing. This can be removed in the final version if we want. Or we could have a flashing character like a (*) or Something else from the extended ascii tables.

As you will see the charge active indicator (1 or 0) has also been moved from the bottom line to be on the same display line as the SOC. I moved this because when in charge mode the master does not service the CheckSpeed part of the program so although the charge bit was changing in the background it's status on the screen was not updated. :roll:

The new code also has an escape in the master and does not wait forever for the watchdog pulse. It triggers it's own alarm if no pulse for a few seconds.

Code: Select all

   If Alarms = 9 Then          '(Watchdog chip 1S pulse missing)
   DEBUG "Watchdog Pulse"         'Video Display
   endif


I have also improved the current calculation routine with some help from the picbasic pro forum. It's now a much simpler and more accurate calculation. Certainly for my own 100A sensor any way.

Old

Code: Select all

'   if BatCurrent < Offset then      'If BatCurrent is < Offset means system is Discharging
'   BatCurrent = ((Offset - BatCurrent) * 2) / 10    'Subtract offset to get a positive number (0-512 = 0-100A+) Max 99
'   AmpSign = 45            'Set ascii Character 45 (-) to be displayed if Discharging
'   goto ExitCurrent
'   endif
   
'   if BatCurrent > Offset then       'If BatCurrent is > Offset means system is Charging
'   BatCurrent = ((BatCurrent - Offset) * 2) / 10    'Subtract offset to get a positive number (0-512 = 0-100A-) Max 99
'   AmpSign = 43            'Set ascii Character 43 (+) to be displayed if charging
'   goto ExitCurrent
'   endif


New

Code: Select all

BatCurrent = (BatCurrent * 64) / 326  'New current (Amps) calculation for 100A sensor 090211
   
    If BatCurrent < 100 then    'Means system is Discharging
    AmpSign = 45            'Set ascii Character 45 (-) to be displayed if Discharging
    BatCurrent = 100 - BatCurrent
    else                        'Means system is Charging
   AmpSign = 43            'Set ascii Character 43 (+) to be displayed if charging
   BatCurrent = BatCurrent - 100
   endif


I'm sure that can also be tweaked for different current sensors, just ensure any values in the calculation do not exceed 65535 at any time. Potentially this means I should be able to get to within 200ma or so :wink:
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 Hardware Thread

Postby retepsnikrep » Wed Feb 09, 2011 7:00 am

See software thread for new working 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 Hardware Thread

Postby GregsGarage » Sat Mar 05, 2011 9:55 pm

One step closer today. Got the controller connected to the battery pack and the wheels go round as they should. :D :D

Next step is to get all the bms boards mounted and wired together. I am using almost the same Allegro sensor Peter is using (mine is the 50 amp version) and was going to knock up a pcb to mount it, with some nice anderson pcb connectors for the power leads. Note, I am going to only measure charger and DC-DC current with this sensor as the controller already measures motor current. This place will supply 10 off, max 5cm square, pcbs for $12! :shock: So unless I am reinventing the wheel here, I will fire up Kicad and give them a go.
Greg Fordyce

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

User avatar
hohisilver
Posts: 114
Joined: Mon Jan 24, 2011 10:17 pm
Location: Wells, Somerset

Re: Old BMS Hardware Thread

Postby hohisilver » Sat Mar 05, 2011 10:31 pm

I'm planning to use the same current sensor as Peter, so I'll definitely be interested in a PCB if you're looking for takers! ;)

The only thing that confuses me is where in the circuit I connect it - I've always understood you need to go in series to measure current, but those contacts look a bit flimsy for the currents we're dealing with?
Ian.

A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....

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

Re: Old BMS Hardware Thread

Postby GregsGarage » Sat Mar 05, 2011 11:36 pm

The allegro current sensors are only good for a max current of 200 amps. This suits Peter's Insight projects and for me I will connect it so that no motor current passes through it, just the small loads on the pack.
Greg Fordyce

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


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 20 guests