FOC for BLDC motor

Hi everyone. I am a student and now a have project is code a program to control direction and speed a BLDC motor by using FOC and PI controller. And then make the real circuit. However, I don’t know how to start. Can someone help me?

What do you mean by pi controller. Do you mean a normal raspberry pi or pi pico.

Are you supposed to write the foc yourself or can you use a library (like simplefoc) which has already implemented it.

This is your project, and you are doing it to learn so it is best for us not to spoon feed you.

But here are some basic tips. Choosing a high ohm/low speed motors (i.e a gimbal motor) will make other choices easier.

You can learn a lot from studying the original simplefoc board. The schema, components, documentation will help you learn.

He means the PI control loops for Iq and Id.

Yes. I mean the PI control of PID controller, proportion and integral.


Your request is a little vague.

Do you need to write the actual PID code or you need to use a library and only write code using the library to control a motor, then create a circuit?


I need write the actual PID code.

Writing a pid controller isn’t difficult. You can do it in about 10 lines of code. Writing the FOC code is difficult and would take months to do properly. Do you have to write foc or could you alter the problem and use a stepper or brushed motor that still requires a pid controller?

…unless it is an autotuning PID project?