BBS-FW: Open Source Firmware for BBSHD/BBS02 Controller

ebuilder said:
Daniel,
First let me say thank you for not only your considerable talent but your philanthropic gesture of offering this to the community here. Quite magnanimous and we owe you a debt of gratitude.

Will start with...I own two BBSHD bikes I built with stock controllers. My favorite Bafang motor.

*** Note to readers: For those wanting to donate, you can find where to donate and Paypal accepted...on Daniel's download page...I just found it.


Questions that come to mind please:

1. How can we discern which model stock controller we have within our BBSHD motors? Is the serial number stamped somewhere on the casing of the motor...or a subset of the BBSHD serial no. that corresponds to which controller type?

2. Do you have any plans to market an aftermarket controller with greater voltage and amp capability like a ASI BAC controller? Reason why I ask this important question is because I believe there to be considerable demand for a 'middle ground' cost effective controller between the expensive ASI BAC controller which allows much greater amp and voltage than what the stock BBSHD controller can tolerate due to MOSFET limitation. Maybe something in the $200-300 range.
If you were to develop a controller...ideally fit inside the BBSHD but not essential like the ASI BAC which is outside for size and facilitate cooling...I believe this would be a great business opportunity for you and a watershed for the BBSHD faithful that just love this motor. Field weakening, like the ASI BAC offers, is the black magic to getting 4K watts out of a BBSHD due to higher spindle RPM, which btw the BBSHD can take and best with temp monitoring you have included with the stock controller and kudos for that btw.

3. Alternatively to no. 2 and perhaps you have considered...could a lay consumer like myself, with your development, take a 'stock off the shelf 50a controller' and install your firmware and interface it with the BBSHD?...understanding it would be a matter of decoding the hall sensing wires which I presume would not be difficult....phase wires are a simple plug and play....speed sensor etc.

In summary, a man of your considerable capability has many options to bring to market an alternative controller to the stock controller which is limited in size, cooling, amperage and voltage. Running 72v and 50 amps through a BBSHD like some do with an aftermarket controller really amplifies the performance of the BBSHD.

Thank you very much for your big offering to the community.

Thank you for your kind words, I will try to address your questions. The development was largely driven of my own desire to have more control over my bike, and for fun, as it presented a bit of a challenge since a rarely work with hardware.

1.
It has been printed on the controller casing on all controllers I have seen.
Right above the serial number.

It will say e.g.
CRR10E1000.S.N.U 1.4 where "1.4" is the revision.

I do not currently know if there exists any revisions lower than 1.4 in the wild.

2.
Although it is an interesting idea and would present a fun challenge I do not currently have any plans for doing that. And since that is exactly what Luna has done with the Ludicrous V2 VESC based controller for BBSHD it does not make much sense.

I'm pretty sure the stock controller can be made to work with higher voltage and current without too much trouble. It's a matter of replacing a few components to accept a higher voltage and current can be increased by a shunt mod (or new software, maybe).

There is a second microcontroller on this board which actually runs the motor control. This firmware does not replace the firmware on that controller yet. But it is possible since I have succeeded in writing software and flashing the secondary controller too. That opens up for the possibility to implement FOC & field weakening on the stock bbshd controller.

I run my BBSHD shunt modded for 45A which it plenty of power and gives no issues with heat as far as I can tell, but I guess I'm not running full power for long periods either.

3.
No, it is not possible. This firmware does not even implement the code for turning the motor since that is the responsibility of a second microcontroller in the BBSHD controller.

Supporting other controller means doing the same work I did for BBSHD, reverse engineering the specific PCB, tracing all signals and possibly supporting a different microcontroller architecture.

This is the reason BBS02 is not supported yet, and I'm seeking donations to buy a BBS02 controller for reverse engineering work. If anyone has a few broken BBS02 controllers and want to help out, consider shipping them to me as they would also be useful for the work.

Would be interesting to mod a stock controller to run 72V 50A and see how it performs in comparison to an external controller.
 
