New free Open Source Firmware for Xiaomi M365 Scooter available

Lightweight / Folding / Portable EVs - seats optional
User avatar
stancecoke   1 MW

1 MW
Posts: 1596
Joined: Aug 02 2017 2:56pm

New free Open Source Firmware for Xiaomi M365 Scooter available

Post by stancecoke » Dec 28 2021 1:28pm

In the Scooter community the hacked firmware for the M365 is very popular. You'll find it with very few searching on the internet.

We have developed our own firmware now, that is based on the EBiCS project, not on the (hacked) original firmware.

Our firmware can be flashed over the air by Bluetooth, just like the hacked one. It's tested with downG from the android play store.

It is still in beta-stadium, but it works pretty good already. Everything you do with it, is on your own risk ;-)

Features:
- individual current and speed settings for the modes ECO, normal and sport
- linear regen with the brake lever
- flux weakening in sport mode for higher speed
- ....

Still missing:
communication with the original battery

For the "how to" see the README at github:
https://github.com/Koxx3/SmartESC_STM32_v3



There is a parallel project, that uses the code from the ST Motor Control Workbench and can be set up by the VESC Tool. Very fancy too! 8)
https://github.com/Koxx3/SmartESC_STM32_v2

regards
stancecoke

casainho   100 GW

100 GW
Posts: 5777
Joined: Feb 14 2011 2:43pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by casainho » Jan 04 2022 4:10am

YES!!

I am being testing this firmware but not yet riding with it. It seems good and I am very confident with it since I understand well the source code. I am still riding with the "hacked" original firmware and I have some issues that I hate, I hope to start soon riding with this our OpenSource firmware.

And thanks to this M365 OpenSource firmware, I plan to develop an extended version, where I will add to the original dashboard, a small 0.96 inches OLED display and external remote buttons. With this I will be able to quick increase / decrease the max speed as also the motor torque / current, as this is the most features I fell the need while riding my M365, because I can not control very well the speed it is locked on cruise control, usually I can only lock at max speed that is about 35km/h which is to much fast sometimes and I want to be able to reduce it.

With this display and remote buttons, I will also implement a configurations menu, so all scooter configurations for motor, battery and the display itself, will be done directly on the display.
And things like seeing in real time the battery voltage or the motor power, will be possible with this display.

In fact, the display and his firmware, are already developed and I use on my EBikes, running our OpenSource firmware: https://opensourceebike.github.io/

Image
- TSDZ2 and OpenSource EV display: 128x64 OLED display, easy to build as DIY, Bluetooth and ANT, OTA wireless updates, easy to repair and customize for other EVs.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: OpenSource EV display, Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays.

User avatar
pinkflozd   1 µW

1 µW
Posts: 3
Joined: Sep 02 2015 3:49am

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by pinkflozd » Jan 08 2022 10:01am

Exciting!! I got a M365 PRO with PRO dashboard BLE090. Can it work with it?
I have a 14S setup. Should i change anything in config.h for that? CAL_V? CAL_I?

User avatar
stancecoke   1 MW

1 MW
Posts: 1596
Joined: Aug 02 2017 2:56pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by stancecoke » Jan 08 2022 11:40am

pinkflozd wrote:
Jan 08 2022 10:01am
I have a 14S setup
First, thank you for your interest!
Are the 14S a mod, or do they come with this battery from factory?
You have to change the voltage limits for 14s, they are hardcoded for 10s at the moment:
https://github.com/Koxx3/SmartESC_STM32 ... ard.c#L221

I don't know, if there are differences in the calibration factors or in other things like UART protocol. Just try it (on your on risk of course!)... :-)

regards
stancecoke

User avatar
pinkflozd   1 µW

1 µW
Posts: 3
Joined: Sep 02 2015 3:49am

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by pinkflozd » Jan 08 2022 12:38pm

stancecoke wrote:
Jan 08 2022 11:40am
Are the 14S a mod, or do they come with this battery from factory?
It's a custom 14s6p battery with an extender on my m365 pro + modded controller with 100V caps and thicker traces

Goin to try it, gonna first order a stlink just in case

User avatar
stancecoke   1 MW

1 MW
Posts: 1596
Joined: Aug 02 2017 2:56pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by stancecoke » Jan 09 2022 2:53pm

Small update: You can flash our firmware with no use of a laptop or PC now. All can be done by your mobile phone. See the updated readme:
https://github.com/Koxx3/SmartESC_STM32 ... /README.md

regards
stancecoke

Paulflieg   10 W

10 W
Posts: 98
Joined: Jan 11 2019 10:30am

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by Paulflieg » Jan 14 2022 4:41am

stancecoke wrote:
Jan 09 2022 2:53pm
Small update: You can flash our firmware with no use of a laptop or PC now. All can be done by your mobile phone. See the updated readme:
https://github.com/Koxx3/SmartESC_STM32 ... /README.md

