You are here

EScooter Xiaomi M365: VESC + DIY ESP32 board running Pyhton firmware

2 posts / 0 new
Last post
Last seen: 4 months 1 week ago
Joined: 2020-05-28 18:15
Posts: 6
EScooter Xiaomi M365: VESC + DIY ESP32 board running Pyhton firmware

I decided to unlock my Xiaomi Pro 2, by using the popular VESC motor controller platform. 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:

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 (ESC motor controller, ESP32 board, connectors, wires, etc).

This is the logic sequence I did for the build:

  1. Connect the ESC to the motor, make the motor rotate and configure the ESC.
  2. Build the EScooter board, connect to the ESC, 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.

Motor controller

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

The motor controller I use is the FLIPSKY 75100.

It is a cheap ESC and fit well inside the Xiaomi M365.

I started to connect this ESC to the motor 3 phase wires. Then I connected to the Xiaomi M365 battery. Finally I connected the ESC to my PC using a USB cable (later I installed the 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 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 (VESC) Anti-spart ON/OFF switch, that could be controlled by the ESCooter board.

Last seen: 3 weeks 5 days ago
Joined: 2023-10-24 15:43
Posts: 1

Perhaps you can try this project and connect XIAOMI directly with VESC