E-Bike Conversion – Software


It’s been a while since I wrote the posts about my electric bicycle conversion project. The bicycle runs fine so far and I finally finished rewriting the software that configures its controller.

I will not make a long post for this so you won’t get bored. Basically I took the original software which also included all required source files and made it look better, fixed many bugs, improved its operation and added a small help file. Now you don’t need administrative rights under windows 8 and 10 to be able to see the available COM ports. The interface looks more tidy and well aligned and also uses better English. Numerous bugs were fixed, regarding error messages and error checking, communication, parameter limits and so on. I found this program as an open source (including all source files) I am providing it the same way.

Be advised! Doing any changes to your controller might lead to damage. I won’t be held responsible for any kind of damage you might induce to your controller, motor, gears, bicycle or yourself. Do what you like at your own risk! Cycle safe and take care for others on the road!

You can download the program HERE.

Link was updated and now uses different sharing service. Dropbox account deleted. Apparently they decided to block my sharing abilities for no apparent reason and without any warning. I can’t accept such terrible attitude towards their users and left them. Apologies to anyone who was trying to download the file. I hope it works now.

Latest version uploaded on 16.05.2017 with a few updates. Assist level labels now say Assist, not Assit 😀 The current limit is not active when bike is not connected. This allows you to work with your saved profiles even if you haven’t connected your bike.

Compatibility with BBS##B drives has been confirmed by many users now. Luckily for all, Bafang hasn’t changed the communication protocol.

