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

**URL:** <https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500>\
**Category:** applications\
**Created:** [December 25, 2021, 6:51am UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500 "2021-12-25T06:51:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![casainho](https://community.simplefoc.com/user_avatar/community.simplefoc.com/casainho/32/2130_2.png) [@casainho](https://community.simplefoc.com/u/casainho)\
**Post date:** [December 25, 2021, 6:51am UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/1 "2021-12-25T06:51:10Z")

</div>

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.

 ![image](https://community.simplefoc.com/uploads/default/original/2X/9/9cbf84c163844c7a49d496896739c722c254e078.jpeg)

---

<div class="post-metadata">

**Author:** ![casainho](https://community.simplefoc.com/user_avatar/community.simplefoc.com/casainho/32/2130_2.png) [@casainho](https://community.simplefoc.com/u/casainho)\
**Post date:** [December 25, 2021, 7:02am UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/2 "2021-12-25T07:02:37Z")

</div>

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:

 ![image](https://community.simplefoc.com/uploads/default/original/2X/5/5b8e218fbf3358acb1cf5c79778ded8e17c8b7f2.jpeg)

---

<div class="post-metadata">

**Author:** ![runger](https://community.simplefoc.com/user_avatar/community.simplefoc.com/runger/32/395_2.png) [@runger](https://community.simplefoc.com/u/runger)\
**Post date:** [December 26, 2021, 11:07pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/3 "2021-12-26T23:07:12Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![casainho](https://community.simplefoc.com/user_avatar/community.simplefoc.com/casainho/32/2130_2.png) [@casainho](https://community.simplefoc.com/u/casainho)\
**Post date:** [December 27, 2021, 4:23pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/4 "2021-12-27T16:23:11Z")

</div>

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

 ![Schematic_Casainho_2021-12-27](https://community.simplefoc.com/uploads/default/original/2X/0/057f25ee550057cb5246440dfcfbe45ccc180626.jpeg)

---

<div class="post-metadata">

**Author:** ![casainho](https://community.simplefoc.com/user_avatar/community.simplefoc.com/casainho/32/2130_2.png) [@casainho](https://community.simplefoc.com/u/casainho)\
**Post date:** [December 27, 2021, 4:23pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/5 "2021-12-27T16:23:44Z")

</div>

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/](https://opensourceebike.github.io/)

 ![image](https://community.simplefoc.com/uploads/default/original/2X/d/dcf31333531ff688516d83b6e2f74dae45f28124.jpeg)

---

<div class="post-metadata">

**Author:** ![casainho](https://community.simplefoc.com/user_avatar/community.simplefoc.com/casainho/32/2130_2.png) [@casainho](https://community.simplefoc.com/u/casainho)\
**Post date:** [December 31, 2021, 10:46am UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/6 "2021-12-31T10:46:52Z")

</div>

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/EasyDIY-ESC: EV motor controller with space to have customizable electronics and be easy to repair and build.](https://github.com/EBiCS/EV_Motor_Controller_Customizable_Electronics)

 ![image](https://community.simplefoc.com/uploads/default/original/2X/1/1567170900fedc694cd24dca751eec0a20d2df44.png)

---

<div class="post-metadata">

**Author:** ![happytm](https://community.simplefoc.com/user_avatar/community.simplefoc.com/happytm/32/123_2.png) [@happytm](https://community.simplefoc.com/u/happytm)\
**Post date:** [January 2, 2022, 8:15am UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/7 "2022-01-02T08:15:26Z")

</div>

Waiting for your test results.

---

<div class="post-metadata">

**Author:** ![casainho](https://community.simplefoc.com/user_avatar/community.simplefoc.com/casainho/32/2130_2.png) [@casainho](https://community.simplefoc.com/u/casainho)\
**Post date:** [January 27, 2022, 9:00pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/8 "2022-01-27T21:00:26Z")

</div>

Motor works!!

[![](https://img.youtube.com/vi/NelnB91Vqgw/maxresdefault.jpg "Xiaomi M365 motor, OpenSource customizable motor controller and firmware") ](https://www.youtube.com/watch?v=NelnB91Vqgw)

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:  
[![](https://i.postimg.cc/4xcCH1Dd/expansion-board.jpg)](https://postimg.cc/0z9XL72R)

---

<div class="post-metadata">

**Author:** ![casainho](https://community.simplefoc.com/user_avatar/community.simplefoc.com/casainho/32/2130_2.png) [@casainho](https://community.simplefoc.com/u/casainho)\
**Post date:** [January 27, 2022, 9:01pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/9 "2022-01-27T21:01:09Z")

</div>

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 🙂  
[![](https://i.postimg.cc/s2CkYhzJ/03.jpg)](https://postimg.cc/87wXDsjF)

---

<div class="post-metadata">

**Author:** ![Valentine](https://community.simplefoc.com/user_avatar/community.simplefoc.com/valentine/32/1024_2.png) [@Valentine](https://community.simplefoc.com/u/Valentine)\
**Post date:** [January 27, 2022, 9:09pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/10 "2022-01-27T21:09:44Z")

</div>

> [@casainho](#):
>
> short circuit on the PWM pins at the mosfet driver and the STM32F103 did burn

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

---

<div class="post-metadata">

**Author:** ![casainho](https://community.simplefoc.com/user_avatar/community.simplefoc.com/casainho/32/2130_2.png) [@casainho](https://community.simplefoc.com/u/casainho)\
**Post date:** [January 27, 2022, 9:14pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/11 "2022-01-27T21:14:25Z")

</div>

The motor controller source files are on this repository:

[https://github.com/EBiCS/EV\_Motor\_Controller\_Customizable\_Electronics](https://github.com/EBiCS/EV_Motor_Controller_Customizable_Electronics)

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??

[https://github.com/EBiCS/EBiCS\_motor\_FOC](https://github.com/EBiCS/EBiCS_motor_FOC)

---

<div class="post-metadata">

**Author:** ![Juan-Antonio\_Soren\_E](https://community.simplefoc.com/user_avatar/community.simplefoc.com/juan-antonio_soren_e/32/9969_2.png) [@Juan-Antonio\_Soren\_E](https://community.simplefoc.com/u/Juan-Antonio_Soren_E)\
**Post date:** [January 28, 2022, 2:03pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/12 "2022-01-28T14:03:28Z")

</div>

😃 Burning means learning !

---

<div class="post-metadata">

**Author:** ![Valentine](https://community.simplefoc.com/user_avatar/community.simplefoc.com/valentine/32/1024_2.png) [@Valentine](https://community.simplefoc.com/u/Valentine)\
**Post date:** [January 28, 2022, 7:01pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/13 "2022-01-28T19:01:49Z")

</div>

> [@Juan-Antonio\_Soren\_E](#):
>
> Burning means learning

If you survive the burns.

---

<div class="post-metadata">

**Author:** ![happytm](https://community.simplefoc.com/user_avatar/community.simplefoc.com/happytm/32/123_2.png) [@happytm](https://community.simplefoc.com/u/happytm)\
**Post date:** [January 29, 2022, 2:21am UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/14 "2022-01-29T02:21:19Z")

</div>

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

Thanks.

---

<div class="post-metadata">

**Author:** ![Antun\_Skuric](https://community.simplefoc.com/user_avatar/community.simplefoc.com/antun_skuric/32/21_2.png) [@Antun\_Skuric](https://community.simplefoc.com/u/Antun_Skuric)\
**Post date:** [January 29, 2022, 10:01am UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/15 "2022-01-29T10:01:01Z")

</div>

Very nice job on the code! 😃

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?

---

<div class="post-metadata">

**Author:** ![casainho](https://community.simplefoc.com/user_avatar/community.simplefoc.com/casainho/32/2130_2.png) [@casainho](https://community.simplefoc.com/u/casainho)\
**Post date:** [January 29, 2022, 11:11am UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/16 "2022-01-29T11:11:44Z")

</div>

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:

[![](https://img.youtube.com/vi/ueGZx3Urf0c/maxresdefault.jpg "TSDZ2 EBike mid drive motor, driving by our OpenSource FOC firmware") ](https://www.youtube.com/watch?v=ueGZx3Urf0c)

---

<div class="post-metadata">

**Author:** ![happytm](https://community.simplefoc.com/user_avatar/community.simplefoc.com/happytm/32/123_2.png) [@happytm](https://community.simplefoc.com/u/happytm)\
**Post date:** [March 20, 2022, 11:52pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/17 "2022-03-20T23:52:32Z")

</div>

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

Thanks.

---

<div class="post-metadata">

**Author:** ![casainho](https://community.simplefoc.com/user_avatar/community.simplefoc.com/casainho/32/2130_2.png) [@casainho](https://community.simplefoc.com/u/casainho)\
**Post date:** [March 21, 2022, 12:10pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/18 "2022-03-21T12:10:24Z")

</div>

Hi.

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.](https://github.com/EBiCS/EasyDIY-ESC)

 ![image](https://community.simplefoc.com/uploads/default/original/2X/8/8d5b59c80acbb8e040c8ba9d559dea09c183b0e3.png)

 ![image](https://community.simplefoc.com/uploads/default/original/2X/f/fdc0afbbff6f042925ec1da6b54fa7d437e201c4.png)

---

<div class="post-metadata">

**Author:** ![casainho](https://community.simplefoc.com/user_avatar/community.simplefoc.com/casainho/32/2130_2.png) [@casainho](https://community.simplefoc.com/u/casainho)\
**Post date:** [April 5, 2022, 12:00pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/19 "2022-04-05T12:00:50Z")

</div>

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.](https://github.com/EBiCS/EasyDIY-ESC)  
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!!

 ![image](https://community.simplefoc.com/uploads/default/original/2X/9/9c9c8fe34ba5cd6f1db2baaae594db19ecd821b8.jpeg)

 ![image](https://community.simplefoc.com/uploads/default/original/2X/5/5d2d57f2202ee24724e2af8e536dc09425866f28.jpeg)

 ![image](https://community.simplefoc.com/uploads/default/original/2X/6/6a3ad13365dad01a1fce8f58fa88234ad1fc40ee.jpeg)

---

<div class="post-metadata">

**Author:** ![Geronimo](https://community.simplefoc.com/letter_avatar_proxy/v4/letter/g/ea666f/32.png) [@Geronimo](https://community.simplefoc.com/u/Geronimo)\
**Post date:** [April 7, 2022, 10:48pm UTC](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500/20 "2022-04-07T22:48:37Z")

</div>

does it support regenerative braking?

[Next page](https://community.simplefoc.com/t/ebike-escooter-motor-controller-easy-to-diy-build-and-repair-with-room-for-custom-electronics-board/1500.md?page=2)