silenec said:
This is great :thumb:

One stock feature I really like is configurable "Keep Current" (%).

What this setting does when set at 60% is ramp the current down to 60% of the PAS level selected based on pedal cadence rpm, so at low pedal cadence you get 100% of the level selected but as your pedal cadence increases the power is reduced down to 60%. As you pedal faster the motor does less work down to whatever this number is set to (60% of max current or 15 amps on 25 Amp system)."
This way you need to change PAS levels less often (hill / lower cadence = more power without pressing any buttons). So convenient that I don't even feel a need for a torque sensor.

Is something like this implemented in BBSHD-FW?

Also do we know how many different controller HW revisions are there for BBSHD and BBS02?

My BBS02 from 2017 says:
Manufacturer: HZXT
Model: SZZ9
Hardware Ver.: V1.1
Firmware Ver.: V2.0.1.1

BBS02 support would be great because the throttle on some revisions does not work together with PAS (and there is no firmware with a fix available like there is for BBSHD) and they overheat easier (is there any way to show motor temperature on C961/C965 displays? maybe it could be sent to the display instead of current speed temporarily with some key combination or while parked / when real speed is 0km/h?) Just an idea.

Lower voltage cutoff would also be perfect for my 12S li-ion battery. Good luck with the development, I am sure many BBSXX owners will be grateful :)


Interesting, I didn't even know that feature existed, but I have never used PAS really. It is not supported in this firmware currently but sound like a quite simple thing to do, feel free to open an issue on the github page and I will consider it if there is more interest for this.

Motor temperature in speed field was a god idea! I will add an option to show motor temperature in speed field while push walk is activate in next version.
 
Still following this closely, I've been doing some night riding and not being able to see my motor temp at night cause I'm using an aquarium display without backlighting is annoying. It would be nice if it was on the display like you have done by putting it in the range spot (which also has anyone actually found the range estimate to be useful, mine never give a useful estimate). Has anyone else tried this firmware out yet? I'm still happy with the current firmware I have now so other than the temp reading I'm not looking to jump the ship but If some other users can report their finding with the firmware I would switch. Would even send over a donation to help with bbs02 users as the hassle and cost of upgrading to a backlite display would be saved.

Just to confirm this would work with my 860c display? And just cause I'm curious any future plans for the m620 motor?
 
I probably missed this but asking: is there a way to backup our current BBSHD firmware before updating to this great new project? I've got my BBSHD running nicely now, but I'm always curious about 'newer / better' :). Thanks
 
Bengy22 said:
Still following this closely, I've been doing some night riding and not being able to see my motor temp at night cause I'm using an aquarium display without backlighting is annoying. It would be nice if it was on the display like you have done by putting it in the range spot (which also has anyone actually found the range estimate to be useful, mine never give a useful estimate). Has anyone else tried this firmware out yet? I'm still happy with the current firmware I have now so other than the temp reading I'm not looking to jump the ship but If some other users can report their finding with the firmware I would switch. Would even send over a donation to help with bbs02 users as the hassle and cost of upgrading to a backlite display would be saved.

Just to confirm this would work with my 860c display? And just cause I'm curious any future plans for the m620 motor?

I haven't specifically tested that model but I'm fairly confident it will work with the 860c display. No plans for the m620 motor at the moment, it could certainly be done but I don't have access to the hardware and I won't buy one just for the sake of supporting it, it would have to be crowdsourced in that case, like the work on BBS02 which has now started. I would need an entire motor/bike for the m620 in order to support the torque sensor though.

fireflyer451 said:
I probably missed this but asking: is there a way to backup our current BBSHD firmware before updating to this great new project? I've got my BBSHD running nicely now, but I'm always curious about 'newer / better' :). Thanks

It's not possible to backup the firmware, it is read protected. You should backup your configuration using your preferred configuration tool for the standard firmware before switching. The original BBSHD firmware is easy to get hold on on the internet (and this forum, or contact me) if you want to restore.
 
