Programming the Bafang Middrive BBS01+BBS02

Discussions related to motors other than hub motors.
This includes R/C motors, botttom bracket, roller and geared drives.
User avatar
tomjasz   10 GW

10 GW
Posts: 4163
Joined: Mar 29 2014 1:45pm
Location: Out riding, MN USA
Contact:

Re: Programming the Bafang Middrive BBS01+BBS02

Post by tomjasz » Jun 04 2017 12:46am

waynebergman wrote:Has anyone heard of any Mac based solutions for Programming our Bafang controllers? I was given a PC that I was only going to use for reprogramming my controller but that PC laptop just quit working. I really dont want to buy a PC just for this purpose if I can somehow use my Mac for the job. Also, I am not interested in running the virtual PC options on my Mac.

Ive been finally playing with a switcheroonie, very cool, can upload, download and store several versions.
Thanks Justin_le we're here thanks to you. All the best to the mods for their tireless work keeping it on an even keel.

JoeAverage   1 mW

1 mW
Posts: 11
Joined: Jul 07 2017 8:49am

Re: Programming the Bafang Middrive BBS01+BBS02

Post by JoeAverage » Jul 07 2017 12:55pm

FWIW It looks like I can use the BaFang config tool in free Mint Linux (Cinnamon and KDE desktops) with the free Wine emulator.

Will check soon - am waiting on a replacement battery charger.

That allows me to run my old netbook that someone gave me without looking for a Windows machine to use to program my BBSHD.

Thunderass   1 µW

1 µW
Posts: 2
Joined: Jan 12 2018 2:05pm

Re: Programming the Bafang Middrive BBS01+BBS02

Post by Thunderass » Jan 12 2018 2:16pm

