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

Thanks for the replies,

Yeah I get hit, it's better but I won't break anything if I don't.

Concerning the Firmware I must say it's amazing for the PAS ! I almost randomly set it but so much change it's much more smoother, very very good.

I noted some points. As maximum speed limit set in kmh is the same for normal and race mode it is impossible to cut the motor at 25kmh in the normal mode because of the gear I got higher and the motor don't cut right at 25kmh as it should be regarding any PAS level or any gear I am.
I'll try again to tame the motor for legal mode but I think It can be done easily by software update.

Also I programmed to start on PAS 3, I am on 750c display and it still start PAS 1, not important tho.

I let the motor at 28A because I think it's enought for me, I am tempted to try 33A but well I don't know yet.

To have 100% throttle power in any PAS is also a game changer, it's very nice on the use.

Again amazing work, it's so much better !
Maximum Speed I set for each standard PAS level is 25% (25 KPH if you have 100 KPH global limit set)... as soon as my display hits 15 MPH, I can feel it no longer assisting me, regardless of the PAS level or rear cog gear.

I cannot get assistance at higher than 15 MPH (25 KPH), unless I switch to Sport mode, which allows me full use of the BBSHD.

Also, it may not cut right at 25 KPH if there is no load? It may overspeed and then cut back? Are you riding the bike when you feel like it doesn't cut out at 25 KPH or just lifting the back wheel?

Edit: I also left my motor at 28A... then upped it to 30A... may try 33A soon.
 
Maximum Speed I set for each standard PAS level is 25% (25 KPH if you have 100 KPH global limit set)... as soon as my display hits 15 MPH, I can feel it no longer assisting me, regardless of the PAS level or rear cog gear.

I cannot get assistance at higher than 15 MPH (25 KPH), unless I switch to Sport mode, which allows me full use of the BBSHD.

Also, it may not cut right at 25 KPH if there is no load? It may overspeed and then cut back? Are you riding the bike when you feel like it doesn't cut out at 25 KPH or just lifting the back wheel?

Edit: I also left my motor at 28A... then upped it to 30A... may try 33A soon.
Thanks for your reply mate,

I tried on the road, weird, I'll try again to be sure soon because I did try one time and changed the setting after.

Today I had heat issue the motor stutter and watt droping, after a run on flat, I check and it was 85°C.

I already have Motor sensor only, controler is not activated, I touched my motor by hand and it was warm, on the original firmware I hit much higher temps, I know sometimes It was so hot that I cannot let my hand more than 1 second. I'll try the otherway and only let controler sensor. I hope it'ill be better I don't want to desactivate both as it's good to have a safety.
 
Last edited:
how many people are using sw102 display with this firmware? i was curious if all the functions work on that display
 
[Request] I know it's a long shot and have no clue if it's hardware limited or even possible through firmware.

But would it be possible to increase the output of the dedicated light output/wires some motors have?
I believe it's only about 500mA and when I have too many lights or lights that ask too much, it starts dimming/flickering.

I Also have a usb port on my display, which seems to have a pretty low output too. Again I have no clue if this is possible in anyway through firmware, that's why I ask here first, before making a request on GitHub.
 
[Request] I know it's a long shot and have no clue if it's hardware limited or even possible through firmware.

But would it be possible to increase the output of the dedicated light output/wires some motors have?
I believe it's only about 500mA and when I have too many lights or lights that ask too much, it starts dimming/flickering.

I Also have a usb port on my display, which seems to have a pretty low output too. Again I have no clue if this is possible in anyway through firmware, that's why I ask here first, before making a request on GitHub.
Greetings - I'm an end-user of the BBS-FW firmware. I'm pretty confident that the two issues you mentioned are electrical component/circuit design limitations, and are not alterable or improvable via the firmware.

One workaround is to use the light output to control a relay, that switches on & off a 6-volt regulated power source derived from the main battery power wires. I'm a little surprised the aftermarket hasn't provided a plug-n-play module that does just this (and provides a stronger USB port).
 
Greetings - I'm an end-user of the BBS-FW firmware. I'm pretty confident that the two issues you mentioned are electrical component/circuit design limitations, and are not alterable or improvable via the firmware.

One workaround is to use the light output to control a relay, that switches on & off a 6-volt regulated power source derived from the main battery power wires. I'm a little surprised the aftermarket hasn't provided a plug-n-play module that does just this (and provides a stronger USB port).
Thank you, I was expecting it wouldn't be possible anyway.

I know about the workaround, but at the moment I don't feel like rewiring everything etc. Maybe one day when I add a blinker set, horn and better headlight...
 
