• Howdy! we're looking for donations to finish custom knowledgebase software for this forum. Please see our Funding drive thread

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

danielnilsson9 said:
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.

OK, so I'm going to confirm this as the problem. The motor ran strong for about 1.8km, then I noticed a brief cutback in power. It did this a couple times and then started bucking.

I was able to check the temps and it was bouncing all over the place, from 40 to 79, 34 to 73. I presume if both sensors are used it is sampling back and forth? I don't know what the sampling frequency is but if it's about 500ms or so that might be why it's going on and off? The fact that it seems to get better when there is air blowing over the motor just makes sense to me.

I haven't pulled the log file yet to see which temp sensor is reading high. I'm going to do that and either turn one off. I'm hesitant to turn both off with it set to 33A*1.6667 = 55A.

eta: I suppose you have to leave it plugged in to retrieve the log file. I just turned off the controller sensor and I'm going to do the same ride to see what happens.

Alos, any idea why I can't get the Config tool to work on Windows 7? I keep getting a NET.runtime error, I need to update to 6.0.0 or some such, but no amount of updating worked. I was able to get it on my new computer running Windows 11 with some finagling.
 
furcifer said:
OK, so I'm going to confirm this as the problem. The motor ran strong for about 1.8km, then I noticed a brief cutback in power. It did this a couple times and then started bucking.

I was able to check the temps and it was bouncing all over the place, from 40 to 79, 34 to 73. I presume if both sensors are used it is sampling back and forth? I don't know what the sampling frequency is but if it's about 500ms or so that might be why it's going on and off? The fact that it seems to get better when there is air blowing over the motor just makes sense to me.

I haven't pulled the log file yet to see which temp sensor is reading high. I'm going to do that and either turn one off. I'm hesitant to turn both off with it set to 33A*1.6667 = 55A.

eta: I suppose you have to leave it plugged in to retrieve the log file. I just turned off the controller sensor and I'm going to do the same ride to see what happens.

Alos, any idea why I can't get the Config tool to work on Windows 7? I keep getting a NET.runtime error, I need to update to 6.0.0 or some such, but no amount of updating worked. I was able to get it on my new computer running Windows 11 with some finagling.

Interesting, thank you for testing! The log is live so you cannot pull it later unfortunately, this microcontroller is small and has a small amount of ram so no chance for that.

It is always sampling both sensors and then uses the highest value. The display is then pulling the max value from the controller at an interval defined by the display.

So you could try disabling the sensors one after another, first run with only the controller sensor and then with only the motor sensor and see which is at fault.

According to this link .NET6 should be supported in Windows 7. The update function might not work but you could maybe download and install .NET6 manually.
https://github.com/dotnet/core/issues/7556

Download .NET Desktop Runtime from here:
https://dotnet.microsoft.com/en-us/download/dotnet/6.0

You probably need x64
 
Test 2

I switched over to the controller temp sensor. No effect, it basically started bucking about 1.7km down the road. This time however I was able to throw an 11H code briefly.

So I'm 100% confident this is a temp sensor issue. I road back home in low gear, keeping it at about 35km/h, checking the temp it was steady at about 40C. Pushing up to 45km/h it held steady at 50C. No power cuts, no bucking, no issues.

I'm going to switch to the controller temp sensor. I think I pretty much confirmed when it's set to both it's sampling between them. When it was set to motor only it wasn't jumping around at all. Hopefully because it was showing lower before this will solve the problem.
 
danielnilsson9 said:
According to this link .NET6 should be supported in Windows 7. The update function might not work but you could maybe download and install .NET6 manually.
https://github.com/dotnet/core/issues/7556

Download .NET Desktop Runtime from here:
https://dotnet.microsoft.com/en-us/download/dotnet/6.0

You probably need x64

I did but instead of getting an error it wouldn't launch. It goes through the motions and the hd starts blinking but the window never opens.

lol it sucks, this is on my dedicated diagnostic computer. Usually programs love the older OS.
 
furcifer said:
Test 2

I switched over to the controller temp sensor. No effect, it basically started bucking about 1.7km down the road. This time however I was able to throw an 11H code briefly.

So I'm 100% confident this is a temp sensor issue. I road back home in low gear, keeping it at about 35km/h, checking the temp it was steady at about 40C. Pushing up to 45km/h it held steady at 50C. No power cuts, no bucking, no issues.

I'm going to switch to the controller temp sensor. I think I pretty much confirmed when it's set to both it's sampling between them. When it was set to motor only it wasn't jumping around at all. Hopefully because it was showing lower before this will solve the problem.

Sorry, this wasn't fully clear.

Is this correct?
It does not work when using both sensors.
It does not work when using controller sensor only.
It works when only using motor temperature sensor.
 
