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
Tom on 101   10 mW

10 mW
Posts: 28
Joined: Jun 17 2016 10:12am
Location: Aptos, California

Re: Programming the Bafang Middrive BBS01+BBS02

Post by Tom on 101 » Jan 21 2020 4:29pm

Hello

I too would like to set my cut-off voltage so I can use a 36volt battery on a BBS02. I've tried a number of work arounds for flashing the firmware to no avail. My preference is to run the system at 36 volts with a cut-off around 32. I have some really cool 36 volt batteries I want to use. Does anyone have and willing to share the BBS01 firmware so I can try flashing my system with that?

Anyone out there have any success trying to do this? Thank you in for any help in this area.

User avatar
tomjasz   10 GW

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

Re: Programming the Bafang Middrive BBS01+BBS02

Post by tomjasz » Jan 22 2020 6:00pm

osholt wrote:
Jan 20 2020 1:41pm
I purchased a BBS02 48V 750W a few months ago and fitted it to my bike before acquiring a battery.



Is there a 36V BBS02 firmware image available? I have seen a few on these forums but I think they are all 48V.

Key phrase, "I purchased a BBS02 48V 750W" you need 48V!(54.6V)
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.

Mike_TM   1 µW

1 µW
Posts: 1
Joined: Feb 09 2020 6:02pm

Re: Programming the Bafang Middrive BBS01+BBS02

Post by Mike_TM » Feb 09 2020 6:20pm

The 500c display voltage readout is indeed not always correct. I have a bbshd and a 48 volt battery and the 500c didn't show the correct voltage. It would always show the percentage of a 52 volt battery, even if you change the settings in the display to 48 volt. And the bbshd would even power down to a lower power output if the percentage of the battery (which wasn't correct) dropped below 5%. That's very annoying because the battery was actually not empty at all.

I figured out that the 500c use the voltage used in the motor controller instead of the voltage selected in the display. I changed my firmware in my bbshd to the 4830 version and it now shows the correct voltage and the motor power output now remains normal over the correct range from my battery. So it appears to be a controller firmware issue and not a 500c issue. I don't now if this is the same for the bbs01 and bbs02, but I suspect it is.

SirBen   1 µW

1 µW
Posts: 1
Joined: Mar 15 2020 5:37am

Re: Programming the Bafang Middrive BBS01+BBS02

Post by SirBen » Mar 16 2020 8:35am

BotoXbz wrote:
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
Thank you very much for the Script. I got it to work on my PC.
Does anyone know what is inside the BESST Box?
Because during Installation of BESST software the drivers of CP2102 will be installed.
Maybe it is working with CP2102?
In my case I want to change some settings in the DP-C11 Display.
Thanks
Ben

Post Reply