Reducing cogging at low speed GM3506

Hello everyone,

We have a GM3506 BLDC motor with an AS5048A Encoder (SPI) and an ESP32 as microcontroller.
We are running TorqueControlType::foc_current, but unfortunately, we feel what we think is an unusual amount of cogging when we move the motor really slow (about 1 cm /s). We tried different PID configs but without success. Here is our setup code:

void setup() {

driver.pwm_frequency = 20000;
driver.voltage_power_supply = 12;
driver.voltage_limit = 12;


// link the motor and the driver


if( current_sense.init() )
Serial.println(“Current sense init success!”);
Serial.println(“Current sense init failed!”);


motor.torque_controller = TorqueControlType::foc_current;
motor.controller = MotionControlType::torque;

motor.PID_current_q.P = 3;
motor.PID_current_q.I = 300;
motor.PID_current_q.D = 0;
motor.PID_current_q.limit = motor.voltage_limit;
motor.LPF_current_q.Tf = 0.01;

motor.PID_current_d.P = 3; // 3 - Arduino UNO/MEGA
motor.PID_current_d.I = 300; // 300 - Arduino UNO/MEGA
motor.PID_current_d.D = 0;
motor.PID_current_d.limit = motor.voltage_limit;
motor.LPF_current_q.Tf = 0.01;





Did we setup the foc library correctly? Is there a way to change the setup for minimum cogging?
Is it only about the PID values or is our motor not sufficient?

Thanks a lot,

I don’t see you calling current_sense.init?
I don’t think current sense does make much sense with those gimbal motors. When you init the motor with phase resistance and kV it will work in TorqueControlType::voltage as well.

Have you tried playing with:

  motor.foc_modulation = FOCModulationType::SinePWM; // or FOCModulationType::SpaceVectorPWM;

Well I think angle or velocity mode with an encoder or angle sensor should reduce the impact of this, but it won’t be perfect. Anti cogging is something we’ve talked about in other threads you can find, there are some interesting algorithms and stuff but nothing has been baked yet into a usable module.