regards
stancecoke

Hmm, with the smartphone....?
But the zip file has to be generated first?
I already fail with the "fork icon" where should it be?

User avatar
stancecoke   1 MW

1 MW
Posts: 1596
Joined: Aug 02 2017 2:56pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by stancecoke » Jan 14 2022 9:28am

Paulflieg wrote:
Jan 14 2022 4:41am
I already fail with the "fork icon" where should it be?
You have to turn your phone to landscape orientation, then you'll see.
I'm preparing a YouTube tutorial actually, maybe there will be a first version during the weekend :idea:

regards
stancecoke

Paulflieg   10 W

10 W
Posts: 98
Joined: Jan 11 2019 10:30am

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by Paulflieg » Jan 14 2022 12:58pm

stancecoke wrote:
Jan 14 2022 9:28am
Paulflieg wrote:
Jan 14 2022 4:41am
I already fail with the "fork icon" where should it be?
You have to turn your phone to landscape orientation, then you'll see.
I'm preparing a YouTube tutorial actually, maybe there will be a first version during the weekend :idea:

regards
stancecoke
Hmm??
Attachments
IMG_20220114_185239.jpg
Fork
IMG_20220114_185239.jpg (3.33 MiB) Viewed 2207 times

casainho   100 GW

100 GW
Posts: 5777
Joined: Feb 14 2011 2:43pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by casainho » Jan 14 2022 1:02pm

Paulflieg wrote:
Jan 14 2022 12:58pm
stancecoke wrote:
Jan 14 2022 9:28am
Paulflieg wrote:
Jan 14 2022 4:41am
I already fail with the "fork icon" where should it be?
You have to turn your phone to landscape orientation, then you'll see.
I'm preparing a YouTube tutorial actually, maybe there will be a first version during the weekend :idea:

regards
stancecoke
Hmm??
Hi.

Unfortunately the current code has an issue and does not run the motor well. I am testing it and I hope l, with the help of Stancecoke, to make it working. Once it works, we will write a message here and we can also uploaded the firmware of that version so anyone can try.
- TSDZ2 and OpenSource EV display: 128x64 OLED display, easy to build as DIY, Bluetooth and ANT, OTA wireless updates, easy to repair and customize for other EVs.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: OpenSource EV display, Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays.

User avatar
stancecoke   1 MW

1 MW
Posts: 1596
Joined: Aug 02 2017 2:56pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by stancecoke » Jan 15 2022 4:34am

Paulflieg wrote:
Jan 14 2022 12:58pm
Hmm??
You have already forked our repo successfully and you are in your own fork now. You can't fork your own fork, as it is already there ;-)
Forks on 2022_01_15.PNG
Forks on 2022_01_15.PNG (12.35 KiB) Viewed 2192 times
regards
stancecoke

SlowCo   10 MW

10 MW
Posts: 2110
Joined: Jan 05 2015 5:43pm
Location: The Netherlands

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by SlowCo » Jan 15 2022 7:22am

Great work people :thumb:

User avatar
stancecoke   1 MW

1 MW
Posts: 1596
Joined: Aug 02 2017 2:56pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by stancecoke » Jan 15 2022 10:46am

I've just published a small tutorial at github. Everything is still in beta-stadium.
Everything you do, is on your own risk.



regards
stancecoke

casainho   100 GW

100 GW
Posts: 5777
Joined: Feb 14 2011 2:43pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by casainho » Jan 15 2022 10:51am

stancecoke wrote:
Jan 15 2022 10:46am
I've just published a small tutorial at github. Everything is still in beta-stadium.
Everything you do, is on your own risk.
I tested on first and second mode only. I didn't test on the third mode because it uses field weakening and I am afraid it can fail...

There is still a small issue, sometimes there is a strong noise and vibration of the motor, but it is for very short time - it is present at least 2 times on the next video, but hard to spot.

Here is my testing:

- TSDZ2 and OpenSource EV display: 128x64 OLED display, easy to build as DIY, Bluetooth and ANT, OTA wireless updates, easy to repair and customize for other EVs.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: OpenSource EV display, Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays.

User avatar
stancecoke   1 MW

1 MW
Posts: 1596
Joined: Aug 02 2017 2:56pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by stancecoke » Jan 26 2022 1:33am

casainho wrote:
Jan 14 2022 1:02pm
Unfortunately the current code has an issue and does not run the motor well
We fixed the issues now, but had no chance to do longer test rides yet, due to snow in Northern Europe :-)

regards
stancecoke

frenchie   100 mW

100 mW
Posts: 45
Joined: Dec 24 2019 1:22pm
Location: France, cos UK sucks 8-)

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by frenchie » Jan 27 2022 2:28pm