Version 1.1.0 has been released which brings support for the BBS02 controller along with many other improvements.

v1.1.0
  • Support for BBS02 controller.
  • Single firmware binary for all supported BBSHD controller revisions.
  • Fix bug where an error was reported when trying to use firmware without throttle connected.
  • Support additional motor core temperature sensor available on BBSHD.
  • Add option to show current temperature in speed field on display while walk mode is active.
  • Support selecting which temperature sensors to use (for controllers with broken sensors).
  • Decrease motor power gradually when approaching max temperature (75C).
  • Decrease motor power gradually when approaching low voltage cutoff limit.
  • Improved shift sensor power interrupt.
  • Smoother power decrease when releasing throttle to avoid jerk from motor stopping abruptly.
  • Added forwarding for current sense resistor error code.
  • Implemented basic voltage based battery percentage calculation (not accurate).
 
Any plans to add support for torque sensing? Possibly by torque sensing crank arms and then via the throttle input?
I want that so bad!
 
This is super cool. I'm looking forward to installing this firmware. Question - how much compatibility does this have with the existing (closed-source and seemingly abandoned) Speeed application for Android devices? Speeed provides rudimentary display capabilities along with a configuration interface on Android, connecting with the BBSHD through the usual USB configuration cable that's connected to the phone via USB-OTG.

I would guess the display would continue to function (as any other display would) but the config tool is no-go, as the configuration tool used must correspond to the firmware - Bafang Config Tool/Speeed for Bafang firmware, BBS-FW Config Tool for BBS-FW firmware, right?

I'm thinking of a future where there's a mobile application that works with the BBS-FW firmware to provide real-time telemetry along with additional display and configuration options. No need to do tricks to display temperature in the speed field, for example, if we have control of both display and controller. Can create custom fields and custom behavior e.g. control operation mode (street / off-road), set cruise control parameters, etc. Or will we need to own the motor-controlling "second microcontroller" to do stuff like this? I'm not sure where the display communication code resides.

Also - congrats on 1.1! What an accomplishment; you should be proud. :)
 
Vbruun said:
Any plans to add support for torque sensing? Possibly by torque sensing crank arms and then via the throttle input?
I want that so bad!

I guess it could be done without to much hassle, but I have no such plans, those things are expensive! Not sure if any exist with a square crank arm fitting either? The ideá would be to plug a box between the display and motor to inject data or use the throttle input signal as you say.

caked said:
This is super cool. I'm looking forward to installing this firmware. Question - how much compatibility does this have with the existing (closed-source and seemingly abandoned) Speeed application for Android devices? Speeed provides rudimentary display capabilities along with a configuration interface on Android, connecting with the BBSHD through the usual USB configuration cable that's connected to the phone via USB-OTG.

I would guess the display would continue to function (as any other display would) but the config tool is no-go, as the configuration tool used must correspond to the firmware - Bafang Config Tool/Speeed for Bafang firmware, BBS-FW Config Tool for BBS-FW firmware, right?

I'm thinking of a future where there's a mobile application that works with the BBS-FW firmware to provide real-time telemetry along with additional display and configuration options. No need to do tricks to display temperature in the speed field, for example, if we have control of both display and controller. Can create custom fields and custom behavior e.g. control operation mode (street / off-road), set cruise control parameters, etc. Or will we need to own the motor-controlling "second microcontroller" to do stuff like this? I'm not sure where the display communication code resides.

Also - congrats on 1.1! What an accomplishment; you should be proud. :)

The original bafang configuration protocol is not supported at all so the Speed app will not work in its current form.
Yes, the standard display protocol is supported.

As you say, it would probably make more sense to write a new app or add support for this firmware in an existing app, then it would be possible to export much more data and add additional stuff, we are not limited by the secondary microcontroller as it's only task i BLDC control.
 
What is current limit for BBS02? 25ah as the original or more? Thx
 
