BLDC motor does not start by itself – works after manual push (Angle Control)

Hello everyone,

I am currently using a Nanotec DB28S01 motor in angle control mode. However, I am experiencing a very unusual behavior in my setup.

The motor does not start spinning on its own. It remains stationary even though the control is active. However, if I give the motor a slight manual push, it immediately starts spinning smoothly and continues to run perfectly without any issues.

Additionally, during the alignment process, the motor does not move at all — regardless of the alignment voltage I set.

Below is my code. I would really appreciate any suggestions or ideas on what could be causing this issue.

Thank you in advance!

#include <SimpleFOC.h>

float target_angle = 0; //= 6.28;

// Motor instance(pp)

BLDCMotor motor = BLDCMotor(2);

// driver instance

BLDCDriver3PWM driver = BLDCDriver3PWM(16, 4, 32);

HallSensor sensor = HallSensor(25, 26, 27, 2);

// Interrupt routine initialization

// channel A, B and C callbacks

void doA(){sensor.handleA();}

void doB(){sensor.handleB();}

void doC(){sensor.handleC();}

// instantiate the commander

Commander command = Commander(Serial);

void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }

void setup() {

Serial.begin(115200);

SimpleFOCDebug::enable(&Serial);

// initialize sensor hardware

sensor.init();

// hardware interrupt enable

sensor.enableInterrupts(doA, doB, doC);

// link the motor and the sensor

motor.linkSensor(&sensor);

// driver config

// power supply voltage [V]

driver.voltage_power_supply = 12;

// driver init

if(!driver.init()){

Serial.println("Driver init failed!");

return;

}

// link driver

motor.linkDriver(&driver);

// aligning voltage

motor.voltage_sensor_align = 2.2f;

// set motion control loop to be used

motor.controller = MotionControlType::angle;

// contoller configuration

// default parameters in defaults.h

// velocity PI controller parameters

motor.PID_velocity.P = 0.2f;

motor.PID_velocity.I = 0.20f;

motor.PID_velocity.D = 0;

// default voltage_power_supply

motor.voltage_limit = 12;

// default value is 300 volts per sec ~ 0.3V per millisecond

motor.PID_velocity.output_ramp = 1000;

// velocity low pass filtering time constant

motor.LPF_velocity.Tf = 0.1f;

// angle P controller

motor.P_angle.P = 10;

// acceleration control using output ramp

// this variable is in rad/s^2 and sets the limit of acceleration

motor.P_angle.output_ramp = 10000;

// maximal velocity of the position control

motor.velocity_limit = 200;

// use monitoring with serial

Serial.begin(115200);

// comment out if not needed

motor.useMonitoring(Serial);

// initialize motor

motor.init();

// align sensor and start FOC

motor.initFOC();

// add target command T

command.add(‘T’, doTarget, “target angle”);

Serial.println(F(“Motor ready.”));

Serial.println(F(“Set the target angle using serial terminal:”));

_delay(1000);

}

void loop() {

// main FOC algorithm function

motor.loopFOC();

// Motion control function

// You can also use motor.move() and set the motor.target in the code

motor.move(target_angle);

// function intended to be used with serial plotter to monitor motor variables

// significantly slowing the execution down!!!

// motor.monitor();

// user communication

command.run();

}