danielnilsson9 said:
Is this correct?
It does not work when using both sensors.
It does not work when using controller sensor only.
It works when only using motor temperature sensor.

ETA: Sorry, this wasn't correct. I got in to the Config Tool yesterday and apparently when I made the change I forgot to write them. I don't know how to strike text so I'm just going to edit the bad data.

Test 3

With only the controller sensor I did not have the same issue. The hottest I could get it was 50.9C and it worked flawless.

So with both sensors on it "bucks" and the temp switches back and forth. With the "motor" sensor on it also happens.

I am still testing the "controller" only setting. So far I am unable to recreate the problem. I would recommend anyone having similar issues running +50A try using the controller sensor only.

The stock firmware seems to fault at much higher values.

I'm curious if the 75C max was taken from the original code? Or did you base on the Bafang operating range of -20C - +50C over ambient, with the ambient assumed to be 20C (this would be standard engineering practice in fluid dynamics). There's no external sensor so I don't know how it could measure ambient.
 
I've installed the newest version of BBS-FW on my BBSHD successfully. It failed many times, until I tried another USB port.

- On my 500C display, 5 levels of PAS is active. On config tool, I only configured levels of 1, 3, 5, 7, and 9. I turned motor off for remaining levels. But this doesn't work at all when 5 levels of PAS is selected on display (none of the 5 levels has PAS/throttle). When I select 9 levels on display, it works on those levels.

The question is, am I doing something wrong; which levels correspond to "5 levels" in the config tool?

Less important observations:

- Battery voltage was more accurate (about only 0.1v off) right after I installed this firmware, but I calibrated it anyway.

- I (mistakenly) thought when I activated the walk mode, I would see the temp but the bike wouldn't move. I was wrong :) Anyway, the temperature was also accurate for that time (close to what my battery is).

I've donated before, thank you Daniel Nilsson for the great work.
 
After about riding for 40 minutes, I have a note on gear sensor (I see earlier you asked about it, too):

I feel like it is a bit harsh on my cassette. I have the stock 46T chainring. Normally I wouldn't hear a big click when I shifted to harder gear, but now I do, especially when the power level is about 200W. On riding PAS with about~80W, it's better.

I don't want to cause you to make it worse for other people, maybe it's just me but I'm not sure. I wouldn't like a long pause for sure. I also don't know if the shift "wait" was variable (relative to RPM?) or constant on stock firmware, but it was a bit better, if not great. The stock firmware was also harsh on gear changes on full power, which I don't use much.

Just curious: Is there something to slow the motor down faster (other than cutting power), something like reversing it for a few milisecond or so?
 
Amazing job man.

One question though . I've read your reply that the SPEED app no longer works . Does that mean It will no longer work as a display as well? I use it primarily as my main display as I broke my other displays due to water ingest.
 
furcifer said:
danielnilsson9 said:
Sorry, this wasn't fully clear.

Is this correct?
It does not work when using both sensors.
It does not work when using controller sensor only.
It works when only using motor temperature sensor.

Test 3

With only the controller sensor I had the same issue. It seems to want to keep the temp to 68.9C

So with both sensors on it "bucks" and the temp switches back and forth, With only one it does the same thing but the temp remains high.

There was no effect switching between sensors.

The stock firmware seems to fault at much higher values. Just my observations.

I was never able to interpret you response here, I do not understand what you are saying.
Do you think there is any error in the firmware or has one of your sensor malfunctioned?

If you think there is an error in the firmware, please write the result of every test you did in a structured way.
 
caleb7 said:
- On my 500C display, 5 levels of PAS is active. On config tool, I only configured levels of 1, 3, 5, 7, and 9. I turned motor off for remaining levels. But this doesn't work at all when 5 levels of PAS is selected on display (none of the 5 levels has PAS/throttle). When I select 9 levels on display, it works on those levels.

The question is, am I doing something wrong; which levels correspond to "5 levels" in the config tool?

Different levels are used on different displays I think for the 5 level PAS. On my display (SW102) it is 2,4,6,8,9 if I remember correctly. Sounds like it might be the same on yours ;)

caleb7 said:
- I (mistakenly) thought when I activated the walk mode, I would see the temp but the bike wouldn't move. I was wrong :) Anyway, the temperature was also accurate for that time (close to what my battery is).

Yes its active by default, you can disable "Walk Mode" in config tool to only have the temperature and not the motor spinning.

caleb7 said:
After about riding for 40 minutes, I have a note on gear sensor (I see earlier you asked about it, too):

I feel like it is a bit harsh on my cassette. I have the stock 46T chainring. Normally I wouldn't hear a big click when I shifted to harder gear, but now I do, especially when the power level is about 200W. On riding PAS with about~80W, it's better.