danielnilsson9 said:
Max 33A on BBS02 too but I seriously advice against that! :flame:

So I get it. I probably wouldn't set it any higher even if I had better cooling done.
 
Thank you danielnilsson9 i flashed your  firmware and And everything works much better than the original firmware and I didn't change anything except increasing it to 32a, the PAS works flawlessly, like a different motor (bbshd)
 
Hello Daniel, I really want to thank you for taking the time to make this open source firmware possible. I got one question maybe you will be able to answer me.
I acquired a BBSHD motor (or at least it looks excatly like bbshd and not a bbs02) recently. Under the motor its stamped with this "MM G320 750W 09" and under the controller there is this stamp "CRR10E1000.S.N.U 1.5" and this "CRR10E4825E105003 .1"
The motor looks to me like it's a BBSHD that was limited to 25A with a firmware or something. I was planning to flash it using your firmware and see if it works. Do you have any idea about the motor.
 
So I thought I'd try this out but I'm having some issues.

After about 1-2km it starts jerking and cutting in and out rapidly like a bucking bronco. Since it works great until it gets hot I suspect the firmware is somehow cutting out the power based on the controller temperature? I have a 50A modded controller and a 60A BMS and never had any issues with the stock firmware. Set to 33A I should be pulling 55A from the battery which will get warm pretty quick.

I'm only using the PAS 0 with throttle settings 100% across the board; throttle, cadence, speed. I did try a couple PAS modes with "throttle +PAS" but it did the same.

I've never had an issue with the motor overheating using the stock firmware so I don't know how they behave when they do overheat. I always assumed it would throw an error code and shut down, giving it time to cool off. So I'm not 100% sure this is related to the temperature. I just suspect it must be since the cooler the motor is the longer it takes to start behaving like this.
 
samodop said:
Hello Daniel, I really want to thank you for taking the time to make this open source firmware possible. I got one question maybe you will be able to answer me.
I acquired a BBSHD motor (or at least it looks excatly like bbshd and not a bbs02) recently. Under the motor its stamped with this "MM G320 750W 09" and under the controller there is this stamp "CRR10E1000.S.N.U 1.5" and this "CRR10E4825E105003 .1"
The motor looks to me like it's a BBSHD that was limited to 25A with a firmware or something. I was planning to flash it using your firmware and see if it works. Do you have any idea about the motor.

It's a normal BBSHD; they shipped in both 750W and 1000W variants, but as far as I know, they are hardware-identical and the 750W version exists for compliance reasons. Pretty normal and all should work just fine with BBS-FW up to 33A.

My BBSHD is stamped "MM G320.1000 09" and was shipped from the factory with a firmware limit of 28A.

Hey Daniel, BBS-FW initially listed a 32A limit in the README file, but that was updated to 33A recently - can you describe what changed?
 
furcifer said:
So I thought I'd try this out but I'm having some issues.

After about 1-2km it starts jerking and cutting in and out rapidly like a bucking bronco. Since it works great until it gets hot I suspect the firmware is somehow cutting out the power based on the controller temperature? I have a 50A modded controller and a 60A BMS and never had any issues with the stock firmware. Set to 33A I should be pulling 55A from the battery which will get warm pretty quick.

I'm only using the PAS 0 with throttle settings 100% across the board; throttle, cadence, speed. I did try a couple PAS modes with "throttle +PAS" but it did the same.

I've never had an issue with the motor overheating using the stock firmware so I don't know how they behave when they do overheat. I always assumed it would throw an error code and shut down, giving it time to cool off. So I'm not 100% sure this is related to the temperature. I just suspect it must be since the cooler the motor is the longer it takes to start behaving like this.
Anything interesting in the event log visible in the BBS-FW Configuration Tool? See the last section on this page: https://github.com/danielnilsson9/bbs-fw/wiki/Configuration-Tool
 
