EBike / EScooter motor controller, easy to DIY build and repair, with room for custom electronics board

We are developing an EBike / EScooter motor controller that have some important advantages:

  1. Easy to build and repair as DIY: no fine pitch components as like a STM32 microcontroller. The resistors and capacitors are 0805. The ICs are SOIC8 and SOIC14. This means it can be easily soldered at home.

  2. Header for custom electronics board: can be other board, maybe one perforated board with some simple electronics for instance to add CAN communications, 2x UARTS: full duplex or half duplex; specific circuit for EBikes torque sensors; SPI or I2C for cheap popular OLED displays; add a Bluetooth module; add NRF52 board with EBike ANT+ LEV wireless standard, etc.

  3. Microcontroller on Bluepill or Blackpill board, meaning easy to support Arduino SimpleFOC on STM32F103 or even more powerful STM32F411 at 100 MHz.

  4. This motor controller follows some original Arduino concepts: easy to build as DIY at home + easy to build different projects (thanks to shields) – so this is in fact a kind of Arduino of EBike / EScooter motor controller.

I really hope I will reuse this motor controller on different devices, since I own EBikes and EScooters and I am being developing OpenSource firmware for it over the last 5 years.


Forgot to mention, the Bluepill / Blackpill board will be moved to left side so the USB port will be available for direct connection to PC. This is really important to send debug data / plot data and configurations on software like VESC tool.

For the ones wanting higher processing power and USB C connection, the Blackpill is the one to go over the old Bluepill:

1 Like

Hey @casainho , very nice project!

May I ask, what’s U6?

I like your idea to make it easy to repair, that’s a good concept!

U6 is a 72V → 12V DC-DC, STH0548S12, see here the schematic:


And that DC-DC is already well tested on our EV display, also OpenSource, DIY and simple to build and repair: https://opensourceebike.github.io/

Boards went to production and I just created the repository with source files for the motor controller as also the project README notes: GitHub - EBiCS/EV_Motor_Controller_Customizable_Electronics: EV motor controller with space to have customizable electronics and be easy to repair and build.


Waiting for your test results.

Motor works!!

And here is my custom electronics board, quickly made with a perforated board. Added a button to execute the motor autodetection and two 0805 resistors to adapt the throttle 5V signal to the 3.3V scale:


I assembled the board and I was also adapting and cleaning the motor firmware, and while using the oscilloscope for debugging, I did a short circuit on the PWM pins at the mosfet driver and the STM32F103 did burn - it was quick to repair, just removed the Bluepill with the burned STM32F103 and used a new one :slight_smile:

1 Like

Please do not hurt yourself. Hopefully you are using protection gear and safe practices.

The motor controller source files are on this repository:

And the firmware on this repository - it is not SimpleFOC, but it is simple code for FOC anyway, written from scratch, no dependencies of ST tools for instance. Who knows if someone will adopt this DIY easy to build motor controller, with room for custom electronics / expansion header, and make a SimpleFOC firmware for it??

1 Like

:smiley: Burning means learning !

If you survive the burns.

How much is the cost of each board excluding bluepill? Sounds like part you used are very inexpensive.


Very nice job on the code! :smiley:

We will try to inspire from your low-side sensing solution once when we get to it, at least for the stm32f1 family.

Did you implement sensorless as well or you’re using the hall sensors?

There is a branch with sensorless but I am using only the hall sensors.

Here is our firmware running on M365 EScooter motor controller but driving the EBike mid drive TSDZ2:


@casainho Did you get it to compile & run with SimpleFOC ?



There are no news about SimpleFOC on this hardware. the only news is a new board version, this time much smaller but still being DIY!!
There are some tricks on the board, like putting a DC-DC on top of the other and the expansion board header directly on top of the Bluepill headers!!

On firmware side, there were some little advances to make easy for user to customized the pins used by the motor controller hardware, but basically is the same.

Let’s see if we get a good hardware to attract new firmware developers, that may implement SimpleFOC for it.

Here the repository: GitHub - EBiCS/EasyDIY-ESC: EV motor controller with space to have customizable electronics and be easy to repair and build.


Not yet fully assembled because of missing components that are now on order.

The project name is now: EasyDIY ESC: GitHub - EBiCS/EasyDIY-ESC: EV motor controller with space to have customizable electronics and be easy to repair and build.
Easy and DIY, just like the original concept of Arduino.

The perforated board is the board for expansion / custom electronics.

The SMD components of 0805 size and placed all on the bottom, makes easy to be assembled!!


does it support regenerative braking?