I don't want to cause you to make it worse for other people, maybe it's just me but I'm not sure. I wouldn't like a long pause for sure. I also don't know if the shift "wait" was variable (relative to RPM?) or constant on stock firmware, but it was a bit better, if not great. The stock firmware was also harsh on gear changes on full power, which I don't use much.

Just curious: Is there something to slow the motor down faster (other than cutting power), something like reversing it for a few milisecond or so?

I'm unable to test this myself since I don't don't have one, the current timing was suggested by another user. I might do some digging to see how the timing is in the original firmware and implement the same but it is not high on my todo list at the moment.

Motor control is not done by this firmware so no, there is nothing I can do to make it slow down faster.
 
jayteee said:
Amazing job man.

One question though . I've read your reply that the SPEED app no longer works . Does that mean It will no longer work as a display as well? I use it primarily as my main display as I broke my other displays due to water ingest.

Display should works as the display protocol is fully implemented, but you will not be able to apply any configuration through the SPEED app.
 
danielnilsson9 said:
I was never able to interpret you response here, I do not understand what you are saying.
Do you think there is any error in the firmware or has one of your sensor malfunctioned?

If you think there is an error in the firmware, please write the result of every test you did in a structured way.

lol, I was editing that post at the same time. Hopefully it makes more sense. Sorry.

Right now I suspect the motor sensor is faulty. It seems to read a much higher temperature. With the "controller only" sensor setting I'm not able to recreate the issue. (I'm trying but getting it up to temp means doing 60km/h for a bit and in the city it's hard)

To summarize, I don't think it's the firmware. I suspect that the motor sensor is faulty and I may be bouncing off the max temp. cutoff running at 55A. (assuming the max temp cutoff is the same across all firmware versions)
 
danielnilsson9 said:
jayteee said:
Amazing job man.

One question though . I've read your reply that the SPEED app no longer works . Does that mean It will no longer work as a display as well? I use it primarily as my main display as I broke my other displays due to water ingest.

Display should works as the display protocol is fully implemented, but you will not be able to apply any configuration through the SPEED app.

Thanks for the prompt reply , Does that include the power levels? AKA 1-9
 
furcifer said:
danielnilsson9 said:
I was never able to interpret you response here, I do not understand what you are saying.
Do you think there is any error in the firmware or has one of your sensor malfunctioned?

If you think there is an error in the firmware, please write the result of every test you did in a structured way.

lol, I was editing that post at the same time. Hopefully it makes more sense. Sorry.

Right now I suspect the motor sensor is faulty. It seems to read a much higher temperature. With the "controller only" sensor setting I'm not able to recreate the issue. (I'm trying but getting it up to temp means doing 60km/h for a bit and in the city it's hard)

To summarize, I don't think it's the firmware. I suspect that the motor sensor is faulty and I may be bouncing off the max temp. cutoff running at 55A. (assuming the max temp cutoff is the same across all firmware versions)

Thanks for confirming, yep definitely sounds like something is wrong there. I would not expect the temperature to jump so fast that you would feel the thermal limiting kicking in and out, so it must be large jumps. Motor core has a lot of thermal mass so the temperature should move slowly.

I will take a ride with motor sensor only someday to get some feel for how it should behave. Fyi, there are two different types of motor temperature sensors in circulation on the hall sensor boards, one is PTC and the other is NTC. Auto detection is implemented, if it is a PTC type on your board a message will be printed in the eventlog when connecting config tool if you take boot logs (click connect in config tool before you power on your controller). If you are planning to replace it you can solder a 10k NTC thermistor on the board, or a PT1000 if you want the PTC version.

But yes, in my experience, hitting the temperatures required for thermal limiting to kick in took quite some effort on flat ground, should be easier in warm weather climbing a long steep hill though.
 
jayteee said:
Thanks for the prompt reply , Does that include the power levels? AKA 1-9


You can switch power levels yes, everything you can do on a standard display should be able to do using the SPEED app, but you cannot set motor configuration parameters. So you can use the "Display" tab but nothing in the "Settings" tab, you will have to configure your assist levels through the provided config tool.

Doesn't look like the Speed app is open source, otherwise support for configuration could have been added quite easy...
 
danielnilsson9 said:
jayteee said:
Thanks for the prompt reply , Does that include the power levels? AKA 1-9


You can switch power levels yes, everything you can do on a standard display should be able to do using the SPEED app, but you cannot set motor configuration parameters. So you can use the "Display" tab but nothing in the "Settings" tab, you will have to configure your assist levels through the provided config tool.

Doesn't look like the Speed app is open source, otherwise support for configuration could have been added quite easy...