Anything interesting in the event log visible in the BBS-FW Configuration Tool? See the last section on this page: https://github.com/danielnilsson9/bbs-fw/wiki/Configuration-Tool
[/quote]

*sigh I was so anxious to get it running again I didn't even think to check it before flashing it back.

It sucks because initially it worked great. I know several people with modded controllers that have flashed the firmware and not had any problems. I might try it again just to take a look at the log file.
 
Hi, I think I'll switch from Eggrider to a display compatible with this FW. Eggrider doesn't seem to support this FW. I am interested in the type of display that will be able to show temperature instead of range permanently on the display. At the moment I think only DPC-18 can do it, do you have any other type of display that would have the range indication and sport-normal mode switching? I would like the T1 Touch display but it doesn't seem to have the range function. Thanks
 
caked said:
samodop said:
Hello Daniel, I really want to thank you for taking the time to make this open source firmware possible. I got one question maybe you will be able to answer me.
I acquired a BBSHD motor (or at least it looks excatly like bbshd and not a bbs02) recently. Under the motor its stamped with this "MM G320 750W 09" and under the controller there is this stamp "CRR10E1000.S.N.U 1.5" and this "CRR10E4825E105003 .1"
The motor looks to me like it's a BBSHD that was limited to 25A with a firmware or something. I was planning to flash it using your firmware and see if it works. Do you have any idea about the motor.

It's a normal BBSHD; they shipped in both 750W and 1000W variants, but as far as I know, they are hardware-identical and the 750W version exists for compliance reasons. Pretty normal and all should work just fine with BBS-FW up to 33A.

My BBSHD is stamped "MM G320.1000 09" and was shipped from the factory with a firmware limit of 28A.

Hey Daniel, BBS-FW initially listed a 32A limit in the README file, but that was updated to 33A recently - can you describe what changed?

The truth is that the real limit is somewhere in-between 32 and 33A. I noticed that is was possible to configure 33A in the configuration tool so I changed the documentation to match, I don't remember the exact value.
 
furcifer said:
*sigh I was so anxious to get it running again I didn't even think to check it before flashing it back.

It sucks because initially it worked great. I know several people with modded controllers that have flashed the firmware and not had any problems. I might try it again just to take a look at the log file.

So this issue has been reported a few times now but I haven't got anyone to help me test it in order to solve it, it's not affecting any of my bikes. The main suspect is false speed sensor readings causing speed limiting which cause cause jerky behaviour. Does not explain you observation that it started when the motor gets hot though.

It could also be some issue with you temperature sensors as mentioned, if so you should be able to see if the readings from both sensors are normal in the event log. If not, disable the faulty sensor in the configuration tool and try again. If both temperature sensor readings seems normal, please try disabling the speed sensor in the configuration tool and try again.

If it is the speed sensor that is the problem I can send you a new build of master which has some changes to filter faulty speed sensor readings which might solve the issue.

If anyone else experience the same issue, please reach out, I need help with testing in order to solve this.
 
jtekken said:
Hi, I think I'll switch from Eggrider to a display compatible with this FW. Eggrider doesn't seem to support this FW. I am interested in the type of display that will be able to show temperature instead of range permanently on the display. At the moment I think only DPC-18 can do it, do you have any other type of display that would have the range indication and sport-normal mode switching? I would like the T1 Touch display but it doesn't seem to have the range function. Thanks

The "calories" field is also usable on the DPC-18, any value can be sent to this field, currently it is showing voltage reading x100 in this firmware. Not sure if it is present on any other display. I'm using SW102 which doesn't have any usable field, so that is why the show temperature on walk mode was added...

Eggrider support/integration might happen someday, but I want to to get this completely stable before pursuing that.
 
danielnilsson9 said:
So this issue has been reported a few times now but I haven't got anyone to help me test it in order to solve it, it's not affecting any of my bikes. The main suspect is false speed sensor readings causing speed limiting which cause cause jerky behaviour. Does not explain you observation that it started when the motor gets hot though.

