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

I guess maybe it is possible. I didn't think the firmware communicated with the display.
 
hello, would this OSF work with this display?

https://www.pswpower.com/products/electric-bicycle-intelligent-dz40-display-ebike-screen-waterproof-e-bike-computer-for-bafang-bbs02b-bbs01b-bbshd-231
 
danielnilsson9 said:
I'm gonna have to investigate this further when I get a chance. Its weird some people reports that the thermal limiting is smmothly applied (like it is on my bike) other reports it as jerky.

There are two different types of temperature sensors used inside the BBSHD motor core and there are therefore two different code paths for reading them, maybe there is a bug somewhere.

Would be good to know which sensor you have. If you have a sensor of type PTC (PT1000) it is printed in the bootlog which can be extracted if you press "Connect" in the ConfigTool before you power on your controller, then it will automatically connect and you get boot messages in the event log.

I will have to re-flash and record the log. I had switched back to the updated factory firmware for reliability. I will post up when I do. Thanks
 
Since this is an open source firmware alternative the possibilities for future improvements are endless, if you have any suggestions, just let me know.

@Daniel, Can I make a small suggestion here? I've noticed that the fw doesn't seem to check for a positive throttle input at power up and the bike will try to exit through the nearest wall if throttle is greater than zero at switch on... :shock:

I think many fw's do this check at switch on and default to an error message if throttle >0. It's a good safety feature and would protect against a stuck or faulty throttle or maybe a too low 'throttle min' setting? As I say, just a suggestion, maybe one for a future new fw release.

Also to let you know that I have now flashed your fw on another BBS02 with the early (V1.1) hardware and it all went without any issue, so it would seem that my previous problem doing this was just a one-off glitch and not some compatibility issue with these early controllers.
 
I did at least 10 hardcore Alpine rides with BBSHD and Open firmware. I use PAS(99% time on 800W) and throttle (1 % on 1700W). It works reliable and fun. :bigthumb: Snow and mud --> more action :twisted:

I still miss feature "Throttle By display command" from stock FW or even improvement:

1. On Asssit tab add field "Max Cadence Throttle (%)". This improves "Throttle By display command" function. That way PAS Cadence can be set independently from Throttle cadence.

Any chance Daniel you add this?
 
geofft said:
Since this is an open source firmware alternative the possibilities for future improvements are endless, if you have any suggestions, just let me know.

@Daniel, Can I make a small suggestion here? I've noticed that the fw doesn't seem to check for a positive throttle input at power up and the bike will try to exit through the nearest wall if throttle is greater than zero at switch on... :shock:

I think many fw's do this check at switch on and default to an error message if throttle >0. It's a good safety feature and would protect against a stuck or faulty throttle or maybe a too low 'throttle min' setting? As I say, just a suggestion, maybe one for a future new fw release.

Also to let you know that I have now flashed your fw on another BBS02 with the early (V1.1) hardware and it all went without any issue, so it would seem that my previous problem doing this was just a one-off glitch and not some compatibility issue with these early controllers.

That should definitely already be implemented and has been there since 1.0, I just tested it and it seems to be working for me.
Throttle is required to give a signal below throttle minimum voltage before it will register as throttle input. So if you power on with throttle engaged it should not run away until you release it and then engage the throttle again.

There are error handling implemented for both low and high throttle limits. Please try again, maybe it's broken in some version, I'm running the version in development.

Thanks for letting be know, I will leave the BBS02 warnings up, is a good idea that anyone thinking about flashing this on BBS02 is aware of potential issues since it may not always be possible to revert, there are also other people who have issues with BBS02.
 
ginekolog said:
I did at least 10 hardcore Alpine rides with BBSHD and Open firmware. I use PAS(99% time on 800W) and throttle (1 % on 1700W). It works reliable and fun. :bigthumb: Snow and mud --> more action :twisted:

I still miss feature "Throttle By display command" from stock FW or even improvement:

1. On Asssit tab add field "Max Cadence Throttle (%)". This improves "Throttle By display command" function. That way PAS Cadence can be set independently from Throttle cadence.

Any chance Daniel you add this?

Please explain what you think "Throttle by display command" is doing. As far as I know it means using the current limit configured by the active assist level to also apply to throttle. In this firmware the current limit for throttle is configured separately from PAS current limit per assist level which is an improvement and covers all cases.

I.e. if you want to always allow 100% throttle current, set Max Throttle (%) for all assist levels to 100. If you want to emulate "Throttle by display command" in original firmware, set Target Power (%) equal to Max Throttle (%) for all assist levels.

See https://github.com/danielnilsson9/bbs-fw/wiki/Configuration-Tool#assist-levels


1. Could maybe be useful but very specific, feel free to open an issue on github, if there is enough interest from others I will consider it. You can always make the change yourself and try it out.
 
