Xiaomi M365: VESC + modular DIY OpenSource electronics and software

casainho

10 GW
Joined
Feb 14, 2011
Messages
6,045
I decided to unlock my Xiaomi Pro 2, by using the popular VESC motor controller. Also I added my EScooter DIY simple board to interface with M365 specific sensors, and it runs the firmware that implements the EScooter logic.
You can see the project page with my all technical build notes: OpenSourceEBike.github.io



I did this build with my Xiaomi M365 Pro 2.
As a complement, see my Build with Bafang M500 mid drive motor that has a more detailed notes.
I bought all the components on Aliexpress (VESC motor controller, ESP32 board, connectors, wires, etc).
This is the logic sequence I did for the build:
  1. Connect the VESC to the motor, make the motor rotate and configure the VESC.
  2. Build the EScooter board, connect to the VESC, to the Xaomi M365 dash board and rear lights.
  3. Do the final installation, protect the various cables and protect the connections to make sure they do not get loose or break.

VESC Motor controller​

The main task of VESC Motor controller is to drive the motor, make it rotate with motor current / torque, specified by the EBike board software.
The VESC motor controller I use is the FLIPSKY 75100.

It is a cheap VESC and fit well inside the Xiaomi M365.
I started to connect this VESC to the motor 3 phase wires. Then I connected to the Xiaomi M365 battery. Finally I connected the VESC to my PC using a USB cable (later I installed the VESC Bluetooth module on UART2 port and so the USB connection is not needed anymore).
On the VESC tool software, I did the motor auto detection, the first motor run and the final configurations – see the details on the pictures inside the VESC_configurations folder page.

EScooter board​

The DIY EScooter board task is to run the EScooter software application. This software is high level Pyhton (easy and fast to develop) and we can edit/program the Pyhton software text files wirelessly, using our phone or computer.
The EScooter application reads the throttle, maps the throttle value to a motor speed, and finally send this value to VESC motor controller, that will make the motor rotate with this specific speed. It also sends and receives data to the display: receives the brake sensor position and on/off button state. Sends various data as the speed, front light state, etc. Also controls the rear light state.


See all the details on the Build EScooter board page.

Final installation​

The final instalation were done only when I had tested almost all the system. For instance, when building the EBike/EScooter board, I tested the sensors one at a time, so when I did the final installation I was sure they were working.
I had a great care, by using a multimeter to tripple check every wire connection and voltages.
Showing everything connected - the EScooter board is protected with yellow kapton tape:

Everything in final place.

In the end I put tape on all the connectors and cables to make sure they do not get disconnected or brake. I also added some foam for extra protection.

ON/OFF switch​

The quickest and cheap way I found, was to use a “loop key”.
I bought the a pair of XT90 Amass connector that is anti-spark (this is a must!!) and then I connect the battery negative in series with this connector. So, everytime I want to ride my Xiaomi M365, I will connect the “loop key” and I remove the “loop key” when I finish my ride.
The loop key on my Xiaomi M365 Pro 2:

There are other solutions, like a dedicated Anti-spart ON/OFF switch, that could be controlled by the ESCooter board.
 
Last edited:
I just finalized the installation and my technical notes. Everything works well as expected. Now my Xiaomi M365 is unlockled, has higher speed and higher torque. See the pictures and details on the previous message.
 
I am now adding an extra display to show data that the original display can not, like the battery voltage and motor power. It will also have a remote with 3 buttons, so I will be able quick increase the motor power and speed, using my left thumb finger, without removing the hand from the handlebar.

The communication is wireless with the EScooter board, it only needs to solder 2 wires to the dashboard: 5V and GND. So this display will be optional. Both the data and the control it permits, will be an extra feature.

Prototype:

1682529138515.png
 
Did your flipsky perform well?

I'm doing something similar with my Pro 2 clone awd. Front motor is stock with factory clone controller+ dashboard and 36v battery in deck. Rear motor is a 350w copy where I'll be using Flipsky 75100 with 52v External battery. I will use the Bluetooth module to connect with vesc mobile app on my phone as display. Independent throttles for Front and Rear drives as I like the autonomy it gives.
 
Last edited:
Back
Top