It could also be some issue with you temperature sensors as mentioned, if so you should be able to see if the readings from both sensors are normal in the event log. If not, disable the faulty sensor in the configuration tool and try again. If both temperature sensor readings seems normal, please try disabling the speed sensor in the configuration tool and try again.

If it is the speed sensor that is the problem I can send you a new build of master which has some changes to filter faulty speed sensor readings which might solve the issue.

If anyone else experience the same issue, please reach out, I need help with testing in order to solve this.

Happy to help.

I wasn't sure if this was unique to my set-up or not. Now that I know I will reflash later today and gather more info.

I considered the speed sensor but I was having more problems at low speed. If anything it seemed to go away for longer at higher speed.

I tried to start in low gear and in high gear to see if it was an over current fault, but nothing seemed to change.

This led me to the temperature sensor. In particular, if the one in the controller is being used it's probably reading considerably higher than a stock controller. But I've never had this trip an overheating code in the past, after much, much longer rides in much warmer weather.

I'll try your suggestions and see what happens.


eta: it's now flashed. I'm going to try turning off the controller temp sensor first.
 
furcifer said:
Happy to help.

I wasn't sure if this was unique to my set-up or not. Now that I know I will reflash later today and gather more info.

I considered the speed sensor but I was having more problems at low speed. If anything it seemed to go away for longer at higher speed.

I tried to start in low gear and in high gear to see if it was an over current fault, but nothing seemed to change.

This led me to the temperature sensor. In particular, if the one in the controller is being used it's probably reading considerably higher than a stock controller. But I've never had this trip an overheating code in the past, after much, much longer rides in much warmer weather.

I'll try your suggestions and see what happens.

Perfect, thank you, please try 1.2.0 which has the speed sensor filtering. If you had more issues at low speed that could point towards the speed sensor since more false pulses could be incorrectly triggered if the magnet is e.g. on the distance limit of being detected.

I'm not sure of the behaviour on temperature limiting in the bafang original firmware. I never seen any error or felt any limiting either as far as I know.

This firmware will throw an over temperature error if any of the temperature sensors exceed 75C. When temperature reaches 71C a linear power ramp down to 20% of max current will start. So when you are at 75C only 20% of max power will be available.

I have tested this and was able to hit 73C (cold weather, 12C) if I really tried but never more due to the power ramp being applied. I have a shunt modded controller, with a ratio of 1.5, so 45A at 30A configured.
 
danielnilsson9 said:
furcifer said:
Happy to help.

I wasn't sure if this was unique to my set-up or not. Now that I know I will reflash later today and gather more info.

I considered the speed sensor but I was having more problems at low speed. If anything it seemed to go away for longer at higher speed.

I tried to start in low gear and in high gear to see if it was an over current fault, but nothing seemed to change.

This led me to the temperature sensor. In particular, if the one in the controller is being used it's probably reading considerably higher than a stock controller. But I've never had this trip an overheating code in the past, after much, much longer rides in much warmer weather.

I'll try your suggestions and see what happens.

Perfect, thank you, please try 1.2.0 which has the speed sensor filtering. If you had more issues at low speed that could point towards the speed sensor since more false pulses could be incorrectly triggered if the magnet is e.g. on the distance limit of being detected.

I'm not sure of the behaviour on temperature limiting in the bafang original firmware. I never seen any error or felt any limiting either as far as I know.

This firmware will throw an over temperature error if any of the temperature sensors exceed 75C. When temperature reaches 71C a linear power ramp down to 20% of max current will start. So when you are at 75C only 20% of max power will be available.

I have tested this and was able to hit 73C (cold weather, 12C) if I really tried but never more due to the power ramp being applied. I have a shunt modded controller, with a ratio of 1.5, so 45A at 30A configured.

lol, OK I'll DL that version and flash it.

Actually my magnet is probably on the distance limit. Due to clearance issues I have it mounted not face to face, but more edge to edge.
 
Back
Top