That should definitely already be implemented and has been there since 1.0, I just tested it and it seems to be working for me.
Throttle is required to give a signal below throttle minimum voltage before it will register as throttle input. So if you power on with throttle engaged it should not run away until you release it and then engage the throttle again.

....I must admit that I was surprised you hadn't included this safeguard, and clearly - you had.

I'm sure the bike was taking off with 'throttle min' set too low - I had the comical battle of desperately trying to get to the battery switch on a bike that was trying to disappear out of the garage.. :D

I obviously need to recheck this, I'll get back to you when I've done so.
 
geofft said:
Also to let you know that I have now flashed your fw on another BBS02 with the early (V1.1) hardware and it all went without any issue

danielnilsson9 said:
I will leave the BBS02 warnings up, is a good idea that anyone thinking about flashing this on BBS02 is aware of potential issues since it may not always be possible to revert, there are also other people who have issues with BBS02.
When you guys say "BBS02", do you mean BBS02A or BBS02B or both the BBS02 rev A and B?
 
silenec said:
geofft said:
Also to let you know that I have now flashed your fw on another BBS02 with the early (V1.1) hardware and it all went without any issue

danielnilsson9 said:
I will leave the BBS02 warnings up, is a good idea that anyone thinking about flashing this on BBS02 is aware of potential issues since it may not always be possible to revert, there are also other people who have issues with BBS02.
When you guys say "BBS02", do you mean BBS02A or BBS02B or both the BBS02 rev A and B?

Both the drives I refer to in this and previous messages are BBS02B's. For me one flashed ok, the other would not communicate with the display after flashing, but this may have been clumsy plugging/unplugging on my part.

Daniel is not yet convinced that all BBS02 controllers are compatible with his firmware, hence his comments in that message.
 
I'm sure the bike was taking off with 'throttle min' set too low - I had the comical battle of desperately trying to get to the battery switch on a bike that was trying to disappear out of the garage.. :D

I obviously need to recheck this, I'll get back to you when I've done so

@Daniel, I've just rechecked this and the power up throttle guard feature definitely seems to be non functional in the BBS02 fw.

As stated, if I power up with active throttle applied the bike immediately takes off.

It's not a big problem, but if you need me to try any further tests please just ask.
 
danielnilsson9 said:
ginekolog said:
I did at least 10 hardcore Alpine rides with BBSHD and Open firmware. I use PAS(99% time on 800W) and throttle (1 % on 1700W). It works reliable and fun. :bigthumb: Snow and mud --> more action :twisted:

I still miss feature "Throttle By display command" from stock FW or even improvement:

1. On Asssit tab add field "Max Cadence Throttle (%)". This improves "Throttle By display command" function. That way PAS Cadence can be set independently from Throttle cadence.

Any chance Daniel you add this?

Please explain what you think "Throttle by display command" is doing. As far as I know it means using the current limit configured by the active assist level to also apply to throttle. In this firmware the current limit for throttle is configured separately from PAS current limit per assist level which is an improvement and covers all cases.

I.e. if you want to always allow 100% throttle current, set Max Throttle (%) for all assist levels to 100. If you want to emulate "Throttle by display command" in original firmware, set Target Power (%) equal to Max Throttle (%) for all assist levels.

See https://github.com/danielnilsson9/bbs-fw/wiki/Configuration-Tool#assist-levels


1. Could maybe be useful but very specific, feel free to open an issue on github, if there is enough interest from others I will consider it. You can always make the change yourself and try it out.

Goal for me and other pas users is for example:
Pas level 5 has 50% max power and 55% max cadence(so motor does not spin faster than legs). In same level i want throtle to be unlimited -> cadence 100 and power 100. I cant set that on your fw as throttle has cadence of 55.
On stock i could set throttle to level 9 and it had 100 cadence 100 power.
 
danielnilsson9 said:
ginekolog said:
I did at least 10 hardcore Alpine rides with BBSHD and Open firmware. I use PAS(99% time on 800W) and throttle (1 % on 1700W). It works reliable and fun. :bigthumb: Snow and mud --> more action :twisted:

I still miss feature "Throttle By display command" from stock FW or even improvement:

1. On Asssit tab add field "Max Cadence Throttle (%)". This improves "Throttle By display command" function. That way PAS Cadence can be set independently from Throttle cadence.

Any chance Daniel you add this?

Please explain what you think "Throttle by display command" is doing. As far as I know it means using the current limit configured by the active assist level to also apply to throttle. In this firmware the current limit for throttle is configured separately from PAS current limit per assist level which is an improvement and covers all cases.

