SmartESC (aka SESC) is an alternative firmware for Xiaomi M365 and Ninebot G30 controller.
Avantage over other Xiaomi custom firmwares :
- you can put any motor since it can detect all motor parameters and optimize them
- you can use any battery, even 20s (with hardware modifications), change the voltage divider and set the new value in the controller
- you can change the shunts values and set the new value in the controller
- you can setup the controller very easily with VESCTool and make a lot of performance/stability tests
- you can use the controller with any other device, event without any display
- soon, we hope to support multiple linked controller
Cons :
- you loose the ability to monitor M365 BMS for now (work in progress), but don't worry, you still have the voltage ;)
- you loose the ability to update firmwares through bluetooth
- for now, it needs hall sensors (no sensorless mode). [work in progress]
It can interface :
- the stock M365/G30 display
- VESCTool through VESC interface on the BMS UART (full duplex UART).
Nota : this firmware is in beta.
You'll be able to setup and control the controller/motor from VESCTool interface with a simple USB/Serial adapter. With any small arduino, use analog acceleration/brake throttles to control any electic moving device like escooter, gokart, electric skateboard without using the stock display.
Download the latest build for M365 :
If you want to build it manually, for an easier build, you need git
and docker
.
git clone https://github.com/Koxx3/SmartESC_STM32_v2.git
Launch from terminal:
chmod +x docker_build*; ./docker_build_m365.sh
chmod +x docker_build*; ./docker_build_g30.sh
Double click :
docker_build_m365.sh
docker_build_g30.sh
You need a ST-Link device to reprogram the M365/G3O controller. It costs 3/4€ on Aliexpress.
Plug the st-link following this schematic :
With STM32 ST-Link Utility, disable Re&d out protection.
Menu "Target" => "Option bytes"
Use VescTool to setup the motor and input properties.
Use a serial USB adapter to connect the Xiaomi controller as an USB VESC :
Launch VESCTool and connect with COM port.
Enter all your settings in the different windows.
Enable the keyboard control :
You're ready to test your M365 controller with your keyboard !
Use ESP32 prototype board with and ESP32-devkit-c module :
Use the code provided in the serial-trottle-brake-esp32 folder with Platform.io
Can read it in "VESC Terminal" (or others Serial Terminal)
- 0 = MC_NO_ERROR (No error)
- 0= MC_NO_FAULTS (No error)
- 1 = MC_FOC_DURATION (FOC rate to high)
- 2 = MC_OVER_VOLT (Software over voltage)
- 4 = MC_UNDER_VOLT (Software under voltage)
- 8 = MC_OVER_TEMP (Software over temperature)
- 16 = MC_START_UP (Startup failed)
- 32 = MC_SPEED_FDBK (Speed feedback)
- 64 = MC_BREAK_IN (Emergency input (Over current))
- 128 = MC_SW_ERROR
- help (see all available commands)
- foc_openloop [current] [erpm] (Exemple : foc_openloop 10 500)
- ... (lot of other commands)