• 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

geofft said:
Just to add some closure to this, I've now replaced the controller and re-flashed and all is working well.

Just been out for a short test ride, very impressed with the smooth way this firmware works. Pas picks up very quickly from a standstill and throttle blends in with pas quite seamlessly, both noticeable improvements on the Bafang firmware. Also the battery indicator is accurate and stable and doesn't just jiggle around in response to the immediate voltage. I just need to play around with the assist levels in the config, it's currently a bit too strong at the lower assist levels, easily fixed.

It's still a bit of a mystery why the original controller 'disapproved' of being reflashed and refused to communicate the battery voltage, etc. Although I could still reflash it, this resulted any Bafang fw to show 'error 30' and Daniel's fw to operate in LVC mode only. I've reflashed Bafang configs with this controller many times in the past without issue. Strange, I guess I cocked up somewhere....

So, I'm now pretty happy, once again, nice work Daniel :D

Glad you got it sorted, thanks for letting me know!

Sounds like also the circulating BBS02 firmware was not compatible with you old controller either. How old was it? I'm starting to suspect there are compatibility issues with older BBS02 controllers with my firmware since a wide variety of strange issues has been reported which cannot be reproduced on my brand new BBS02B controller.
 
tshiner said:
Hi everyone,
I want to first thank Daniel for making a option for the Bafang midrive. I have made my donation to Daniel on github.
This is my first post, as I am having trouble with my BBSHD as follows:

BBS-HD 48V 1000W
2207270653

CONTROLLER
CR R10E. 1000W
0571-30-5086
2207 7150098

DISPLAY
800S RS10B48
MSO.32 V5.0
I am new to electric bikes after ridden gas powered bikes for many years. A few months ago I purchased a BBSHD, built a 58v 14s 16 ah battery out of SWM08 LI-PO CELLS. I also installed a voltage and amperage Guage. The factory current was set at 22 amps. I installed Daniel's 1.2 firmware. Flashing the hex files went well. The 800s display was mailed seperate from the BBSHD, from China. I don't think it's a Bafang product. The factory firmware was gutless. The problem I'm having now is the bike won't get over 22kph. It starts off at 33 amps and goes to a few amps as it reaches 22kph. It will increase to maintain speed going up hills. I have re flashed firmware. Battery can handle 200A peak draw. Wiring is 10g. Almost no voltage drop. I've changed wheel size. I have no trouble with overheating as it won't go, like others are having. I thought with Daniel's 33amp limit it would keep up with others. It's like the controler wants to go but the display is stopping it.
Can anyone shed some light on this.
Thanks for what you all do and Daniel for trying to make the product better.

And you haven't configured any speed limit in the configuration tool? The default configuration has no speed limit set (or it is really high, like 100kph).

Please post you configuration from the config tool (File -> Export).
https://github.com/danielnilsson9/bbs-fw/wiki/Configuration-Tool

The speed limit that is set in the display is ignored so that shouldn't be an issue.
 
danielnilsson9 said:
Glad you got it sorted, thanks for letting me know!

Sounds like also the circulating BBS02 firmware was not compatible with you old controller either. How old was it? I'm starting to suspect there are compatibility issues with older BBS02 controllers with my firmware since a wide variety of strange issues has been reported which cannot be reproduced on my brand new BBS02B controller.

That particular BBS02B was purchased in July 2016, so fairly old but I have another that's older still. It's version details were:-
Hardware vers. V1.1
Firmware vers. V2.0.1.1
(as shown in the Bafang config tool).

My feeling is that I may have got careless at some point with all the plugging/unplugging that's involved with reflashing and managed to pop something in the controller, but I can't be certain about that.

Is the old (non working) controller any use to you? You're welcome to it if you think it may help you, if so pm me your details.

I've now acquired some "BBS02B 48v 750w" Bafang firmware (My thanks to Golden Motor, N. America). It came along too late to test it on the faulty controller but I'll post it up if anybody needs it - but do bear in mind it hasn't as yet been tested.

EDIT: I've now tried the Golden Motor f/w on two different bikes with both early and late version controllers and it always gives 'Error 30' on power up. Not a problem for me as Daniel's f/w works without problems but it looks like this isn't going to work.