First of all, thanks to Daniel for taking the time to develop this project, being able to switch between street and sport mode without having to download settings is great. Donation sent!

Regarding features, how difficult would it be to limit throttle speed when not pedalling? Where I am (NSW, Australia), the laws regarding electric bikes are as follows:
An electrically power-assisted cycle has a maximum continued rated power of up to 500 watts. This power output must be:
  • progressively reduced as the bicycle’s speed increases beyond 6km/h
  • cut off when:
    • your bicycle reaches a speed of 25km/h
    • you stop pedalling and the speed exceeds 6km/h.
Had a quick look at the code, and I think the first thing I need to do is remove the global speed limit from my config (which I set to 25 for standard modes only), after I saw the comment "Throttle always overrides PAS if global speed limit is configured for throttle."

If I had a proper dev environment its the kind of thing I think I could fumble around and hard code a limit for testing (probably by adding an extra condition in apply_speed_limit when the throttle_percent > 0 and not pas_is_pedalling_forwards), but another setting similar to the global speed limit in the config tool would be useful. My bg is in industrial automation, never programmed in C# for Windows forms.

I've found limiting current to 50% (with a 52V battery) on my BBS02B is plenty for street mode, at least on flat terrain. With a 25km/h speed limit its hard to get the power output to stay above 500W for any length of time.
 
First of all, thanks to Daniel for taking the time to develop this project, being able to switch between street and sport mode without having to download settings is great. Donation sent!

Regarding features, how difficult would it be to limit throttle speed when not pedalling? Where I am (NSW, Australia), the laws regarding electric bikes are as follows:

Had a quick look at the code, and I think the first thing I need to do is remove the global speed limit from my config (which I set to 25 for standard modes only), after I saw the comment "Throttle always overrides PAS if global speed limit is configured for throttle."

If I had a proper dev environment its the kind of thing I think I could fumble around and hard code a limit for testing (probably by adding an extra condition in apply_speed_limit when the throttle_percent > 0 and not pas_is_pedalling_forwards), but another setting similar to the global speed limit in the config tool would be useful. My bg is in industrial automation, never programmed in C# for Windows forms.

I've found limiting current to 50% (with a 52V battery) on my BBS02B is plenty for street mode, at least on flat terrain. With a 25km/h speed limit its hard to get the power output to stay above 500W for any length of time.
We have the same law in the UK regarding throttle use, it can only be used to get you going from a start up to 6km/h. Although the max output is capped at 250w :cry:

I just disabled the throttle on 'Standard Modes' with my max speed set at 25km/h and max current 25% (of my BBSHD 1000w), although it would be good to have the "legal" throttle as you have said. I may try and built it myself if I get some time.
 
We have the same law in the UK regarding throttle use, it can only be used to get you going from a start up to 6km/h. Although the max output is capped at 250w :cry:

I just disabled the throttle on 'Standard Modes' with my max speed set at 25km/h and max current 25% (of my BBSHD 1000w), although it would be good to have the "legal" throttle as you have said. I may try and built it myself if I get some time.
My interpretation of the 6km/h bit is that it is still ok to have throttle assist at higher speeds as long as you're pedalling. The whole "progressively reduced" wording may mean the power needs to be reduced as speed increases, but by the letter of the law it should be possible to use throttle to override/assist cadence up to 25 km/h. I'm not sure what the legal definition of pedalling is in my jurisdiction, but does violating the "spirit of the law" matter when following the "letter of the law". I'm sure a few tax dodgers minimisers would agree that just following the letter of the law is perfectly fine :)

We're lucky the power limit was increased earlier this year, before that it was 250W continuous as the laws were based on European ones.

In sport mode I've found 5 assist levels to be enough (at least in my initial tests), and have set 6-9 for cruise mode testing. I haven't used it much, but the configured max speed for the level becomes the cruise speed setpoint? I initially thought it would attempt to maintain the speed at cruise control initiation (similar to setting a car's cruise control). Then you could use the assist + and - buttons to trim the cruise speed (though not sure if this would even be possible without modifying the display's firmware. Does the display read the assist level back from the controller or just set a value?).
 
but the configured max speed for the level becomes the cruise speed setpoint?
Yeah that is correct, I have PAS 0 in Sport mode set to use cruise control at 20 mph, it works great.
I have PAS 0 in Normal Mode set to 'Variable' peddle assist, so technically my throttle is doing the "override/assist cadence up to 25 km/h."