cool project guys congrats
can you really do 35km/h on it? how about bigger wheels? not sure I'd fancy that speed with those small ones lol

User avatar
stancecoke   1 MW

1 MW
Posts: 1596
Joined: Aug 02 2017 2:56pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by stancecoke » Jan 28 2022 6:47am

frenchie wrote:
Jan 27 2022 2:28pm
can you really do 35km/h on it?
We don't know yet :wink:
Nobody tried the flux weakening function on the road yet. With the wheel in the air, more than 60kph are no problem.

I don't own a M365 scooter, I'm testing only on my teststand with a Shengyi middrive or a BionX Direct drive or a small hoverboard motor.

We are looking for a brave guy who will test sport mode and report😉

regards
stancecoke

casainho   100 GW

100 GW
Posts: 5777
Joined: Feb 14 2011 2:43pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by casainho » Jan 28 2022 7:08am

frenchie wrote:
Jan 27 2022 2:28pm
cool project guys congrats
can you really do 35km/h on it? how about bigger wheels? not sure I'd fancy that speed with those small ones lol
I am not yet using our OpenSource firmware, but I am using the hacked firmware and I installed the 10 inches tires, and on my M365 Pro 2, on flats, I can get at 35km/h when the battery is over 70% charged.

By the way, I am also working on our DIY, customizable, easy to to build and repair motor controller, running our OpenSource firmware. Here is it driving a M365 motor:



I am being cleaning up the code and doing reorganization, and now the specific motor control code lives on his own repository here: https://github.com/EBiCS/EBiCS_motor_FOC while the M365 specific code will be kept on the same repository.

Next I will focus on developing and testing the M365 code, as I wish to start riding with it soon.


Image
- TSDZ2 and OpenSource EV display: 128x64 OLED display, easy to build as DIY, Bluetooth and ANT, OTA wireless updates, easy to repair and customize for other EVs.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: OpenSource EV display, Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays.

barthchris   1 mW

1 mW
Posts: 10
Joined: Jan 25 2022 6:22pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by barthchris » Jan 30 2022 7:35pm

frenchie wrote:
Jan 27 2022 2:28pm
cool project guys congrats
can you really do 35km/h on it? how about bigger wheels? not sure I'd fancy that speed with those small ones lol
Im using a VESC based Flipsky 75100 FOC ESC powered by 14s6P on a Ninebot Max I get 24mph or 38.6kph all day long.

The torque is incredible and will get me up to speed in seconds. Its super fun and has turned the Max into a beast. I haven't even come close to running out of range, I've never tested it but I can say scooting around aggressively on flat terrain with full throttle used except for stopping and starting I will use about 5000mAh after a 10 miles/16km ride. My pack's capacity is 19,200mAh. I could probably do an aggressive 30miles or 48km comfortably.

This firmware on the stock controller should give similar performance if not better if field weakening (FW)is enabled. From what I gathered FW does consume more power so range will probably be affected but probably not much if used as a "turbo mode". That said I could be wrong as I haven't experimented with field weakening on the FS 75100 FOC yet.

I tried but could not get faster with the stock 10s pack. I worked my way up from 10s to 12s, 13s until 14s where I felt satisfied. I dont think my scooter has a 2nd gen motor on it as its an older ex rental from Lyft. Supposedly the Gen 2 motors have a bit more grunt to them so its possible the scooter could be faster if in fact my motor is a 1st gen version.

BTW Im totally comfortable with the stock 10" wheels at full throttle. In fact, Im sorta craving more speed. Lol!

Im totally interested in trying this firmware on the stock controllers. I have several lying around and if I would have saw this project earlier I could have saved myself several hundred $$!

Hats off to the developers that have the skill and imagination to make this a reality. If it works as well as I think it will it is a total gamechanger for scooters. Im not overstating this either, its a really big deal!

Question for the developer. Do you think this will work on the controller for the Ninebot SNSC 2.3 Max Pro. The 2.3 is a commercial/rental only version. The controller should be similar but its a different form factor. I guess there only one way to find out but it would be comforting if it was confirmed.

User avatar
stancecoke   1 MW

1 MW
Posts: 1596
Joined: Aug 02 2017 2:56pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by stancecoke » Jan 31 2022 4:12am

barthchris wrote:
Jan 30 2022 7:35pm
Question for the developer. Do you think this will work on the controller for the Ninebot SNSC 2.3 Max Pro. The 2.3 is a commercial/rental only version. The controller should be similar but its a different form factor. I guess there only one way to find out but it would be comforting if it was confirmed.
I don't know, if the schematic is exactly the same, we know the processor pinout for the M365 and for the G30 yet. You would have to reengineer the schematic, if no one have done it yet.

regards
stancecoke

Image

frenchie   100 mW

