Old BMS Software Thread

Threads relating to the BMS system begun by Peter Perkins

Moderators: GregsGarage, retepsnikrep

isaac_alaska1
Posts: 100
Joined: Sun Apr 03, 2011 7:41 pm

Re: Old BMS Software Thread

Postby isaac_alaska1 » Wed Dec 21, 2011 8:15 pm

Here is a video of it working, my apologies for no audio, it's still early morning here haha

http://www.youtube.com/watch?v=M8MJpwvhKfs

still need to get the resistor so i can go through it and get the serial number from the i2c temp sensor

isaac_alaska1
Posts: 100
Joined: Sun Apr 03, 2011 7:41 pm

Re: Old BMS Software Thread

Postby isaac_alaska1 » Wed Dec 21, 2011 9:30 pm

read the serial number and updated the software, but now the display shows that it is reading 85 degrees. i thought maybe it was somehow reading in farenheit instead of C, because it's about 83F in here. but i tried holding the sensor in my hand and it didn't change, so it seems to be getting a bad reading. do i need to comment out or change some of the code since i'm only using one sensor, instead of 2? i changed the constant from 2 to 1 in the master code where it says how many sensors are being used

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 Dec 22, 2011 8:20 am

The serial number occurs a couple of times in the code did you change it all?

Have you def got the right sensor there are a few variants around with slightly different part numbers that don't work.

I assume it is connected correctly.

I never tried it with one sensor so try it with two and see if that works.
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.

isaac_alaska1
Posts: 100
Joined: Sun Apr 03, 2011 7:41 pm

Re: Old BMS Software Thread

Postby isaac_alaska1 » Thu Dec 22, 2011 11:11 am

i definitely only changed it in one place, that's likely the problem. i'll look for the other places tomorrow if i have time. i think i have the right part number, but i'll double check and post it in here. and i have one more sensor (the company sent me two samples) so i can plug them both in and try it with two. and then i can measure the temp in the front of the box and in the back, or i could even measure temp of motor or controller :)
would have to change the temp alarms around some though i think....i'll think about that later haha.
heading home for christmas tomorrow afternoon, i probably won't get to anything till i'm back in a few days, but i will definitely keep you posted.
it's exciting that it's working :)

*edit*

the temp sensors that i have are "DS18B20+"

is this the right sensor?

isaac_alaska1
Posts: 100
Joined: Sun Apr 03, 2011 7:41 pm

Re: Old BMS Software Thread

Postby isaac_alaska1 » Thu Dec 29, 2011 1:18 am

temp sensors are working now!

i was a little confused with the BE and the 44 at the end of the lines but i figured them out without too much trouble, and then left myself a note in the software for next time (:

has anyone got a version that displays in Fahrenheit instead of Celcius? i was going to work on this next, and thinking it might be easiest to just leave it functionally in Celcius and then convert the number to F right before it is printed on the screen.

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 Dec 29, 2011 7:17 am

I never needed a farenheit version, feel free to add it.

Don't forget that the battery temp warning constant is in C

Code: Select all

MaxTemp      con 40      'Maximum permitted pack temperature = (40C) (Alarm & Shutdown point)


Suggest change it all to F is you want farenheit so change the alarm point as well.
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 » Thu Dec 29, 2011 9:09 am

Note found an error in the config of latest master :shock: the MCLR is disabled so a lockup of the master would not allow the watchdog to reset it via the MCLR pin. I had just copied the working pbp3 config from another 16F886 program which does not use the MCLR pin :roll:

Here is corrected version.

Code: Select all

#CONFIG
 __CONFIG _CONFIG1, _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_ON & _PWRTE_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT
 __CONFIG _CONFIG2, _WRT_OFF & _BOR21V
#ENDCONFIG


I'm going to release a new master version shortly with a few code optimisations.
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.

isaac_alaska1
Posts: 100
Joined: Sun Apr 03, 2011 7:41 pm

Re: Old BMS Software Thread

Postby isaac_alaska1 » Fri Dec 30, 2011 5:56 am

we made the temp work in F now, but i think we probably decreased the maximum working temp by a factor of 1.8, by keeping the resolution the same as it was. this should still be fine though, as the battery pack should never operate anywhere near the 125C (or 257F) that the sensor is capable of.

what we did was simply divide the value reported by the sensor by 10 and then multiply by 18, and then added a constant (which by trial and error turned out to be 379 i believe) until the temperature displayed matched the temperature that we measured. i'm sure there's a better way to do it, but i don't entirely understand how the temp sensor operates and this seems to get the job done. as mentioned before though, i'm guessing it will run into an overflow error at about 45C because of how we multiplied the reported value.

gonna look through here tonight and see if i can't figure out the right way to do it :)

isaac_alaska1
Posts: 100
Joined: Sun Apr 03, 2011 7:41 pm

Re: Old BMS Software Thread

Postby isaac_alaska1 » Sat Dec 31, 2011 7:24 am

set up the current sensor, it seems to be working quite well! using a little tiny melexis surface mount sensor (this one) that we took a few measurements on and changed the math around some, it should have a range of +/- 1500 amps (3000 amp range) with a resolution of about 1.5 amps. with a little bit of trimming of the PCB (or probably just milling a new one) we should be able to reduce the range (and hence increase the accuracy) to something a little more realistic. 1500 amps is possible with our set-up, but not likely, and certainly wouldn't last for very long through the 400 amp fuse :shock:

we are playing with setting up the speed sensor input but it seems that the VSS output on our machine is broken, so we are trying to get a new one. the repair manual says the speed sensor should supply a 12 volt peak pulse, and all we were able to measure was about a 500mV bump. hopefully the code will be all ready and waiting as soon as the new sensor comes in though :)

have i said "thank you peter" lately? cause i need to! this project that you've created amazes me more every day :D

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 Dec 31, 2011 5:42 pm

Interesting current sensor please post pics of the how you are mounting it.

Here is the code I use to convert C into F in another program

TempCon is loaded with Temp in C to start with, then use either line below depending on wether it is above/below freezing

TempCon = 32 - ((TempCon * 18) / 10) 'Convert Centigrade to Farenheit for temp < 32F

TempCon = ((TempCon * 18) / 10) + 32 'Convert Centigrade to Farenheit for temp >= 32F


The speed VSS code will need some work :wink:
You could use a fake pulse input for testing by using a logic generator or pwm output from a pic fed into the input.
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: Google [Bot] and 5 guests