240 thoughts on “E-Bike Conversion – Software

  1. Hi Stefan, Thank you for sharing this very useful software.
    Why the StartCurrent% in pedal assist tab can not be set to a value greater than 20% ? My bbs02 came with a greater value.

    1. Thank you for the comment. I will check if there is any mistake there, but all limits were there in the original tool. Might be my mistake. Too high current wouldn’t be very good for the plastic gear inside though. This will be impulse load to it which will wear it out faster.

  2. Nice tool, but seems to have a problem with the BBSHD:

    Bug report: Somehow on my BBSHD, the basic settings do not save correctly. When I save and the read back the just saved values, the values for PAS 7, 8 and 9 get corrupted and instead of saving “external, wheel meter”, it saves “by motor phase” and speed meter signals go from 1 to 24 or something.

    1. I don’t have access to BBSHD so I can’t test the software with one. I’ve been told by other users that is works fine. I can’t say that for sure though. I don’t have the time to debug it with that controller using user feedback. I am sorry.

  3. I found the problem. Apparently %Current values need to be divisible by 2. Having any odd numbers here causes weird side issues.

    1. OK, that sounds strange. I used both even and odd numbers all around my setting and didn’t have any issues. Have you tried the original tool that I based mine on? It is supposed to work the same way besides the fact there are no limits set there so it returns an error when you try to set a value over the limit in the firmware of your controller.
      It is also possible that Bafang are using different tool for BBSHD because of new firmware.
      I am really sorry, but I can’t help much with BBSHD. I own BBS02 and it is very difficult to debug such issues without having the controller in question to test with.

    2. Yes, same issue with the original tool. Once I switch all settings to numbers divisible by 2, it works. I can give you my exact settings. BTW: The serial logic level going to the motor – do you know if it is 12V or 5V?

    3. I had also issue’s with the original tool. Now i read this i think i know why , i also used odd numbers

  4. Hi Stefan
    Thanks for your brilliant posts on the whole project, your inspiration has just cost me a fortune for a BBS02, a battery pack and a bike to put them on !
    My conversion took all day last Saturday, like you I had a major problem removing the old bottom bracket.
    I already have a Giant La Free e bike I use for commuting to work but find it in need of a couple more gears to slow my cadence when cruising, (and a bit more power for the hills).
    I have been waiting for a Higo cable to arrive from Germany so I can make a programming lead.
    It arrived today and I have re-set the max current down from 25 to 18 amps effectively making it a 500 watt motor, the bike still goes like the wind and the motor doesn’t even get warm !
    Also nice job with the software, and thanks for the help file it makes programming much clearer.
    I agree with your reasoning for selecting the Bafang mid motor, I also would add that the motor setup must be configurable by me !

    1. Thank you for the kind words about my project! It was an interesting experience for me. I know this controller has some limitations, but it is still a lot cheaper than a factory made bike and has some extra features like throttle and more speed and power.
      In July I tried Cannondale 29″ MTB with Bosch motor for a day in Rome, Italy. It was only 250W and limited to 25km/h according to the law. It had great torque, because of the very small chain ring at the front. Since that was 29″ pedaling was possible up to about 30-35km/h (motor stops above 25). I really liled the torque sensor in the motor. It makes pedaling very natural unlike the BBS02. Two things I didn’t like and those are the 25km/h limit and the lack of throttle. I’ve used throttle one when I had to carry some big box with my bike and couldn’t use the pedals. If that wasn’t available I would have to walk and push the bike.

  5. Is this tool useful for other BAFANG controllers, like the ones that control 36V 350W Geared BAFANG Hub Motors

    1. I don’t know. The original tool didn’t say anything about that. It might be compatibe, but it might not be. If you try it is at your own risk. Even reading data from the controller is actually sending a command to ask for that data so it might mess-up with your controller.

    2. I don’t think it does work with those motors. There are torque sensor settings for them. There is another program for those, but I haven’t found the source code. Also I don’t have such controller to use for finding out how it works.

    3. It also worked with my hub motor! I have a Bafang FM G320.250R with a torque sensor! Thanks for the software

    4. have you tired it I have a issue with a torque bb with the same 36v 350w geared bafang hub motor and luck ? wanted to see if I can change the settings on the bb sensor

    5. I can’t try it because I don’t have such motor. There is different version of the Bafang program for the torque sensor motors, but I couldn’t get it to work with my BBS02.

  6. Hello and thank you for this great piece of software!!!!! I have a question/problem:
    I just finished mounting a 8fun 750W on my mountain bike. everything if great and power is plenty BUT i have this problem: if I start riding especially with a high ( hard) gear and a high level of assistance ( example 5, 6 or more) the motor starts to give power in an intermittent way and then after two or three full laps of chainring stabilizes and goes fine. But it’s really bad to start from zero and having the bike jumping like that. I try to explain better:the phenomenon only show up when i start pedaling but When the pas is lower levels the “intermittent start of the motor” ( that is the real problem) is less present especially if i start pedalling with a light gear ( example rear cassette at 32teeth). INSTEAD if i start pedaling with a hard to push gear ( example cassette at 11teeth) and especially with more power requested to assist ( higher levels of pas) is more evident. For example if i have to start the bike in a climb and i didn’t previously lowered the gear, so I’m in hard to push pedals ( 11teeth)….to start the bike i start pedaling and the motor start to assist me intermittently untill i don’t reach a minimum speed.
    EVERYTHING works fine once the bike is launched and started….it ONLY happens when i start pedaling on hard gear.
    in this video you can see the phenomenon described even if already started pedaling ( you see in video as vibrations due to not smooth power from motor). http://youtu.be/chcjvybu5cY
    Do you think that is normal or that i can edit parameters like “Slow start mode” to solve this?
    THANXXXXXXXXXXXX so much!!!!

    1. Sorry for the late answer. Your message went into spam for some reason.
      I can’t clearly see in the video what is going on with the motor. What I think is that your power ramp-up setting is too low, meaning the current increases too fast. It is possible that actually it reaches the maximum current and stops for short amount of time to prevent overload and damage. You can try to increase the ramp-up time in settings (with the software). Try also to avoid this motor start situation as you have one plastic gear in the motor and loads that high are wearing it off faster. Starting to pedal from a full stop should be on a lighter gear and not on a high PAS setting. This way you will get smooth start. I am still trying to find the best settings on my bike, but I haven’t had such issues as I like to have the smooth start. The problem is that there is no torque sensor like Bosch for example. That’s how their electric bikes have such nice and smooth feeling, almost like there is no motor at all and you just have more power in your legs.

    2. Great! Thanks I will follow your suggestion!!! Also… You man are a genius with software …why don’t you work on a way to upgrade the dcp14 color monitor so it can work fully with 52v batteries? And maybe also have data from BMS?

  7. ps: by “power ramp” do you mean the “start current %” on pedal assist menu? or what? 🙂

  8. Hi,
    I am waiting for my BBS01 to arrive, does your software work with the newest controllers ( B versions ) ?



    1. Hi Alex,
      I don’t know if it works with the new versions. I don’t have one to test it with. You can try it when you get yours. If the software detects the controller type without problems, then you should be able to use it, but I can’t say if all parameters would be programmed to the controller in the same way so be careful and save the initial state of all settings before you start experimenting.

  9. Hi, I would like to reprogramm my BBS02 and I’m looking for a cable for it, if possible in Europe, I have read the post from Mark Robson that he could order one in Germany, could you tell me (or Mark) where to find one please, thanks.

  10. Hi, thanks for the infos, I don’t have the skills to play with only a cable, I will buy a complete one.

  11. Hi!

    Thank you for posting this. A software engineer friend of mine and I are interested in using this app on a Mac computer running macOS. May we contact you with specific questions? Example: what’s the best way to commuicate to the Bafang motor using macOS?

    1. I don’t use Mac so I can’t help. If you just want to use it on Mac, I would suggest that you use virtual Windows machine. If you want to make a Mac version of the program then I am not able to help. The zip file has the full soirce code, so you will have to use that.

  12. Thanks so much for this Penoff. I am shopping for a used PC as my loaner just died. I see a cheap PC with Windows 7. Will Windows 7 work with your software?……..wayne

  13. How can I maximize the program window? The text in the window is too big to see all info.

    1. You can’t. Text in the window should look like on my screenshots. If it is too big, the reason for that is probably in your OS settings. If you are using scaling different than 100%, it can lead to fonts too large to fit the window. Even if I enable window resizing this won’t move GUI elements around to provide more space.

  14. I tried the windows scaling options, I went from 125% to 100%, but this doesn’t change the font size in the program… I use parallels, so maybe that’s the problem, I will contact them and post my results. Thanks for your fast answer!

    1. You can’t directly post a screenshot in here. You can upload it somewhere with public access and post the link here.

    2. Using a large font for system font might be an issue as my program uses system fonts.

  15. My fonts have normal sizes, most of them around 13. Is it possible to edit the font size of your program in the registry? if so, where can I find this in the registry?

    1. Did you ever find a solution? I have the same problem on native windows.

    2. This is a Widnows scaling issue. My program uses standard font, but not a system font and has fixed size. When you scale Windows interface, the buttons and indicators change size, but the font and window size stay the same. I didn’t design it for scaling. There is no registry setting of any kind for my program. I have tested this program on a few different computers running Windows 7 and Windows 10 and it looks just fine. I have one small laptop that I connect to my TV and there is scaling involved. I have try and see how it looks on this one.

    3. I have the same problem on two different laptop. Found a solution yet? Nice program but almost useless for those with this issue unfortenately.

    4. My program does not use registry keys except for listing COM ports. The font size is fixed. The problem is Windows scaling, which doesn’t care if a program is capable of handling it or not. The program was not designed with scaling in mind. On some systems it works fine with scaling, but on others the font scales and there is no space to show larger text.

  16. Hello Stefan, I have been using your software and I love it. Could you please increase the low voltage protection cutoff pulldown menu to 44 volts? I am using a 52V battery on my bbshd and i am trying to keep it from over discharging. It would be a great way to help protect a very expensive battery. Thanks for your great work!

    1. Hi John, this is not only software limit, but also firmware. If I remove the limit from the software, you will get error returned from your bicycle. Mine is set at the middle of the range at 41V (or 3.15V per cell). This setting is for protecting the battery only. It is not supposed to take action often. It’s use is mainly to protect the battery during heavy load. Then you have high voltage drop in the cells. If you don’t wont to discharge your battery too much, just charge it earlier. I recharge mine as soon as the battery level indicator on the LCD starts to drop below maximum. Works well for me.

  17. Hi Penoff,

    I connected my bbhsd with the cable from lunacycle. I open your program and read the flash I change some values and then write the flash everything tells me that it worked but when I plug my screen back in the changes didn’t apply. I can read the flash and it has the changes but they don’t work.

    1. That sounds really strange. If you see the changes you made after you read again, it should work. I have no idea what might be causing this. What settings don’t have effect after you change them?

  18. I found the problem i can not change the number of p-assists with flashing i was looking at that as my indicator but the rest of the settings worked.

    1. You want what? If you are looking for an Android version, there is non. Also if you want to use Android device you will need some hardware to get it connected to the bicycle. 🙂

  19. Hello Stefan, First of all, Thx for the great tool!
    I have a bbs02 48V@500W, I would like to set it to 750W (I know the risk…)
    My MaxCurent value is 18A.
    So I cannot give bigger Limited Current than 18A.
    When I try, I got an error message.

    I checked the source code and I found this:

    speBasCurrLim.MaxValue := data_in[17]; // limit control

    I’m not a programmer, but I guess you set the max of the Limited Current to what you read as MaxCurrent from the controller here.

    Is there any way to change the MaxCurrent or remove this limitation and enable to set the Limited Current to 25A somehow?


    1. Hello!
      You understood exactly how the code works. There is a reason for that and I might edit my article to include this so I don’t get asked countless times, no offense.
      I tried this without the software limit in place. I could set the value to 255 (that’s the maximum number for one byte). My controller is 750W 25A. I set the limit to 26A and tried to write this to my BBS02 controller. The firmware in the controller returned an error and it doesn’t accept that value. So that is why I put the limit there. I have provided version of my tool without that limit to one or two enthusiasts who wanted to try on BBSHD and BBS02 and they got the same results. Setting the value higher than the nominal is not possible.

Leave a Reply to Taikan Tanaka Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.