Hi guys, Simplefoc is an open-source project attempting to demystify the Field Oriented Control algorithm for BLDC and Stepper motors for hobby community. The aim of the project is to provide a simple but robust FOC implementation based on the Arduino IDE for as many motor + sensor + current sense + driver + mcu combinations as possible.
This youtube channel is a place where we place our updates and some interesting projects that we hope motivate you to use FOC in your projects as well!
How the encoder relates to a "field"? That was a big mistake to name this library FOC. Now everyone supposes that FOC means a positioning. Despite the correct preview image, the rest misleads. No torque, no noise management is available with this library, despite FOC originally means exactly this. FOC is about coil to magnet orientation detection. That's it. I'm angry
As I can see those days when the first FOC hardware drivers appeared, many YTs began that hype, naming FOC a positioning system. "Field" in FOC means a motor magnetic field. Got this? FOC was designed to manage torque (that reduces a noise and increases an efficiency). I think there was one popular YTer, how started that trend (with improper usage of the term FOC), and then the others copy pasted.
Hey @sc0or, You're right, the FOC has a very specific meaning and has been there for many decades now. I'd argue that the FOC was designed to decouple the torque and field control, mostly for Asynchronous motors. For BLDC motors, FOC approach is much simpler, as the rotor field is directly related to the rotor angle, no slip happening. So for BLDC motors, the abstraction that the voltage vector is proportional to the current vector which is proportional to the field vector which is proportional to the torque is relatively reasonable for low speeds. But as you said, this is no longer true for higher velocity. This is an old video, and one that does not anymore correspond to the simplefoc well. It is just a video to make people interested. The library nowdays implements the textbook FOC algorithm for many architectures and does it with a decent level of efficiency. The overall the goal of the library and the project is to demystify (make simple) this approach and to give the people a relatively well documented and gradual way into this topic.
@@antunskuric7282 Indeed. However when I search YT for a custom implementation of a real FOC to use an industrial controller that is driven by 3-phase PWM from an MCU, I find tons of videos with the positioning. I only hope that TI has some webinar and a source code for their MCUs. Unfortunately, existing hardware FOC controllers are not powerful enough. They suppose that a user must not care of a noise or efficiency with a high power motor. But my 3kWt motor must be silent and effective.
Hello Antun, I am still playing with this library and having some issues...still. 1. with the angle control i have to type a target "T6.275" to get 1 full 360 rotation I cannot figure out why its not "T360"??? I have the encoder set to 2048 and everything initializes good...2. I have been using an UNO clone and also esp32 D1 R32 but the esp just will not work correctly it works but is all jittery and makes the motor hot also the simplefoc shield V2.0.4 not the same one you are using. I have mapped the pins correctly but maybe the esp pins need to be a specific type like interrupt pins or pwm pins although im pretty positive they are all interrupt capable???
Thank you showing this cool video with motor control. Do the motors you use have any cogging moments, or are the motors special made to keep cogging moments at minimum?
What is meant here by FOC? For real FOC, you can control the motor in any operating domain (incl MTPA, MPTV, constant voltage curve etc ...), by manipulating Id and Iq current, knowing exact position of your rotor flux (in few degrees accurate). To be honest, I doubt that this here is a real FOC. Its a good basis non the less. Oh and about speee control. If you increase the voltage, the motor shouldn't turn faster. Higher voltage only means lss troubles until Bemf is equalizes. Then you anyway need to do any of field-weakening approaches. Dont get me wrong, I am not demeaning the effort of SimpleFOC community, I just want it to reach the state where you can call it *complete* SimpleFOC
Hey Aljaz, thanks for the comment. You were not the first one to point this out. This is a very first video demonstrating the SimpleFOC . At that point it was a small git repo and the "real FOC" was not implemented. SimpleFOC has gone far from this video. Nowdays SimpleFOC supports the "real FOC" for BLDCs and in the next release for steppers as well. This video does not do justice to the efforts that have been put into this project from the community. :D
I'm not sure that I understood your point about the voltage. If you increase the voltage you will be able to get higher speed because you'll nee higher Bemf to equalize the increase in the voltage and Bemf is proportional to the speed. So higher voltage = higher Bemf = higher sped.
@@theskura Yes about Bemf part, I think in the video you mention that we "put the system in speed control loop and speed is stable. And if you increase the voltage, the speed increases." That's the part which I cannot agree with. Of course as you said, with increasing the voltage you can rotate the motor faster, but the speed controller should keep the motor at the same speed, regardless of DC link voltage. Even if Battery voltage is lower than Bemf, then you do field weakening (increasing the D current) but only up to the point, where Q current is still sufficient to produce enough torque to fight the losses at given speed. Now that I mentioned this, it doesn't mean that I think SimpleFOC is bad. Not at all. As you mentioned yourself at that point it was not as mature as it is now / will be in the future. I am doing something similar, but with C and with STM32G431. Trying to do Sensorless with SMO. I wish SimpleFOC was in C, then we would be right now chatting on the forum :)
@@AljazJelen1992 Absolutely right! I agree, in the speed control the increase in the voltage will not increase the speed. So far we did not get to the field weakening, maybe in the future. :D Yeah, we are bound to cpp at the moment, there are some people that ported simplefoc to C, but I would not suggest doing that. SimpleFOC is probably to big an bulky for experienced embedded developers, there are more efficient ways to write C code and to achieve the same things, and with better performance. Good luck with your project!
Hi, I have used exactly the schema and sketch from the official Simple FOC, Im trying with two different motors and encoders. Both motors move a little just at the beginning, when I plug the system. But nothing more happens. Let me know where can I send you images and videos.
hola, queria hacerle una consulta, estoy haciendo un proyecto de brazo robotico y a lo unico que tengo acceso es a los dos motores de una Hoverboard, es posible con ese controlador FOC utilizar los motores de la Hoverboard como motores de precision?
Thank you for this video. I shall check out the Simple FOC Community. I got one question about the Hall Sensors used. I think it is to read the position of the shaft. Is it digital hall sensors? I am investigating motor drives for sewing machines. In general you like to have a large speed range of about 1:200 or better. And you like to have good low speed control with fast response to load changes. At low speed you will need short term higher currents (and shaft torque) than the long term current limit of the motor. Furthermore, you like to avoid unpleasant audio noise, but silence is not needed. Unfortunately, most servo motors for industrial sewing machines on the market cannot meet such demands. They do use BLDC motors, but I think the control methods they use are outdated. This is a video that give some idea about the demands: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-uTB8DnyYAlA.html
I have a biesse 342 machine that have brushless dc servos with broken servodrives. Do you think I can replace that old servodrives with newer electronics. Servos are gec alsthom 290v brushless dc. Any recommendations?
I'm curious, I thoght the clarke and park transform would be dificalt to do in software would it be easer to use a dedicated FOC chip that dose the clarke and park transform in hardware?
When I control using closeloop, I set the velocity to 5 rad/s, then change the PID parameters. Initially I gave I = 0 then changed P. I realized at motor.PID_velocity.P = 0.2; The motor started to accelerate but I noticed on the serial screen that the voltage gradually increased to 1 value and the wheel stopped rotating. When tested with higher P values, the wheel rotates unevenly. It seems like it only rotates for a while and then spins again, causing the wheel to jerk. Below is a picture of the voltage in the second column. When the voltage is < 0.8, the wheel still rotates, but when it is greater than 0.8V, the wheel stops.
Can I ask something? Yesterday I controlled the skateboard motor when in the openloop control loop, the motor rotated quite smoothly but when switching to closeloop the motor started stuttering. Is it because I set the voltage incorrectly? I set motor1.voltage_limit = 6;
Please, can someone make a foc bldc driver board for 3D printers?... A standard one with step/dir input, to install in place of current TMC drivers? Seems so easy, but can't find any to buy.
On your L298 power board, there is no current sensor. If you cannot sense the current of the motor, how can you run the fOC? FOC is all about current control.
Propably by voltage? Stepper is a bit different from 3 phase bldc. As you only have 2 "phases" you can just use pwm with a known input voltage to set the motor current.
Here's a few things that I had to do with the g431b to start programming. Delete the build flag in the ini file for USB FULL speed and use serial 2 vs 1 ie. Serial2.begin(115200);