Open-source e-bike Configuration&Diagnostics software - tune any kind of your Bafang device - M500, M510, M600, M420, BBS01, BBS02, BBSHD, display or any other
Explore the docs
Releases
·
Report Bug
·
Request Feature
All kinds of modern Bafang hardware with the CAN bus are supported:
All mid-drive motors, all hub motors with Bafang controller, all displays, and all digital torque sensors, as well as all kinds of motors with UART (but not displays with UART)
There are also Bafang motors made for Prophete, E-Novation, and Blaupunkt, but I haven't tried them yet.
Important notices:
-
Some devices have firmware with limited configurable parameters, and it does not depend on model. For example, I tested 3 absolutely idendical M420 mid-drive models, and two of them had all configurable parameters available, and one of them does not offer most of the parameters.
-
If you have a bike with a Bafang hub motor, check the brand of it's controller: Some bike manufacturers may install Bafang hub motors with third-party controllers. I can not support them.
-
Sub-brands usually also have branded motors from other manufacturers; some of those sub-branded models are non-bafang, so you need to search information right for model of your device.
- Added config for speed in "walk mode" for can systems
- Added config for magnet number for uart systems
- Started to add support of multi-language interface
- Added support of Bafang digital batteries (please note that not all of the batteries installed on a bike are digital; Bafang motors could work with simple batteries with no digital interface)
- Added support of more configurable parameters
- Fixed bug with writing
- Added support of new systems with CAN bus
- Published project in Beta
- Added Simplified Mode for beginners
- Published first version in Alpha
Warning! This project in beta version, so use it carefully. If you have any problems, write in Issues
Please report about your expirience of using this program on forum to help me make programm better
The goal of the project is to replace the official diagnostic tools for ebikes, that are available only for official dealers, with open source alternatives to let people repair and configure their bikes at home. For example, you can read and erase error codes, or limit power if the physical power of your motor is too big for your country rules (possibilities depend on motor brand and model). Second goal of project is to document protocols of as much systems as possible to let other developers use them in their projects.
Currently this program supports any kinds of Bafang - motors with UART (BBS01, BBS02, etc) and with CAN (M500, M600, M420, etc).
Currently not all features of CAN motors are supported, more features will be available in further versions.
You can download executables for Windows and Linux (AppImage) here
Minimal set of hardware that you need to use this program for motors with CAN (also possible to test program in demo mode without real hardware):
Official Bafang BESST Tool device - you can buy it in many shops for 150$ or sometimes for 100$. In the future program will support cheap Canable hardware, that costs from 10$ to 20$.
Motor that you want to configure.
Minimal set of hardware that you need to use this program for motors with UART (also possible to test program in demo mode without real hardware):
Programming cable for bafang - you can buy it on Aliexpress for 5$ or in local shops.
Motor that you want to configure.
Also better to have USB isolator, that will protect your computer in case when motor or connection cable is broken and put battery voltage (usually 36V or 48V) on USB connector.
If you use Windows, just launch installation file and wait for the installation process to complete.
Current builds for Linux are portable, so just download the executable and launch it.
Also, if you use Linux, you may need to unblock your serial ports or HID device in some way, dependent on your distribution.
Many Linux distros, such as Ubuntu, blocks direct access to HID device. To fix it, do next things:
- Create file
/etc/udev/rules.d/51-bessttool.rules
(name may be different, but compatible with udev). - Write following content in file (if pid or vid if different on your device, change it in file):
SUBSYSTEM=="input", GROUP="input", MODE="---rw-rw-rw-" SUBSYSTEM=="usb", ATTRS{idVendor}=="0323", ATTRS{idProduct}=="0627", MODE:="rw-rw-rw-", GROUP="plugdev" KERNEL=="hidraw*", ATTRS{idVendor}=="0323", ATTRS{idProduct}=="0627", MODE="---rw-rw-rw-", GROUP="plugdev"
- Execute folowing command:
sudo udevadm control --reload-rules
- Replug your device
Connection error might occur if connecting to the serial port needs elevated privileges (experienced on Fedora 40 and kubuntu 24.04).
- Check device permissions the following command
ls -la /path/to/your/serial/device
$ ls -la /dev/ttyUSB0
crw-rw----. 1 root dialout 188, 0 Jul 9 17:55 /dev/ttyUSB0
- in he case above, device belongs to root, and is accessible to members of group dialout. To access it without elevated privilieges, you need to add your linux user to the dialout group with
sudo usermod -a -G dialout yourusername
. - Reboot your computer to apply changes.
There are docs on each parameter in program or you can use any manual from internet. Here is some examples what you can do with this parameters (some of examples related not to all kind of hardware):
- You can set wheel size when you want to install motor kit on your bike, to show correct speed on display.
- You can change value on odometer on display if you want to replace display on existing bike or install used display on new bike.
- According user reports, some motor modifications starts only after one full pedal rotation - in that case, you can lower parameter "Signal No." to start motor after quarter of rotation or less.
- You can use error codes and diagnostic data from onboard sensors to physically repair your motor.
- Add support of Bafang motors with UART
- Find hardware
- Alpha
- Beta
- Stable
- Add support of Bafang systems with CAN
- Find hardware
- Alpha
- Beta
- Stable
- Add more channgeable parameters
- Add support of Bafang displays with UART
- Add more kinds of executables
- .dmg - MacOS, on Apple Silicon and x86_64
- Flatpak - Linux, x86_64 - in progress
- Add multi-language interface
- Add simple mode for beginners
- Add support of cheap Canable USB-CAN convertrs
You can open issue for request a new feature.
Distributed under the MIT License. See LICENSE.txt
for more information.
Project Link: https://github.com/andrey-pr/OpenBafangTool