100 mW
Posts: 45
Joined: Dec 24 2019 1:22pm
Location: France, cos UK sucks 8-)

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by frenchie » Jan 31 2022 4:16am

barthchris wrote:
Jan 30 2022 7:35pm
powered by 14s6P on a Ninebot Max I get 24mph or 38.6kph all day long.
sounds v.cool congrats!
that's a big battery pack, where is it attached?

barthchris   1 mW

1 mW
Posts: 10
Joined: Jan 25 2022 6:22pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by barthchris » Feb 12 2022 6:04pm

frenchie wrote:
Jan 31 2022 4:16am
barthchris wrote:
Jan 30 2022 7:35pm
powered by 14s6P on a Ninebot Max I get 24mph or 38.6kph all day long.
sounds v.cool congrats!
that's a big battery pack, where is it attached?
Sorry, just saw this. Its totally contained under the deck. I removed the stock ESC, the stock battery charger(yes, they incorporated a small 10s 2.8A AC charger into the scooter.) At first I used the stock 10 battery pack and a DIY 4s6P pack with JST balance leads. I charged the 10s pack and the 4s pack separately. Everything was a tight fit but worked well.

I recently decided to build a 14s4p pack out of molicel p42a 21700 cells. I removed the stock battery and have plenty of room to spare. Actually there is so much room to spare Im considering purchasing 28 more cells. This will give me a 25,200mAh 14s6p pack :warn: :o :shock:! Since I dont have a BMS I configured it as two 7s packs connected in series for a 14s pack. Each has its own 7s JST balance leads, Charge both packs in parallel with a Charger 1030 RC charger. Works great! Cells dont even get warm after aggressive riding. I added a small voltmeter to avoid getting anywhere near 3V per cell which is not going to happen unless I forget to remove my ghetto loop key and leave the scooter powered on for a week or so. I havent dropped below 3.8V per cell at the end of my longest ride.
Last edited by barthchris on Feb 12 2022 6:33pm, edited 2 times in total.

barthchris   1 mW

1 mW
Posts: 10
Joined: Jan 25 2022 6:22pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by barthchris » Feb 12 2022 6:21pm

So, I was able to find my stash of ninebot G30 controllers. PCB is potted in clear silicone gel, will be easy to pick off to expose the SWD pads. The only concern is the 63V cap. I'd like to use this with 14s (60.2V fully charged). Even with regen possibly exceeding 63V at 14s Im not super concerned about the cap at that voltage but Im assuming the cap will need to be changed if used with higher voltages?


Sorry if I missed it. Are there any resources beyond Github for this project? I have everything needed to do this. Im definitely no pro, but with my various hobbies Im no stranger to flashing microcontrollers including ST32 via a ST linker V2.

barthchris   1 mW

1 mW
Posts: 10
Joined: Jan 25 2022 6:22pm

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by barthchris » Feb 12 2022 7:37pm

stancecoke wrote:
Jan 31 2022 4:12am
barthchris wrote:
Jan 30 2022 7:35pm
Question for the developer. Do you think this will work on the controller for the Ninebot SNSC 2.3 Max Pro. The 2.3 is a commercial/rental only version. The controller should be similar but its a different form factor. I guess there only one way to find out but it would be comforting if it was confirmed.
I don't know, if the schematic is exactly the same, we know the processor pinout for the M365 and for the G30 yet. You would have to reengineer the schematic, if no one have done it yet.

regards
stancecoke

Image
Thank you for showing the ST32 pin out differences between the Xiaomi M365 vs ninebots G30. Not going to be as plug and play as I anticipated. Wish I has the skills to make the necessary changes :cry: ! Totally understand the hardware side of things but no experience with software changes other than tweaking a few commits even though I have almost 30yrs of experience as an industrial electrician/electronics tech.

Im confident that someone with the necessary skills will come along given the G30s similarity and popularity.

djuke   1 µW

1 µW
Posts: 3
Joined: Feb 16 2022 3:59am

Re: New free Open Source Firmware for Xiaomi M365 Scooter available

Post by djuke » Feb 16 2022 4:18am

Great work! I am in the process of designing a prototype of a small go-kart like automated vehicle and selected the M365 ESC and motor as a candidate for the dual motor drive line and ordered the components separately (without the e-scooter). Then I found these open source firmware projects which seem just what I was looking for. I tried cloning the V3 repo, created the zip file, but was unable to update the firmware. DownG connected to my BLE but complains that it could not get scooter information. Did I miss something? Is there another way to update the firmware?

Alternatively, I could also use the V2 repo. In the end I would like to use it without the BLE, by providing velocity (or better torque) setpoints to the two ESCs through the UART connector from my own custom controller. Btw, after flashing with STlink is there a way to restore the original firmware (with bootloader) again?

Please advise which firmware (V2 or V3) can best be used.

Post Reply