My display only has 5 levels of PAS (non configurable), hence why I'm using PAS 0 - but it works pretty well, throttle does nothing in both modes unless pedalling too, and pedalling without throttle doesn't give any assist either. So it still acts as zero assistance mode too, unless you know how to activate cruise control or use variable PAS.
 
So I got my hands on a "cheap" infrared thermometer to test my motor temps, results:

Ambient temp, (a lot lower than before) <20c

Display temp 47c
Motor case temp 36c

Display temp 52c
Motor-case temp 36.5c

Display temp 51c
Motor-case temp 38c

Display temp 60c
Motor-case temp 44.4c

Display temp 72.8c
Motor-case temp 45c

Full Power 33a 52v uphill, in less than 1 minute it reaches "overheating" motor power cuts and gives error 11, temps:

Display temp 84c
Motor-case temp 47c


I'm pretty confident that this means I have the new sensor and I can push temps higher without any issues.
Guess I will have to change the configuration to read only from the controller sensor.
Still got a bunch of heatsinks in the mail, which I will attach anyway.

@Bengy22 if you have the time to look at my temps, I would appriciate that, but I'm pretty sure this is the new sensor you talked about?
 
So I got my hands on a "cheap" infrared thermometer to test my motor temps, results:

Ambient temp, (a lot lower than before) <20c

Display temp 47c
Motor case temp 36c

Display temp 52c
Motor-case temp 36.5c

Display temp 51c
Motor-case temp 38c

Display temp 60c
Motor-case temp 44.4c

Display temp 72.8c
Motor-case temp 45c

Full Power 33a 52v uphill, in less than 1 minute it reaches "overheating" motor power cuts and gives error 11, temps:

Display temp 84c
Motor-case temp 47c


I'm pretty confident that this means I have the new sensor and I can push temps higher without any issues.
Guess I will have to change the configuration to read only from the controller sensor.
Still got a bunch of heatsinks in the mail, which I will attach anyway.

@Bengy22 if you have the time to look at my temps, I would appriciate that, but I'm pretty sure this is the new sensor you talked about?
So I would agree you likely have the newer sensor due to the huge discrepancy of displayed temps vs case exterior temps. Your look pretty close to mine, case temp do seem to be slightly higher but I do run heatsinks and thermal pasted stator so that's expected. You also are running about half the amps (but with a less efficient controller) so I bet it takes longer for your stator to heat up, giving more time for the case to pull some heat away and heat up as well. I'm not sure I would set it to read only, I would personally recommend experimenting with just raising that limit slowly and continuously checking that exterior temp to see where that gets you at multiple points during the ride. I have theorized that once the case gets heat soaked the temp difference will get smaller, so if you train your mind to associate say 100c dash to 50c case you might find your case temps to be way higher than that at the end of a ride. 55C external case temps should be where you give the motor some rest, 60C is where I wouldn't push it past (and this seems to be widely agreed on online) unless you get a peek gear upgrade. Honestly if you want a more permanent solution like I did for external temps get a fish tank thermometer, replace the end with a small 10k ntc and glue that to the stator housing exterior out of the wind and place the lcd up by the bars where you can see it during a ride. Cheap easy and instant thermal reading on the exterior case 1695140750290.png
 
Thanks for your reply mate,

I tried on the road, weird, I'll try again to be sure soon because I did try one time and changed the setting after.

Today I had heat issue the motor stutter and watt droping, after a run on flat, I check and it was 85°C.

I already have Motor sensor only, controler is not activated, I touched my motor by hand and it was warm, on the original firmware I hit much higher temps, I know sometimes It was so hot that I cannot let my hand more than 1 second. I'll try the otherway and only let controler sensor. I hope it'ill be better I don't want to desactivate both as it's good to have a safety.
I had stutter after upping the amps and fixed it by changing the throttle levels - throttle start of 1200mv, Throttle End 4200mv and throttle % start of 3%. I probably only needed to change 1 of these values but this worked
 
Last edited:
So I would agree you likely have the newer sensor due to the huge discrepancy of displayed temps vs case exterior temps. Your look pretty close to mine, case temp do seem to be slightly higher but I do run heatsinks and thermal pasted stator so that's expected. You also are running about half the amps (but with a less efficient controller) so I bet it takes longer for your stator to heat up, giving more time for the case to pull some heat away and heat up as well. I'm not sure I would set it to read only, I would personally recommend experimenting with just raising that limit slowly and continuously checking that exterior temp to see where that gets you at multiple points during the ride. I have theorized that once the case gets heat soaked the temp difference will get smaller, so if you train your mind to associate say 100c dash to 50c case you might find your case temps to be way higher than that at the end of a ride. 55C external case temps should be where you give the motor some rest, 60C is where I wouldn't push it past (and this seems to be widely agreed on online) unless you get a peek gear upgrade. Honestly if you want a more permanent solution like I did for external temps get a fish tank thermometer, replace the end with a small 10k ntc and glue that to the stator housing exterior out of the wind and place the lcd up by the bars where you can see it during a ride. Cheap easy and instant thermal reading on the exterior case View attachment 339795
Thanks again!