I.e. if you want to always allow 100% throttle current, set Max Throttle (%) for all assist levels to 100. If you want to emulate "Throttle by display command" in original firmware, set Target Power (%) equal to Max Throttle (%) for all assist levels.

See https://github.com/danielnilsson9/bbs-fw/wiki/Configuration-Tool#assist-levels


1. Could maybe be useful but very specific, feel free to open an issue on github, if there is enough interest from others I will consider it. You can always make the change yourself and try it out.

Goal for me and other pas users is for example:
Pas level 5 has 50% max power and 55% max cadence(so motor does not spin faster than legs). In same level i want throtle to be unlimited -> cadence 100 and power 100. I cant set that on your fw as throttle has cadence of 55.
On stock i could set throttle to level 9 and it had 100 cadence 100 power.
 
geofft said:
I'm sure the bike was taking off with 'throttle min' set too low - I had the comical battle of desperately trying to get to the battery switch on a bike that was trying to disappear out of the garage.. :D

I obviously need to recheck this, I'll get back to you when I've done so

@Daniel, I've just rechecked this and the power up throttle guard feature definitely seems to be non functional in the BBS02 fw.

As stated, if I power up with active throttle applied the bike immediately takes off.

It's not a big problem, but if you need me to try any further tests please just ask.

Alright, thanks for confirming. Must be broken then, I will make sure to have it fixed in next release.
 
ginekolog said:
Goal for me and other pas users is for example:
Pas level 5 has 50% max power and 55% max cadence(so motor does not spin faster than legs). In same level i want throtle to be unlimited -> cadence 100 and power 100. I cant set that on your fw as throttle has cadence of 55.
On stock i could set throttle to level 9 and it had 100 cadence 100 power.

That makes sense, now I see what you mean. I didn't realize the cadence (speed) setting was still used during throttle override even if throttle is set to "Current" mode in the original firmware.

But yeah, that is probably the common case, allowing 100'% cadence during throttle override. I would ideally not add another parameter to each assist level but I will fix it in some way.

Maybe allowing 100% cadence during throttle override if throttle current is set to 100% in PAS mode would be enough, it is probably what most people would want.
 
Good idea, this would fix it without new parameter:
Maybe allowing 100% cadence during throttle override if throttle current is set to 100% in PAS mode would be enough, it is probably what most people would want
 
Hello! I'm new here in the forum and this project feels interesting. I haven't flash this firmware yet. I wondering if there is a list of different config files for this firmware. Files that you have tested in Standard mode and Sport mode? (PAS&Throttle).

Could anyone post your Bafang settings you use for your openSource Firmware? Or upload a config files for the best settings you have on your BBSHD 1000 W mid drive motor. Just like we have the original fw el files (eg. BBSHD-52vLimitless.el).

bbs.fw tool kuva.PNG

Before flashing this openSource firmware I also need original FW (52 Voltage FW), if something goes wrong. I use google to finding it and find out that there is two kinds of download files (hex and bin files). Both files are good to go I assume, but if you have good advises where to download an original FW file (52 V FW), I'm more than happy for your help. What do you feel about of this FW View attachment bafang-flash (2).zip. I found it here https://goldenmotor.bike/download

My controller: my controller.PNG
 
I got a Frey AM 1000 from Circa 2017-2018.

How do I know which model it is and is the firmware ugpradeable?
 
Hi everyone,
Ì'm new on the forum and just discovered this fantastic thread and initiative. I've read out the source code yeterday evening and is very comprehensive. Amazing job.
Nevertheless, I've a stupid question : how figuring out the reference of the chip ? I own a BBS02 750W an very much interested in participating if my controller is compatible.

JB
 
When you run the STC programming software there's an option to 'Check MCU' which shows the chip type.

You'll find more details in the 'Flashing the firmware' Github page:-
Flashing the Firmware
 
Thank you, Daniel, for your work and successes with this firmware and I've sent some supporting love, now that PayPal is working again.

I'll confirm other comments that the shift sensor trigger doesn't seem to be working (in my use case, firmware version 1.2, via a BBS02B motor with a shift sensor on the dedicated port (not via a brake cable "Y" splitter)). I don't off hand know what the motor cut timing should be - I'll estimate 500 milliseconds or so.
 
Last edited:
Good evening. I'm new to all this. I bought myself a buzzraw fatbike with a BBSHD motor that uses a 52V battery. Now it's limited to 28A. I feel I can get more out of the motor.
I would like to install this firmware so I could use the 52v + 30A setting. But I don't really understand the proces of how to do this. I read trough this thread. Is there a manual or explanation on how to install this firmware.
I found the proces of golden motors for the 52v but I'm limited to 28A. So I would like to use that firmware from github. Could someone help me further?
 