Roger that . Thanks ! Now am doing it now. For some reason the software is struggling to check my MCU.. It's just stuck at 'checking target MCU' even when i power off and on.. (Using the USB port straight from my motherboard resolved it.)
 
Just brought it out for a ride.

For the Speeed app users,
1. the temperature sensor in walk mode doesn't work as I don't think the app has a walk mode.
2. when you try to connect , it'll say its unable to connect and come up with an error and say it's disconnected , but it's connected.
3. Wattage and Speed is all over the place so don't bother.
4. It MAY freeze , you will be able to tell by the frozen numbers on the display. Just close the app and connect again.
5. Yes , power levels still work.

Anyway , I'm having some weird issues with the motor cutting out . Like it isn't smooth , sorta jutters. Happens when i go past 50% throttle. The motor engages and tones down and engages and tones down over and over till it reaches it's peak RPM . It doesn't do that when it's not on load. I've tried to mess with the settings but nothing is solving it .

I thought it might be the temp sensor cutting off the motor but it still does it when i've disabled it.
 

Attachments

  • bafangset.PNG
    bafangset.PNG
    25.5 KB · Views: 2,944
I see, it probably uses the connect message from the programming protocol. I will see if I can implement enough of it to get it to work better.

But might not have anything to do with your issue. Sounds like speed limiting is taking place which is one of the open issues I haven't been able to figure out and is only affecting some users.

Try disabling the Speed Sensor in the configuration tool to see if the issue disappears and report back.
 
jayteee said:
Anyway , I'm having some weird issues with the motor cutting out . Like it isn't smooth , sorta jutters. Happens when i go past 50% throttle. The motor engages and tones down and engages and tones down over and over till it reaches it's peak RPM . It doesn't do that when it's not on load. I've tried to mess with the settings but nothing is solving it .

I thought it might be the temp sensor cutting off the motor but it still does it when i've disabled it.

Yes that's basically what mine is doing. Not at first though, I've been getting about 1.5km before it starts. If I feather the throttle lightly it doesn't cut out as much and it tones down as it gets up to speed.

I switched to the controller sensor yesterday and it was better. Odd that it didn't work for you. Maybe it is related to the speed sensor?
 
Hello, I successfully flashed my BBSHD 1.5. I was able to read temperature in the walk mode. After a 10 mins ride it peaked at 28c.
I seem to be limited in terme of speed to about 40km/h. I set the setting to 100. My display is c961 and its set to 50km/h. My current is set to 30A, I have a 48V battery reading right now 48.3v. Anybody have any idea to why I'm not getting more than 40km/h ?
 
danielnilsson9 said:
I see, it probably uses the connect message from the programming protocol. I will see if I can implement enough of it to get it to work better.

But might not have anything to do with your issue. Sounds like speed limiting is taking place which is one of the open issues I haven't been able to figure out and is only affecting some users.

Try disabling the Speed Sensor in the configuration tool to see if the issue disappears and report back.

Interestingly enough , it was the same . Even with the speed sensor disabled and i physically moved the magnet away. I'm at a loss lmao
 
jayteee said:
danielnilsson9 said:
I see, it probably uses the connect message from the programming protocol. I will see if I can implement enough of it to get it to work better.

But might not have anything to do with your issue. Sounds like speed limiting is taking place which is one of the open issues I haven't been able to figure out and is only affecting some users.

Try disabling the Speed Sensor in the configuration tool to see if the issue disappears and report back.

Interestingly enough , it was the same . Even with the speed sensor disabled and i physically moved the magnet away. I'm at a loss lmao


Both issues were still present? I.e. bad readings on the display and the motor power increasing and decreasing on constant throttle?
 
danielnilsson9 said:
jayteee said:
danielnilsson9 said:
I see, it probably uses the connect message from the programming protocol. I will see if I can implement enough of it to get it to work better.

But might not have anything to do with your issue. Sounds like speed limiting is taking place which is one of the open issues I haven't been able to figure out and is only affecting some users.

Try disabling the Speed Sensor in the configuration tool to see if the issue disappears and report back.

Interestingly enough , it was the same . Even with the speed sensor disabled and i physically moved the magnet away. I'm at a loss lmao


Both issues were still present? I.e. bad readings on the display and the motor power increasing and decreasing on constant throttle?

Yep , Display still gave constant crazy readings and the motor just being intermittent. I tried giving it full power from a stop , it struggled so hard , it just stopped working for a second or 2 .
 
jayteee said:
Yep , Display still gave constant crazy readings and the motor just being intermittent. I tried giving it full power from a stop , it struggled so hard , it just stopped working for a second or 2 .

Ok, I got no clue really. Same thing if you do not plug in the programming cable in your phone but just leave it connected and run without display?
 
Back
Top