I've got a big trip 1000+km coming up, so for now I'm just gonna set it to only read the controller temp, put some heatsinks on the motor and call it a day. For my touring trip I won't be pushing the motor anyway as I'm gonna need the mileage.

This bike is usually being used for deliveries and sometimes pushed to the max but not that often. The aquarium thermometer is a good idea indeed and I'll put one on in the future.
 
Has anybody configured the throttle as a "walk-mode"?

I've turned off walk-mode, because when I check the temperature during a ride, I don't want it to go in walk-mode. I barely use walk-mode anyway, but I have a big tour into the unknown coming up and I thought it might still be handy to have a walk-mode available. I thought about using 1 of the pas levels (pas 0) in my standard mode as I usually ride in sport mode which will be unaffected that way.

What would be the best way to configure the throttle for a walk-mode effect? Set max speed to something like 8 kmph, should I also lower the current?

Tldr: what is the best config for a throttle walk-mode?
 
Has anybody configured the throttle as a "walk-mode"?

I've turned off walk-mode, because when I check the temperature during a ride, I don't want it to go in walk-mode. I barely use walk-mode anyway, but I have a big tour into the unknown coming up and I thought it might still be handy to have a walk-mode available. I thought about using 1 of the pas levels (pas 0) in my standard mode as I usually ride in sport mode which will be unaffected that way.

What would be the best way to configure the throttle for a walk-mode effect? Set max speed to something like 8 kmph, should I also lower the current?

Tldr: what is the best config for a throttle walk-mode?
That's basically what the new 'Global Speed Limit' does. Apparently it's intended to remap the walk mode to the throttle :/
 
First post — lurked for years, have “tuned” our BBS02’s with guidance from forum posts but accepted throttle/pas lurching at low speed unavoidable without switching off the pas with hardwire. Magura two switch throttle tempting but ………..
Also had a controller go west — it randomly added power downright dangerously (wife’s bike so frustratingly so)—took complete swap of everything to deduce controller fault, new one fixed it.
After reading this thread I downloaded and flashed this firmware to the dicky controller and fitted it to my bike

UNBELIEVABLE SUCCESS !
Not only is the dangerous controller now fixed so now we have a perfect spare one.
But the throttle truly overides the pas, even at walking speed, no lurching whatsoever.
Anyone in any doubt —- JFDI
Donation coming soon, thanks heaps Dan, you just wonder why/how Bafang ever got it so wrong

I’ll flash her BBS02, my HD and then I have to do the Tongy, I’ve been testing the tzs2 in my old hardtail and like it a lot but add throttle and the thing hiccups and waits before proceeding. Halfway up a steep hill it is frightening so you stop trying.
I like running low level pas and just adding throttle for steep bits/crossing roads etc etc. Rarely go fast and use very little battery
If this firmware does same as it does to the Baf, the Tongy may be my choice for next dually, just being so much lighter gives it reason to live.Torque sensing fun too,
So question for Dan or anyone else with Tongy and this firmware
I have an SW102 display that I killed by unplugging hot. Possibly new firmwear will revive it ?
I have read how to flash these to suit Tong Shen wiring loom, if I can successfully do this, does that negate need to updating loom to run Bafang display?
If not I have a couple of other working displays so just need the cable mod trick to run with it
 
Last edited:
has anyone set their display to 5 PAS levels? i would like to do that but im not sure how i have to make it work with the program software
 
has anyone set their display to 5 PAS levels? i would like to do that but im not sure how i have to make it work with the program software
Mines is locked to 5 levels only... It will be either one of the following:

This seems to be the most common mapping:
Code:
PAS 0 -> PAS 0
PAS 1 -> PAS 1
PAS 2 -> PAS 3
PAS 3 -> PAS 5
PAS 4 -> PAS 7
PAS 5 -> PAS 9

Mines maps like this:
Code:
PAS 0 -> PAS 0
PAS 1 -> PAS 2
PAS 2 -> PAS 4
PAS 3 -> PAS 6
PAS 4 -> PAS 8
PAS 5 -> PAS 9

You will need to test for yourself, or if you say what display you have, someone else might already know.
 
Back
Top