Carefull with too much power, I have controller failure every year (52V, 30A, very steep climbs in alps). I will limit mine to 28A now.
I don't have climbs. Only 1 small bridge over a canal. So would be for torque on flats en top speed.
 
Hi mates. I'm owner of an BBS02B (750W, 48V battery 20ah/h Samsung cells, MCU IAP15F2K61S2). Bought on Amazon it came with original fw 1.7.5 (I think, not really sure so I actually didn't take note about this before flashing this custom FW).

Shift sensor is not working for me in 1.2.0 alike some other people, and investigating in Github link (GitHub - danielnilsson9/bbs-fw: Open source firmware for Bafang BBSHD/BBS02 electric bike motor controllers.), found out there are some new thinks/changes/fixes in the code in relation of the shift sensor (and other stuff).

I compiled the firmware in development for my BBS02B (1.3.0 is the version number which it's shown in the config tool now), and obviously also compiled the new config tool for 1.3.0.. and yep.. I took the risk and flashed it.

All works great just as the official build 1.2.0
, in 150KM nowadays 350KM i've only experienced just once a strange bug that gradually cut off motor power alike thermal throttling, so controller shown 40-42ºC (reached max of 58ºC without cuts, so it wasn't the issue), just restarted system and all went nice (thermal cutoff was 75ºC in 1.2.0 and earlier, now 85ºC!! -so it can be set editing the source code, there are a ºC variable- , more realistic for Spanish summers and even springs.. I'll test it well on august), there is a new section in config tool about shift sensor, so it's not working again for me.

One new and so useful feature is Variable PAS, a mode where the throttle only works if you are pedaling, perfect for making it "legal" in EU, where actually, the throttle shouldn't be illegal if you use it just for selecting the power that you need while you're spinning, as mode of real-time assist (there are some threads discussing about it, it's seen the European law doesn't forbidden throttles itself, and we hope in a future they change it's direction and allow free throttles and more wattages as some USA states; we aren't contaminating, making noise, or putting another ones in much more risk for having a 750-1500w motor and a throttle unless a 250w motor -pretty insufficient for a 100kg+ person plus the bike, I can confirm it personally-, there are hooligans riding legal bikes/motorbikes, and good citizens riding illegal ebikes. We don't need more liberticide laws, just education and common sense)


Watching the source code I found that shift sensor input is set on pin 6 (port 3). I'm thinking about the possibility of setting those variables (just trying with different combinations, so i don't know really which port is used, maybe i'll discover when I'd done the first maintenance, or when I finally adapt the motor to a oil-cooled system, which is just in my mind right now), compile and flash it again, this may be the fix for this question.. or maybe not (it seems the last commit was on Feb 1, the project appears to be.. abandoned?)

Some captures in the config tool, marked in red the new/changed options:

system tab 1.3.png

***Shift sensor is now present (yep, failed red mark), and more global options for pedal assist, so "no display" checkbox missed out (I supposed it's cause there aren't apps yet for this cfw)***

assist levels tab 1.3.png

***In mode 0 (standard, not off-road mode), I set Variable PAS With the max power I defined (50% of 25amps for normal, more likely a bored legal ebike max peaks), Now I can use throttle to choice in real time the power I need with more precision (in some circumstances this is SO BETTER than PAS without torque sensor), and more important, if a cop stops me and ask for the throttle, I can demonstrate it's only functional when I'm spinning, acting as a real time power mode but not as a true throttle, so definitively I'm not worried anymore about it, now i can sleep at night!!! (thanks a lot M.R Nillson)***


You can download my compiled FW for BBS02 and BBSHD (I can't test BBSHD cause haven't one, so it must work as it's little brother, I'm pretty sure), also the new config tool and my own config based on this version (based on Lectric Cycles E-Rad parameters AND SET IT FOR MY BBS02B WITH 48V BATTERY, if you have 52V/36V, you will need to configure different voltages, just search for the table), rename all files without .txt extension and flash/use as normally, and don't forget making backup of you current config -if you want- READING IT FROM THE CONTROLLER (NOT FILE) WITH THE NEW 1.3.0 TOOL!! DON'T USE 1.2.0, OR IT WILL FAIL WHEN READ 1.2.0 CONFIG FILE ON 1.3.0 TOOL!!!

Update: 1.3.0 OFFICIAL is up, download it from github


TO FINISH BUT NOT LESS IMPORTANT, DO IT BY YOUR OWN RISK (and if u're as mad as me or maybe a bit more), IT WORKED FOR ME BUT MAY BRICK OR DAMAGE YOUR MOTOR, OR MAYBE CAUSE A THERMONUCLEAR WAR IN AN EXTREME SCENARIO
 

Attachments

  • BBS02B_1.3.0_VIDRIAGO_PROFILE.xml.txt
    4.5 KB · Views: 26
Last edited:
Back
Top