In fact all the Bafang f/w I've found online fails 'Error 30'....... :?
 
I tried the Wooshbikes manual. the password 0101 did not give access and double clicking power did not work. What gave me limited access was holding up and down for a few seconds, TWICE. found password to be 0512. i was able to change top speed, wheel size and then a number of choices which I was unable to change. I dont think I have found the correct manual yet. I am running BBS-fw-V1.2.0.hex.
the problems remains that whatever I do the bike will not go over 20 MPH. Current starts at the programed 33 amps and backs off
to maintain 20 mph. If anyone has any insight please respond.

Well I tried disconnecting the speed sensor. At this time I realized that changing the wheel size didn't seem to make any difference. Well this fixed the problem. It worked with the speed controller. I stopped and tried plugging the wheel sensor back in. Everthing was back to normal. Just like cycling power I cycled the speed sensors waterproof plug. I forgot to turn off power first. I don’t know what happened. The bike is fun again. I like Daniel's firmware it corrected a number of issues with the factory setup. Thank you!
 
Daniel, I think this is what you asked for. I realise 100 is max speed in KPH, In US that equals 62 MPH I assume. I also have the max speed in the 800s by APT set at 62MPH.
I hope that I sent you what uou wanted.View attachment bbsfw-for-daniel.xml
Thank you again for what you do.
 
tshiner said:
I tried the Wooshbikes manual. the password 0101 did not give access and double clicking power did not work. What gave me limited access was holding up and down for a few seconds, TWICE. found password to be 0512. i was able to change top speed, wheel size and then a number of choices which I was unable to change. I dont think I have found the correct manual yet. I am running BBS-fw-V1.2.0.hex.
the problems remains that whatever I do the bike will not go over 20 MPH. Current starts at the programed 33 amps and backs off
to maintain 20 mph. If anyone has any insight please respond.

Interesting, while you might be able to find another manual if you were able to change the top speed then I'm not sure finding the real one would help much. I did see the manual stated a default password of 1919, was 0101 a miss type or did you not give it a try? I wonder if the display has a user settings and a manufacture settings and the further would limit the speed no matter what the user sets it too?

Have you tried running the bike without the display? I know that was one of the features of the software, maybe try that and if you are no longer speed limited you know for sure its the display and you can either try to figure it out or upgrade to something nicer :wink:
 
Yes, 0101 was miss typed. I was using 1919, and couldn't get in. I'm new to posting. I just replied that the problem is fixed!!! Yes I did try to run without display. Nothing would work. So I tried to disconnect the speed sensor. After I unplugged it, I realized I didn't turn off the display. Well it ran without speedometer. Plugged speed sensor back in it was like it had a engine transplant. I wonder if my display was setup for that midrive with the chain to sprocket setup. So now it's time to ride some with knowing how how much juice the battery has left.
With all the different stuff I found on the web, I would not be surprised if a German company made a display that was copied in China. Then it went through a couple of changes. What led me to 0515 is that I searched for display passwords and someone posted a bunch to try. I'm happy now as I'm getting older and my knees need some exercise. I am impressed by the members here vast knowledge. Thanks!
 
tshiner said:
Yes, 0101 was miss typed. I was using 1919, and couldn't get in. I'm new to posting. I just replied that the problem is fixed!!! Yes I did try to run without display. Nothing would work. So I tried to disconnect the speed sensor. After I unplugged it, I realized I didn't turn off the display. Well it ran without speedometer. Plugged speed sensor back in it was like it had a engine transplant. I wonder if my display was setup for that midrive with the chain to sprocket setup. So now it's time to ride some with knowing how how much juice the battery has left.
With all the different stuff I found on the web, I would not be surprised if a German company made a display that was copied in China. Then it went through a couple of changes. What led me to 0515 is that I searched for display passwords and someone posted a bunch to try. I'm happy now as I'm getting older and my knees need some exercise. I am impressed by the members here vast knowledge. Thanks!

Interesting, I wonder if it is something in the firmware or if its the display even though Daniel said the firmware should over ride it. As unplugging the speed sensor could trick both into not limiting the speed. Glad you could get it working for your needs though! Hopefully in the future you or daniel can figure out what is going on though so you can get your speedo back and it will not affect anyone else.

