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:
- You do not want to use the the SimpleFOC library. You want to code your own from scratch.
- You want to use one STM32 board and an accelerometer/gyro (what you call IMU).
- You want to use two drone ESCs.
- You want to use magnetic encoders (if needed).
- 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.
Cheers,
Valentine
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
- 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.
- 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.
- You will need absolute angle encoders, yes, and the accelerometer/gyro with an STM board.
- 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.
Cheers,
Valentine
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.
Cheers,
Valentine
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 … they only turn the motor in one direction
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.
Cheers,
Valentine
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.