Old BMS General Thread

Threads relating to the BMS system begun by Peter Perkins

Moderators: GregsGarage, retepsnikrep

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

Postby retepsnikrep » Wed Oct 08, 2008 7:58 pm

Roger Crier wrote:Would it not make sense to use a led set to show if you are accelerating, staying at a steady state, or decelerating. Perhaps this would be done by comparing the present reading with the previous one and checking by how much it has changed so that the rate of change can be calculated. this could be added below the Autospeed readout etc and then you would just need to get every led readout showing green!


Roger even to do what you suggest requires the initial accuracy from the system so it can work out if one of the three things is happening. Matt is working on some calcs to see if we can improve on mph accuracy now we have a more accurate VSS pulse length rather than number reading. You can implement the led 's if you like, I'll put the more accurate reading if we get one on the screen :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.

mattcarr
Posts: 389
Joined: Sat May 12, 2007 2:27 pm
Location: Hampshire

Postby mattcarr » Wed Oct 08, 2008 9:22 pm

Just to let you know that I am rambling away to myself to try and work this one out and I am coming up wth some interesting figures - so watch this space.

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

Speed Sensor Calculations

Postby retepsnikrep » Thu Oct 09, 2008 2:04 am

OK I'm stuck with the new VSS thingy.

By timing the length of the pulses for the VSS sensor I get a 16 bit number returned, which is equal to the length of the pulse.

At 120mph this number is 659
At 60mph this number is 1318
At 30mph this number is 2636
At 15mph this number is 5272
At 7.5mph this number is 10544
At 3.75mph this number is 21088
At 1.875mph this number is 42176

and finally

At 1mph this number is 64669 (Below this we won't be going!)

If the speed < X (pulse length exceeds 65335) then 0 is returned by the Pulsin command.

The number itself is just a unit of time it doesn't really matter what the unit is, as it has a linear relationship with the speed. It halves as the speed doubles. So the question is how can I get the speed in mph from the number using only 16 bit integer maths? It strikes me we have quite a lot of resolution so I'm hoping for an accurate result :wink:

I know Matt is working on it but anyone else any ideas?
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.

mattcarr
Posts: 389
Joined: Sat May 12, 2007 2:27 pm
Location: Hampshire

Postby mattcarr » Thu Oct 09, 2008 9:04 am

Right with these figures lets try some maths.
We will have 2 contstants to use. We know that at 1.875 mph the VSS length is 42176
So we know that I can do ( 1.875 / mph ) * 42176 to give me a new VSS lengh
So i need to reverse this to use a pulsin reading to give a mph reading.

mph = ( 42176 / pulsin reading ) * 1.875

I have done a simple excel sheet and it gives a nice mph figure.

I hope this helps you Peter.

User avatar
Jeremy
Posts: 472
Joined: Thu Jul 31, 2008 6:35 pm
Location: Salisbury

Postby Jeremy » Thu Oct 09, 2008 11:58 am

I think you'll need to be a bit more cunning to get it to work with integer only operations and still retain max resolution.

As it's a 16 bit number the max the register will hold is 65535 (2^16 - 1). 65535 equates to 0.9868 mph. Using this conversion ratio will retain maximum resolution.

The base formula is therefore:

mph = 65535 / pulsin) *0.9868

To do it with integer math and get four significant digits means multiplying pulsin by 10000 and using 9868 as factor, giving the following formula:

mph = (65535 / (pulsin * 10000)) * 9868

The above assumes that the PICAxe will handle integers as large as 655350000 internally - it may not! Three significant digits may be enough anyway, so you could use 1000 as the multiplier and 987 as the factor.

The other thing you need to do is trap the rollover error as you go below 0.9868 mph. This is pretty easy, just add a conditional check (IF.... THEN) for a suitably low number (say 1mph) and force a value of zero for the speed variable. The speedo wouldn't read speeds of less than 1mph but this shouldn't be an issue.

Jeremy

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

Calcs

Postby retepsnikrep » Thu Oct 09, 2008 12:30 pm

Keep going gents we are getting there.

Jeremey, Picaxe is max 16bits 65535 for any result/part of calculation. I can't scale it up as you suggest. Even using windows calculator and decimals I couldn't get your formulae to produce mph which matched my readings from the VSS pulse length? Am I missing something?

Matt can you make yours work with Integer only 16 bit maths. It seems to work using the calculator and decimals :)

Edit

Added a 125A fuse to the middle of each battery block in case of incidents!! :shock: The Insight has a 100A main semiconductor fuse in the system anyway but these two have ben added for crash protection.

Just another quick video showing BMS screen in a bit more detail.

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

Wilfried
Posts: 34
Joined: Sun Mar 16, 2008 2:19 pm

Re: Speed Sensor Calculations

Postby Wilfried » Thu Oct 09, 2008 4:25 pm

retepsnikrep wrote:but anyone else any ideas?


Program your table in a SEEPROM (Serial Electrically Erasable Programmable ROM) and connect it to you PICAxe with only 2 lines.
16 adress -> 8 data AT24C512B from Atmel
Datasheet: http://www.atmel.com/dyn/resources/prod ... oc5297.pdf

Wilfried

User avatar
Jeremy
Posts: 472
Joined: Thu Jul 31, 2008 6:35 pm
Location: Salisbury

Postby Jeremy » Thu Oct 09, 2008 5:09 pm

That internal integer limit of 65535 presents a challenge!

It looks as if 1mph doesn't actually equal 64669, as that causes the error in my other post. The true value for 1mph should be over the limit for the pulsein command.

If 42176 = 1.875mph, then 1mph = 42176 x 1.875 = 79080

Using this corrected figure, the maximum pulsein value of 65535 = 1.2067mph

I'll give it some more thought and see if I can come up with a way around this.

Does the PICaxe support shifting to allow the remainder of an integer division to be accessed?

Jeremy
Last edited by Jeremy on Thu Oct 09, 2008 5:17 pm, edited 1 time in total.

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

Re: Speed Sensor Calculations

Postby retepsnikrep » Thu Oct 09, 2008 5:17 pm

Wilfried wrote:
retepsnikrep wrote:but anyone else any ideas?


Program your table in a SEEPROM (Serial Electrically Erasable Programmable ROM) and connect it to you PICAxe with only 2 lines.
16 adress -> 8 data AT24C512B from Atmel
Datasheet: http://www.atmel.com/dyn/resources/prod ... oc5297.pdf

Wilfried


That looks interesting I'll think about that for MK2 thanks.
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:

Postby retepsnikrep » Thu Oct 09, 2008 5:20 pm

Jeremy wrote:That internal integer limit of 65535 presents a challenge!

It looks as if 1mph doesn't actually equal 64669, as that causes the error in my other post. The true value for 1mph should be over the limit for the pulsein command.

If 42176 = 1.875mph, then 1mph = 42176 x 1.875 = 79080

Using this corrected figure, the maximum pulsein value of 65535 = 1.2067mph

I'll give it some more thought and see if I can come up with a way around this.

Does the PICaxe support shifting to allow the remainder of an integer division to be accessed?

Jeremy


Well it can do Modulo divison as well to return the remainder.

This thread also give an Insight into the problems with divison on the Picaxe.

http://www.picaxeforum.co.uk/showthread ... ht=decimal

Sorry for the error in my table which caused a bit of confusion, many heads are better than one!! 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.


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 5 guests