Hello everybody. i have bbs02b 750 watt motor. i want to make usb programmable cable. i bought PL2303 TTL USB converter.But my display connection tipe is HIGO-B3 (https://www.e-bike-technologies.de/inde ... -b3-detail this one it has 3 pins)i think it doesnt have pl p+ .Anyone knows about how must it be connect to cables?

User avatar
tomjasz   10 GW

10 GW
Posts: 4163
Joined: Mar 29 2014 1:45pm
Location: Out riding, MN USA
Contact:

Re: Programming the Bafang Middrive BBS01+BBS02

Post by tomjasz » Jan 12 2018 2:24pm

Thunderass wrote:
Jan 12 2018 2:16pm
Hello everybody. i have bbs02b 750 watt motor. i want to make usb programmable cable. i bought PL2303 TTL USB converter.But my display connection tipe is HIGO-B3 (https://www.e-bike-technologies.de/inde ... -b3-detail this one it has 3 pins)i think it doesnt have pl p+ .Anyone knows about how must it be connect to cables?
Review this thread and post.
https://endless-sphere.com/forums/viewt ... 75#p915172
You should be connecting to the green Higo. To controller.
Thanks Justin_le we're here thanks to you. All the best to the mods for their tireless work keeping it on an even keel.

Thunderass   1 µW

1 µW
Posts: 2
Joined: Jan 12 2018 2:05pm

Re: Programming the Bafang Middrive BBS01+BBS02

Post by Thunderass » Feb 03 2018 4:16pm

tomjasz wrote:
Jan 12 2018 2:24pm
Thunderass wrote:
Jan 12 2018 2:16pm
Hello everybody. i have bbs02b 750 watt motor. i want to make usb programmable cable. i bought PL2303 TTL USB converter.But my display connection tipe is HIGO-B3 (https://www.e-bike-technologies.de/inde ... -b3-detail this one it has 3 pins)i think it doesnt have pl p+ .Anyone knows about how must it be connect to cables?
Review this thread and post.
https://endless-sphere.com/forums/viewt ... 75#p915172
You should be connecting to the green Higo. To controller.
Thanks for your helping.i succesfully plug with hand made cable to motor.
These are my settings.
Image

i have questions if you help me i ll appreciate.
1-After flash these settings my throttle was limited by speed.(40 km/s)Before throttle doesnt have speed limit.And i didnt any backup before flashing:(
2-Sometimes if i pedalling to backward ,motor is shaking .Generally on low speeds.
How can i fix these.

i fixed...

espresso   100 mW

100 mW
Posts: 40
Joined: Mar 08 2017 5:20am

Re: Programming the Bafang Middrive BBS01+BBS02

Post by espresso » Mar 26 2018 12:36pm

teslanv wrote:
Apr 24 2014 9:39am
ziltoid81 wrote:
Got the same interface like yours, but still to dumb to get a connection......3 wires to the Interface (gnd, rx, tx), switched rx and tx, shortened pl and p+ on the controllerplug to the motor/controller.
Connect battery and hit the connect button.....the same happens every time.

Always get an "error opening serial port" either the cables are connected or not.
The interface is showing a red light all the time and when i disconned the battery from the motor, a blue led light up for 2-3seconds(on the interface).

I ordered another interface, but now i see yours the same....
You dont get all the actions to work, but at least you got a connection
Maybe i should solder my wiring again.
Dont know where to start again.....

Do i need to setup the interface via windows?
Just installed the driver for the interface and opened the bafang software.
The interface is properly listed, without any warnings, in the device manager.
You will need to enter the COMM port ID in the software. Look for the Breakout Board hardware in the "Ports" Section of the Device Manager. Mine Was identified as "COM7"

Then, in the controllerst software, type in COM7 (or whatever port yours is) - The software should then be able to communicate with your PC.

Image

Click "Connect" and you should be up and running.
My experience is that it won't connect to any port other than Com 1-4.
If it tries to designate the programming cable to any other port, you have to change the number to 1-4 whichever one is free.

gbetous   1 µW

1 µW
Posts: 1
Joined: Apr 24 2018 3:43pm

Re: Programming the Bafang Middrive BBS01+BBS02

Post by gbetous » Apr 24 2018 3:54pm

Hi everyone,

I read a lot on this valuable topic (but could not read all messages in detail, I must admit).

I am considering to program by myself my BBS02, but I'm quite surprised by one thing : in the different assist levels description, I can read "Asst1 Limit Current(%): 52/20/52/10/52 – Power cut based on road speed at power level 1."

Did anyone confirm that the parameter "Limit Current" is really a "road speed limit" ? This would mean that the parameter name is totally wrong...

Thank you very much for your help

alfantastic   10 kW

10 kW
Posts: 513
Joined: Mar 29 2011 10:34pm
Location: UK
Contact:

Re: Programming the Bafang Middrive BBS01+BBS02

Post by alfantastic » Apr 25 2018 6:31am

gbetous wrote:
Apr 24 2018 3:54pm
Hi everyone,

I read a lot on this valuable topic (but could not read all messages in detail, I must admit).

I am considering to program by myself my BBS02, but I'm quite surprised by one thing : in the different assist levels description, I can read "Asst1 Limit Current(%): 52/20/52/10/52 – Power cut based on road speed at power level 1."

Did anyone confirm that the parameter "Limit Current" is really a "road speed limit" ? This would mean that the parameter name is totally wrong...

Thank you very much for your help
No, the name and function of 'Limit Current(%)' is correct. On my BBS02, I have found the best settings for me are to set 'Limit Current(%)' all to 100% and I set the 'Limit Spd(%) to match the gear ratios of my cassette using 5 PAS levels. Therefore, I can go slowly up steep hills and across difficult terrain (PAS 1), but with maximum torque. I can also ramp up the speed and maintain that speed by selecting a higher PAS level (PAS 5)

Oh, and max the 'Keep Current(%)' to 100%, you'll get much better hill climbing performance.

cluletrecl   1 µW

1 µW
Posts: 3
Joined: Apr 09 2018 6:13am

Re: Programming the Bafang Middrive BBS01+BBS02

Post by cluletrecl » Apr 27 2018 9:04am

dunno if this is the right topic, but can i use the programming cable and software to program a frontwheel motor: BF FM G320.250 instead of the middrive BBS01 or BBS02 ?

any advice would be appreciated!


thx,

alfantastic   10 kW

10 kW
Posts: 513
Joined: Mar 29 2011 10:34pm
Location: UK
Contact:

Re: Programming the Bafang Middrive BBS01+BBS02

Post by alfantastic » Apr 28 2018 10:33am

cluletrecl wrote:
Apr 27 2018 9:04am
dunno if this is the right topic, but can i use the programming cable and software to program a frontwheel motor: BF FM G320.250 instead of the middrive BBS01 or BBS02 ?
The programming lead and software programs the controller, so the motor is less important. All the Bafang programming cables I've seen come with the green 5 pin Higo connector. Also, the programming software doesn't appear to be BBS01, BBS02 or BBSHD specific.

Therefore, If your controller happens to connect to the display using a green 5 pin Higo connector, then I see no reason why the controller can't be programmed in the same way as the BBSxx series.

cluletrecl   1 µW

1 µW
Posts: 3
Joined: Apr 09 2018 6:13am

Re: Programming the Bafang Middrive BBS01+BBS02

Post by cluletrecl » May 07 2018 8:52am

alfantastic wrote:
Apr 28 2018 10:33am
cluletrecl wrote:
Apr 27 2018 9:04am
dunno if this is the right topic, but can i use the programming cable and software to program a frontwheel motor: BF FM G320.250 instead of the middrive BBS01 or BBS02 ?
The programming lead and software programs the controller, so the motor is less important. All the Bafang programming cables I've seen come with the green 5 pin Higo connector. Also, the programming software doesn't appear to be BBS01, BBS02 or BBSHD specific.

Therefore, If your controller happens to connect to the display using a green 5 pin Higo connector, then I see no reason why the controller can't be programmed in the same way as the BBSxx series.
after reading this positive news, so the other day i bought the cable online, Installed the drivers of the cable and the software, and it worked, I could connect the software with the controller, and change the parameters, i've tried to set it to 40 km/h, however it only could go 30km/h (gps speed tested), I tried a lot of parameters, but 30km/h was the limit (before it was 25km/h) , it seems like there is still some (hardware?) limit to 30 km/h. Next few days will try other settings.

The motor itself is rated 250W, i suppose it is nominal power, @30km/h it is consuming 200-280W, so guess there won't be any margin left to go faster than that (air resistance is quadratic to speed). But I'm okay with 30 km/h .

Paraphyte   1 µW

1 µW
Posts: 1
Joined: May 14 2018 6:28pm

Re: Programming the Bafang Middrive BBS01+BBS02

Post by Paraphyte » May 14 2018 6:38pm

Thanks for the hard work the originals put in on this thread. Particularly Kepler, who's Strava records I'm now trying to break with his own settings. :lol:

Thought I'd share this;
I've started tweaking the settings, using Kepler's as a starting point.
Yesterday I found that by reducing the slow start mode from 6 to 4, resulted in being limited to a very low speed ~5kph (despite all my speed limits being set to 40kph).

Quite annoying since I'd changed a few other settings simultaneously, but by process of elimination it was this setting that was the culprit.
Haven't tried three or five because I needed the bike to work and didn't have time to play.

Also noticed that the controller didn't like the current limit set to 17. When I'd write these settings, and then read again, factory settings were restored every time. 16 and 18 worked fine for me.

Such a quirky thing! Will be changing one variable at a time from now on.
Cheers!

Bike_man   1 µW

1 µW
Posts: 1
Joined: Jun 29 2018 3:58am

Re: Programming the Bafang Middrive BBS01+BBS02

Post by Bike_man » Jun 29 2018 4:11am

I have a simpel Bafang "display" without lcd just led-lights showing assist level (DP E10.UART). I have 5 level of assist on the display, which level equals the 9 assist levels in the program? Is it possible to set the top level of assist to level 4 on the display and leave the level 5 to a "legal" assist level, maybe 50% assist?

jur   100 mW

100 mW
Posts: 36
Joined: Apr 07 2017 1:07am

Wheel size in config file does not take

Post by jur » Jul 30 2018 12:41am

I have tried fruitlessly to set my wheel diameter to 19" in the cfg file but the firmware seems to ignore that cfg setting, using the display setting instead. The display setting jumps 2" which gives an up to 5% error which is my case.

Am I doing something wrong or is the config value always ignored?

lolo.31   1 µW

1 µW
Posts: 2
Joined: Mar 23 2019 4:54am
Contact:

Re: Programming the Bafang Middrive BBS01+BBS02

Post by lolo.31 » Mar 23 2019 5:11am

Hi there,

A little update.

I have upgraded the Software Programming Tool, starting from the S. Penoff amazing version he did ( so much thanks for his work)
Lot of improvments are now available, with a included help for each parameters, additional infos, bugs corrections, full multi language (available today : english french) translation. A easy system is set up to add any additional languages for who wants to contribute, by adding your own txt files in the "Languages" directory. (see readme.txt included
The included help is of course based on the electricbike wellknown reference
This new software has been successfully tested by a little communauty from France. All sources file are included of course.

Download link (V2.2a) and release history (in french, chapter 12 at bottom page, use the translate widget on the right) and future new versions here::
https://blitip.blogspot.com/2019/04/log ... g-bbs.html


Any comments or suggestions will be welcome :D


Enjoy !
Laurent
Last edited by lolo.31 on Apr 14 2019 3:32am, edited 1 time in total.

wr75   10 µW

10 µW
Posts: 5
Joined: Jan 29 2019 5:21am

Re: Programming the Bafang Middrive BBS01+BBS02

Post by wr75 » Mar 30 2019 5:23am

lolo.31 wrote:
Mar 23 2019 5:11am
Hi there,

A little update.

I have upgraded the Software Programming Tool, starting from the S. Penoff amazing version he did ( so much thanks for his work)
Lot of improvments are now available, with a included help for each parameters, additional infos, bugs corrections, full multi language (available today : english french) translation. A easy system is set up to add any additional languages for who wants to contribute, by adding your own txt files in the "Languages" directory. (see readme.txt included
The included help is of course based on the electricbike wellknown reference
This new software has been successfully tested by a little communauty from France. All sources file are included of course.

Download link (V2.2a) :
https://www.dropbox.com/s/jqpy0l9d2pn1a ... a.zip?dl=0


Release history (in french, chrpter 12 at bottom page) and future new versions here:
http://cyclurba.fr/velos/3584/conversio ... otaff.html

Any comments or suggestions will be welcome :D


Enjoy !
Laurent
Awesome! Can you please make a version with the torque tab settings for the Ultra Max?

Jakuda   1 µW

1 µW
Posts: 1
Joined: Apr 06 2019 5:12pm

Re: Programming the Bafang Middrive BBS01+BBS02

Post by Jakuda » Apr 06 2019 5:25pm

Hi,
Recently I bought a city e-bike for my wife with e-novation engine=BBS01.
I really want to config it- but I spent half of day yesterday and WHOLE day today...with no success:(

I bought Prolific PL2303 interface- which I have read that is fake, but I downloaded a few drivers and 2/3 makes it appear correctly. Unfortunately programming tool don't want to connect (it recognize COM port)- everything is greyed out and no controller info. I believe I've done everything correct, like smbdy wrote (with no response) connected GND, RX to TX (initially I did it opposite- could I fry smthing?), shortened P+ with PL, started battery, speed sensor lights up. Prolific initally light red (power) LED and blue (read I think), when I turn on battery only red stays on.
I have checked with multimeter GND to RX and TX (they give about 4.7v and 3.8v).

I have tried with a couple of drivers, on laptop (win 10), PC (win 10) and PC win 7.

I run out of ideas.

Could you please help?
Thanks

jur   100 mW

100 mW
Posts: 36
Joined: Apr 07 2017 1:07am

Re: Programming the Bafang Middrive BBS01+BBS02

Post by jur » Apr 08 2019 11:13pm

When I connect, the buttons are greyed out unless I connect it to the motor cable. So if your buttons remain grey then I am guessing there is no comms between the motor and the module.

If your display unit still works correctly when you connect it to the motor, then you haven't damaged anything.

cross33   1 µW

1 µW
Posts: 3
Joined: Apr 09 2019 1:03pm

Re: Programming the Bafang Middrive BBS01+BBS02

Post by cross33 » Apr 09 2019 1:20pm

elenhinan wrote:
Nov 29 2016 7:44am

Well, not anymore. I wrote a really small python script that spoofs the login response of their server, letting one access the programming tool in the BESST software (tested with v1.06). For this to work you need to add the line "127.0.0.1 besst-api.yuntick.com" to c:\windows\system32\drivers\etc\hosts . This will redirect all communication intended for the bafang servers to the local web-server run by the script. Any login will then automatically be accepted. Open notepad with administrative privileges to edit this file, or save it somewhere else and copy and overwrite it afterwards. Then start the spoof.py if you already have python installed, or spoof.exe if not. It might need some microsoft visual c++ redist package, but most computers already have this installed. Login with whatever email and password you want. After login click menu and then tool. Just to clarify, this does not give you access to any restricted Bafang servers or anything I would consider shady, it just let's you open the software that runs locally on your computer.

An diagnostics mode is also available if one modifies the python script (type from 4 to 3 on line 19), which should do some testing of the display and controller.

As I have no programming cable I have not tested this. Since the software comes straight from Bafang I wouldn't expect it to put your bike on fire, but then again don't blame me if it does. If anyone want to test it out it would be interesting if you could share your experience.
Hi elenhinan
First of all, thank you for making the besst-spoof script. But, I'm unable to get it woking with the current version of BESST (v.1.2.17). I'm just getting "Unable to connect to remote service". Are you able to share the v.1.06? Or is there a another fix to this problem?

Best
Martin

martinw   1 mW

1 mW
Posts: 19
Joined: Jan 16 2019 8:51am

Re: Programming the Bafang Middrive BBS01+BBS02

Post by martinw » Apr 10 2019 7:00am

Hi, I programmed my BBS01B motor from 18Amp to 20Amp max (using 36v battery).
I use motor purely in PAS mode (full assistance mode most of the time) and I am alwyas trying to pedal hard between 40-70rpm, depends on terrain.
Do you think I could damage gears or something else in motor in the long run ? Does latest version of 20amp controller of BBS01 has some temperature protection ?

BotoXbz   10 W

10 W
Posts: 91
Joined: May 20 2018 7:00am

Re: Programming the Bafang Middrive BBS01+BBS02

Post by BotoXbz » Apr 12 2019 8:30pm

cross33 wrote:
Apr 09 2019 1:20pm
elenhinan wrote:
Nov 29 2016 7:44am

Well, not anymore. I wrote a really small python script that spoofs the login response of their server, letting one access the programming tool in the BESST software (tested with v1.06). For this to work you need to add the line "127.0.0.1 besst-api.yuntick.com" to c:\windows\system32\drivers\etc\hosts . This will redirect all communication intended for the bafang servers to the local web-server run by the script. Any login will then automatically be accepted. Open notepad with administrative privileges to edit this file, or save it somewhere else and copy and overwrite it afterwards. Then start the spoof.py if you already have python installed, or spoof.exe if not. It might need some microsoft visual c++ redist package, but most computers already have this installed. Login with whatever email and password you want. After login click menu and then tool. Just to clarify, this does not give you access to any restricted Bafang servers or anything I would consider shady, it just let's you open the software that runs locally on your computer.

An diagnostics mode is also available if one modifies the python script (type from 4 to 3 on line 19), which should do some testing of the display and controller.

As I have no programming cable I have not tested this. Since the software comes straight from Bafang I wouldn't expect it to put your bike on fire, but then again don't blame me if it does. If anyone want to test it out it would be interesting if you could share your experience.
Hi elenhinan
First of all, thank you for making the besst-spoof script. But, I'm unable to get it woking with the current version of BESST (v.1.2.17). I'm just getting "Unable to connect to remote service". Are you able to share the v.1.06? Or is there a another fix to this problem?

Best
Martin
they changed a few things, need to add
127.0.0.1 test.api.besst.bafang-service.com
to hosts file now

and here is the updated python code (converted it to python3):

Code: Select all

# written by elenhinan, 24.11.2016

from http.server import BaseHTTPRequestHandler, HTTPServer
import socketserver
import simplejson as json
import socket

class BESST_server(BaseHTTPRequestHandler):
	def do_POST(self):
		data_string = self.rfile.read(int(self.headers['Content-Length']))
		print("got post from BESST (%s)"%data_string)
		
		if b"password" in data_string:
			print("login accepted ;)")
			self.send_response(200)
			self.send_header('Content-type', 'application/json;charset:UTF-8\r\n')
			self.end_headers()
			#user type: 1 brand, 2 dealer, 3 assembler, 4 manufacturer, 5 terminal. 4 for tool access, 3 for diagnostics
			userdata = json.dumps( {'code':0,'data':{'user':{'status':1,'org': {'id': 12345, 'type': 4}},'token':123}} )
			self.wfile.write(userdata.encode('utf-8'))
		else:
			self.send_response(200)
			self.send_header('Content-type', 'application/json;charset:UTF-8\r\n')
			self.end_headers()
			userdata = json.dumps( {'code':0} )
			self.wfile.write(userdata.encode('utf-8'))
 
		
def run(handler_class=BESST_server, port=80):
        ip_lookup = socket.gethostbyname('besst-api.yuntick.com')
        print(("test.api.besst.bafang-service.com forwards to %s"%ip_lookup))
        httpd = socketserver.TCPServer(("", port), handler_class)
        print("Starting httpd...")
        httpd.serve_forever()

	
if __name__ == "__main__":
	run()
I don't have a BESST tool sadly so this was kinda useless for me as the program doesn't seem to work with just a CP2102
But I unpacked the code from the BESST tool, it's an electron app.
Here's most of the logic: https://cloud.botox.bz/s/6577jFi9a2nrT3g
It has a bunch of battery related stuff, gonna use that info to make my open source BMS firmware compatible with Bafang displays :D

User avatar
tomjasz   10 GW

10 GW
Posts: 4163
Joined: Mar 29 2014 1:45pm
Location: Out riding, MN USA
Contact:

Re: Programming the Bafang Middrive BBS01+BBS02

Post by tomjasz » Apr 12 2019 10:35pm

It’s not a great motor to increase amps. BBS01B May be more forgiving, but if it’s an early version it’s a mistake. Regardless these are not motors suited for pushing. Besides the speed gain is marginal. Added stress could over heat an already somewhat heat sensitive motor. Willy billy programing toasts controllers.

Then again, there are ways... https://endless-sphere.com/forums/viewt ... 28&t=94022
Thanks Justin_le we're here thanks to you. All the best to the mods for their tireless work keeping it on an even keel.

lolo.31   1 µW

1 µW
Posts: 2
Joined: Mar 23 2019 4:54am
Contact:

Re: Programming the Bafang Middrive BBS01+BBS02

Post by lolo.31 » Apr 14 2019 3:52am

wr75 wrote:
Mar 30 2019 5:23am

Awesome! Can you please make a version with the torque tab settings for the Ultra Max?

Hello wr75

Sorry for my answer delay, I didn't seen your post
I'm not sure that Ultra Max uses the same serial protocol parameters, and I don't have an Ultra Max to test them.. so...

I plan a new update to correct some minor bugs. Don't hesitate to send me questions/suggestions or functionality request, if it is possible, it will be a pleasure for me to add your requests into the Software

Please note that software is now available on my blog :
https://blitip.blogspot.com/

As it is in french, you can use the Translate widget on the right of the page

cross33   1 µW

1 µW
Posts: 3
Joined: Apr 09 2019 1:03pm

Re: Programming the Bafang Middrive BBS01+BBS02

Post by cross33 » Apr 20 2019 1:00pm

Hi BotoXbz
Sorry for the bit late reply, but I just want to say thank you. The script is working!
The SW (or maybe the HW) is very buggy, I have to do multiple reads before you get a successful reply. But all in all it works.

:bigthumb:

martinw   1 mW

1 mW
Posts: 19
Joined: Jan 16 2019 8:51am

Re: Programming the Bafang Middrive BBS01+BBS02

Post by martinw » Apr 26 2019 3:19am

When I set invalid parameter in the bafang tool and I will save it - whole 'profile' is not saved into controller but original setting of controller is somehow lost (e.g. changing max amps from 20A to 19A is not possible, only 18A is possible to save). I had to start from beginning (to set again all assist levels etc...). I that well known issue or just my incompetence ?

Post Reply