Simple speed adjustment for my bafang motor using CAN BUS on my Veloretti ace
What do you need:
- Arduino Nano = <5 euro
- MCP 2515 CAN module = 7 euro
- Bafang 6 pin brake cable (Female) = 9 euro or here = 5.57
Connect MCP 2515 and arduino like shown here (no need for power converter, power comes over usb to the arduino and can module):
Connect the brake cable to the MCP 2515 module (H = green cable, L= white cable)
Download the MCP 2515 arduino library and add to the arduino ide as described
Copy code demo in ino file (try reading without writing the speed setting check if read code starts with 82F83203, first characters could be different)
Remove plastic cover from motor with 3 torx screws Connect the cable to the bafang motor (purple connector, bike can be switched on) And plug the arduino with an usb cable into a computer or smartphone (If you want to read the serial output, if you don't want to read the output and just write the new setting a powerbank is fine. I use the app serial monitor on android, adjust the baudrate to 115200) If all is connected correctly, you should see a lot of data passing by in the serial monitor.
If you wait 10 seconds (set in code), the speed will be set to 35km/h
!!! USE AT OWN RISK !!!