I do have a question, any chance the firmware could implement a feature for people who have done the shunt mod to correctly show wattage / amps? Like in the settings you could put show "1.5x" (configurable) amps on display. That way my 45as shunt mod would correctly show wattage.
 
hi daniel, great firmware. thanks for making your code open source.

tried latest release 1.2 firmware on my bbshd rev 1.5 and works great except for one huge flaw;
gear shift sensor is not working or if it is the delay in engine cutoff is so short i do not even notice it cutting off.

Is there a way to enable gear shift sensor somehow?
much prefer your firmware vs the previous custom modded firmware from bafang but the absence of working gear shift sensor is a gear killer. chain grinding on gears at high engine torque during a gear shift is heart wrenching.
 
bumblemike said:
hi daniel, great firmware. thanks for making your code open source.

tried latest release 1.2 firmware on my bbshd rev 1.5 and works great except for one huge flaw;
gear shift sensor is not working or if it is the delay in engine cutoff is so short i do not even notice it cutting off.

Is there a way to enable gear shift sensor somehow?
much prefer your firmware vs the previous custom modded firmware from bafang but the absence of working gear shift sensor is a deal killer. chain grinding on gears at high engine torque during a gear shift is heart wrenching.

I have the same problem/request for Daniel. I know that the features working, but it does not cut out long enough. Or just not implemented properly. I think it would be best. If instead of cutting out completely, it cut down to 100 W, for a sufficient period of time, that would be perfect. Cutting out completely might be just fine as well.
 
Daniel, awsome work on building opensource firmware :bigthumb: Donated for a beer/coffe :wink:

I love fast, allmost brutal power delivery and its 1881 W peak power :twisted:
I had to disable controllers temp sensor as it constantly shows 108C, it seems as HW problem as stock firmware limited max power to 300 W.

As I am 99% PAS user I only miss 2 features that were in stock firmware. Please add:
1. On Asssit tab add field "Max Candence Throttle (%)". This improves "Throttle By display command" function. That way PAS Candence can be set independetly from Throttle candence.
2. Brake (gear) sensor delay (ms). That way user can decide how much delay is needed for gearshifting.
 
I still have the problem of the system thinking it’s overheating. I watched it today on a five minute ride going uphill, it got up to around 156°F then it started being jerky. As the temperature had started to climb, I reduced the PAS level to where it was putting out a little over 1000 W. While the display said it was 156°F., I felt the motor and it was only slightly warm.

I’m not sure what to check or if I should just disable the temperature sensors?
 
I want to throw out there that I am having the same jerky/bucking happening to my setup. I am running a brand new BBSHD, 52v battery, 860c display. I have disabled the PAS on this build and run throttle only. As long as I'm doing an off and on low speed throttle ride it's fine. But when I run wide open throttle at around 30mph to work it will start jerking after about 2-2.5 miles. I checked the walk mode for the temp and it was showing 40ish when I stopped. Not sure on the temps while riding though. I will say the casing is barely warm to the touch. I need to figure out how to monitor the temp on my display better. If there's anything I can help to contribute towards this issue, let me know. Other than that issue, the firmware is very good and gives some very nice options. For the time being I will have to flash the newer factory BBSHD firmware to bring back some reliability.
 
I've been looking for the firmware to flash to my older BBSHD (bought in 2018) in hopes it would solve an issue present since it was new (according to previous owner): the throttle does not work from a stop, but works fine once measured speed > 0, overrides PAS as it should, etc.

I have not found firmware compatible with my controller, until Daniel's (I hope). The added features sound like a bonus!

Can those of you more knowledgeable help confirm that my controller is compatible with Daniel's firmware?

I believe the key info is MCU type, however Daniel wrote that the controller revision number is written above the serial number. Mine does not show 1.4 or 1.5.

MCU Check with STC:
MCU STC15W4K56S4
F/W version: 7.3.5T

Written on controller housing:
CR R10E.1000.SN (this is where Daniel says "1.4" should appear)
1-28-527
1707210411
48V30A

Controller info as shown in bafang tool:
Manufacturer: HZXT
Model: BBS3
Hardware Version: V1.1
Firmware Version: V0.0.1.1
Nominal voltage: 48-52V
Max current: 30A

Written on Motor:
BBS-HD 48V
1707290120

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

