Self balancing robot with esc

Hello everyone, I want to build a Self-Balancing Robot myself. The SimpleFOC Shield seems really good for this project, but I want to do it from scratch with my own code. I want to ask if an ESC is enough for controlling my motor? I’m not sure specifically which materials to buy, but generally, I’ll need 2 brushless DC motors, 1 STM32 board, 1 IMU sensor, and if necessary, magnetic encoders, and if it’s feasible to use them without issues, 2 ESCs, which you can think of as those used in drones. Thank you in advance.

Hello @metehany and welcome to the SimpleFOC community!

To clarify:

  1. You do not want to use the the SimpleFOC library. You want to code your own from scratch.
  2. You want to use one STM32 board and an accelerometer/gyro (what you call IMU).
  3. You want to use two drone ESCs.
  4. You want to use magnetic encoders (if needed).
  5. You want to use two motors.

If my understanding is correct, this is a very ambitious and lofty educational goal. Let’s hear what others have to say.


Thank you for your response, yes, you understood very clearly. I have about 8 months to complete this project, and it will be my graduate thesis. I have concerns about using an ESC in this project because I’m not sure if it’s working properly. I

  1. This board is for SimpleFOC library related questions and topics of discussion. You may get some very limited feedback and support for your own code which has nothing to do with most topics discussed here.
  2. Using an off-shelf drone ESC for sensored Simple FOC or even your own code for such a project is impossible for many reasons I will not discuss here.
  3. You will need absolute angle encoders, yes, and the accelerometer/gyro with an STM board.
  4. You will need two motors you need to sensor with the absolute angle sensors.

As I mentioned this is a very ambitious project. I very strongly recommend you also find other places to look for support, such as:

and whatever else you can find.

Good luck with your graduate project.



As a backup solution to your graduate thesis, I very, and I mean, VERY VERY strongly recommend you implement your design with SimpleFOC first, at least you will have a working solution if your own code effort fails.

First build the hardware and implement SimpleFOC balancing, then write your own code. I guarantee in 8 months you will barely be able to put together the hardware, let alone write the code from scratch.


Hey @metehany , SimpleFOC requires direct control of the motor phases so you can’t normally use an ESC with it, you need a driver which accepts 3-PWM or 6-PWM control inputs.

But if you’re writing your own code you can control the motors without field oriented control using an ESC.

But you still can’t use a drone ESC :slight_smile: … they only turn the motor in one direction :slight_smile: you’d have to use an ESC for cars or robots which can do bidirectional control…

Hypothetically speaking, you could re-program an off-shelf drone ESC with SimpleFOC. I’ve done it, however this requires reverse engineering the specific ESC, which is an expertise way outside the hobby lab. Surprisingly enough, certain drone ESCs use 6PWM pinouts on timers with MCUs fully supported by SimpleFOC. I did that as part of my hardware bemf SimpleFOC effort as a proof of concept.

Which means, he has to re-program the ESCs first, pull lines for the hall sensors out, then program the central MCU controlling the ESC boards.


At some point when I get time I will post a full step by step tutorial on loading SimpleFOC on drone ESCs whith MCUs and pinouts supported by SimpleFOC. I’m super busy so it may take a month or more.