Need Help with SimpleFOC for a Custom BLDC Project

Hey everyone,

I am currently working on a custom BLDC motor project, and I am trying to use SimpleFOC to control it. I have got most of the basics down, but I am running into a few issues that I could use some advice on.

  1. Motor Selection: I am using a BLDC motor with a low KV rating for torque, but I am not sure if I am matching it correctly with my driver and power supply. Any tips on how to ensure I am not underpowering or overpowering the motor?
  2. Tuning PID: I have been playing around with the PID settings, but I am struggling to find that sweet spot where the motor is both responsive and stable. What’s your process for tuning these parameters effectively?
  3. Encoder Issues: I am using an encoder for feedback, but it seems like I am getting some noise or errors in the readings. Has anyone else faced similar issues? How did you resolve them?
  4. Battery Power: I am powering my setup with a LiPo battery, but I’m concerned about the voltage drops under load. Is it better to go with a higher voltage battery or add capacitors to smooth things out?

When I was searching about this, I came across these resources/articles Please help me find the best solution for my project mule esb tutorial, however, they are quite useful, but I wanted to learn more from community.

Any suggestions or experiences you guys could share would be really appreciated! This is my first time diving into motor control at this level, so I’m eager to learn from the community here.

Thanks in advance!

Best Regards

1 Like

Your hardware description is pretty vague, so you’ll only receive general advice answers.

  1. while running the motor in open loop, reduce the motor.voltage.limit to a level where the motor barely starts spinning without load.
    Once running in closed loop, you can raise it to 50% of battery voltage (driver voltage)
  2. only change one PID parameter at a time! Start with tame values and raise them until the behaviour gets unstable, then row back a bit.
  3. What type of encoder and data stream do you use?
  4. a good LiPo battery won’t see huge voltage drops from varying loads
    but you can poll the battery voltage while it discharges and change driver.voltage and motor.voltage.limit acoordingly to have same PID response.

I sympathize and can try to help alittle, but I think you have to respect that what you are asking for is basically a small textbook on engineering this kind of thing.

To tune the pid, there are again many resources and puzzling through them is part of learning this stuff, but the executive summary for basic tuning is to set all gains to zero, up the P gain till it starts to oscillate, then reduce it to 70% or so, then up the integral gain to eat up any static error that you are seeing as fast as it can without overshooting/suffering from additional oscillations. The D gain is not often used and you can read up about what it’s good for/what context it’s for, I don’t actually remember that well to be honest, but it’s sensitive to noise which is why I don’t use it much. IIRC it’s mostly to dampen overshoot.