Does anyone have stock firmware compatible with this controller? Daniel's seems better, but if something goes wrong it would be great to have the option to revert.

Thanks!
 
tshiner said:
I do have a question, any chance the firmware could implement a feature for people who have done the shunt mod to correctly show wattage / amps? Like in the settings you could put show "1.5x" (configurable) amps on display. That way my 45as shunt mod would correctly show wattage.

No. The shunt mod is the mod to incorrectly show wattage. So the mod to correctly show the wattage is also the shunt mod. :shock:

You'd have to reprogram the display to misinterpret the signal coming from the controller.

After a few months you'll get good enough to do the math in your head. The 45A mod x1.5 is easy to work with and the watt meter isn't exactly real time. You really only have your "peak" wattage and your "cruising" wattage to consider since it fluctuates fairly rapidly in between.
 
cdbrown said:
I still have the problem of the system thinking it’s overheating. I watched it today on a five minute ride going uphill, it got up to around 156°F then it started being jerky. As the temperature had started to climb, I reduced the PAS level to where it was putting out a little over 1000 W. While the display said it was 156°F., I felt the motor and it was only slightly warm.

I’m not sure what to check or if I should just disable the temperature sensors?

Yes, try disabling the stator sensor. If it still reads high, enable the stator sensor and disable the controller sensor.

If it still reads high disable both and keep an eye on it. Most people running 30A probably won't overheat. I wouldn't suggest this as a permanent fix but ymmv. I'm running a 50A mod and I don't like the idea of running without overheat protection but so far for how I use my bike it doesn't get hot.
 
furcifer said:
tshiner said:
I do have a question, any chance the firmware could implement a feature for people who have done the shunt mod to correctly show wattage / amps? Like in the settings you could put show "1.5x" (configurable) amps on display. That way my 45as shunt mod would correctly show wattage.

No. The shunt mod is the mod to incorrectly show wattage. So the mod to correctly show the wattage is also the shunt mod. :shock:

You'd have to reprogram the display to misinterpret the signal coming from the controller.

After a few months you'll get good enough to do the math in your head. The 45A mod x1.5 is easy to work with and the watt meter isn't exactly real time. You really only have your "peak" wattage and your "cruising" wattage to consider since it fluctuates fairly rapidly in between.

Oh I've had the shunt mod done for about 6 months now so I've become quite used to doing what you say. So Danial can't change something software side that reprograms with signal to the display? Guess that's why I'm not a programmer as this seems like it would be easy to change haha
 
Today I noticed overheating protection acts quite faster than stock. My motor was 75c after regular alpine climb and I felt less power. That never happend on stock. I have disabled cont sensor.

Daniel, Maybe add parameter on how fast overheating protection reacts on new releaase?
 
I just flashed this firmware and so far things work pretty well!

After a quick test ride I found 2 issues:
1) PAS disables if the pedal cadence drops too low (but it's still a reasonable cadence for me). Any idea what I can do to reduce this lower limit? It definitely limits my hill climbing.
- this is annoying b/c if I start a climb and don't downshift quite early enough, I lose power abruptly and have to jump on the throttle to keep moving
2) motor pause during shifting is a little short

having 2 profiles is awesome! Throttle felt nice and smooth too

Edit 1: to add photos of configuration.
increasing PAS level increases "target power %". Max Power, Max Cadence, and MAX Speed are 100% in all PAS levels

Edit 2: the power loss at low pedal cadence was solved by using the default pedal assist Start Delay (75deg) and Stop Delay (200ms).
 

Attachments

  • Screen Shot 2022-11-11 at 10.43.47 AM.png
    Screen Shot 2022-11-11 at 10.43.47 AM.png
    3.6 MB · Views: 265
  • Screen Shot 2022-11-11 at 10.43.59 AM.png
    Screen Shot 2022-11-11 at 10.43.59 AM.png
    3.2 MB · Views: 263
Do the controller and screen have different voltage measurement hardware?
The voltage measured in the event log matched the display voltage before calibration (both 51.8v). A good DMM showed 51V on the battery, so I calibrated with the configuration tool. Calibration was confirmed in the event log. But the display still shows 51.8V.
 
trrubicon06 said:
I want to throw out there that I am having the same jerky/bucking happening to my setup. I am running a brand new BBSHD, 52v battery, 860c display. I have disabled the PAS on this build and run throttle only. As long as I'm doing an off and on low speed throttle ride it's fine. But when I run wide open throttle at around 30mph to work it will start jerking after about 2-2.5 miles. I checked the walk mode for the temp and it was showing 40ish when I stopped. Not sure on the temps while riding though. I will say the casing is barely warm to the touch. I need to figure out how to monitor the temp on my display better. If there's anything I can help to contribute towards this issue, let me know. Other than that issue, the firmware is very good and gives some very nice options. For the time being I will have to flash the newer factory BBSHD firmware to bring back some reliability.

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.
 
ginekolog said:
Today I noticed overheating protection acts quite faster than stock. My motor was 75c after regular alpine climb and I felt less power. That never happend on stock. I have disabled cont sensor.

Daniel, Maybe add parameter on how fast overheating protection reacts on new releaase?

I did change it to 85 but not sure when there is gonna be a new release. It is winter soon, will probably not take my nice bike (with the BBSHD) out of the garage until the spring as it is always wet here... soo no testing.


You can change it on line 25 here:
https://github.com/danielnilsson9/bbs-fw/blob/master/src/firmware/app.c#L25
And compile your own version, see:
https://github.com/danielnilsson9/bbs-fw/wiki/Build-from-Source
 
tshiner said:
I do have a question, any chance the firmware could implement a feature for people who have done the shunt mod to correctly show wattage / amps? Like in the settings you could put show "1.5x" (configurable) amps on display. That way my 45as shunt mod would correctly show wattage.

Could probably be done, you can test it by changing this line if you want:
https://github.com/danielnilsson9/bbs-fw/blob/master/src/firmware/extcom.c#L524

So I gues that would be for (1.5x):
uint8_t amp_x2 = (uint8_t)((motor_get_battery_current_x10() * 3) / 10);

https://github.com/danielnilsson9/bbs-fw/wiki/Build-from-Source

But i'm not sure the display can show higher power, probably depends on what type of display, give it a try if you want and let me know.
 
kite said:
I just flashed this firmware and so far things work pretty well!

After a quick test ride I found 2 issues:
1) PAS disables if the pedal cadence drops too low (but it's still a reasonable cadence for me). Any idea what I can do to reduce this lower limit? It definitely limits my hill climbing.
- this is annoying b/c if I start a climb and don't downshift quite early enough, I lose power abruptly and have to jump on the throttle to keep moving
2) motor pause during shifting is a little short

having 2 profiles is awesome! Throttle felt nice and smooth too

Edit 1: to add photos of configuration.
increasing PAS level increases "target power %". Max Power, Max Cadence, and MAX Speed are 100% in all PAS levels

Edit 2: the power loss at low pedal cadence was solved by using the default pedal assist Start Delay (75deg) and Stop Delay (200ms).


Yes, stop delay is a bit confusing maybe, you should probably never set it below 200ms. The reference is different in the configuration of the original firmware I belive (something along 200ms + configured stop delay). It's a hardware issue.

There are 24 pulses from the PAS sensor per pedal revolution. Pedaling stop is detected by the abscense of a pulse, stop delay is in the configuration tool is therefore the minimum interval between pulses, if you pedal too slow it will detect a stop. You can calulate the mminimum rpm you have to pedal for a given stop delay, but 200ms is fine, I do not recommend touching it.

2. I do not have a shift sensor and I have cut the cable on my bike so I'm not planning on working on that.
There are some activity disussing better implementations here if you are interested: https://github.com/danielnilsson9/bbs-fw/discussions/67
 
kite said:
Do the controller and screen have different voltage measurement hardware?
The voltage measured in the event log matched the display voltage before calibration (both 51.8v). A good DMM showed 50V on the battery, so I calibrated with the configuration tool. Calibration was confirmed in the event log. But the display still shows 51.8V.


Yes, most displays have their own voltage measurment circuit. The voltage read by controller is not communicated to the display.
If you have a display that shows the "Calories" field it will display voltage read by controller x 10 with this firmware.

The calibration is used for a accurate controller low voltage protection and also for the battery percentage calculation shown on display.
 
Back
Top