Using micro BLDC motor with DRV8313 fails

Hi guys! I am using the DRV8313 driver to test a cutomized pcb. The motor I want to drive is exactly: Amazon.com: DC 3.7V-11.1V 7.4V 4300KV Mini 1104 3-phase Brushless Motor Micro Outer Rotor BLDC for Quadcopter Fixed Wing : Toys & Games
The board has a STM32L433RC and I am using STMDuino to test the open loop velocity code (the schematics are at the end of this message). What I am getting is noises comming out from the motor. The code I am using is from the open loop examples, I don’t know what is going on, I read in one forum that if I change the PID parameters it can work. Furthermore, I used a logic analyzer to see if there are any ouput on the PWM pins and there are, but no ouput on the mosfet lines, I also checked the DRV_EN pin in the pcb and it is pulled high.

#include <SimpleFOC.h>

#define DRV_EN PB12

// BLDC motor & driver instance
BLDCMotor motor = BLDCMotor(12); // WE NEED TO FND THIS ACCORDING TO OUR BLDC MOTOR
BLDCDriver3PWM driver = BLDCDriver3PWM(PA10, PB11, PB10, DRV_EN);

//target variable
float target_velocity = 100;

void setup() {

  // use monitoring with serial 
  Serial.begin(115200);
  // enable more verbose output for debugging
  // comment out if not needed
  SimpleFOCDebug::enable(&Serial);

  driver.voltage_power_supply = 5;
  //driver.voltage_limit = 6;
  if(!driver.init()){
    Serial.println("Driver init failed!");
    return;
  }
  motor.linkDriver(&driver);

  // limiting motor movements
  // limit the voltage to be set to the motor
  // start very low for high resistance motors
  // current = voltage / resistance, so try to be well under 1Amp
  motor.voltage_limit = 4.5;   // [V]
  motor.controller = MotionControlType::velocity_openloop;

  motor.PID_velocity.P = 0.2;
  motor.PID_velocity.I = 20;
  motor.PID_velocity.output_ramp = 1000;
  motor.LPF_velocity.Tf = 0.01;

  if(!motor.init()){
    Serial.println("Motor init failed!");
    return;
  }
}

void loop() {   
  motor.loopFOC();
  motor.move(target_velocity);
}

Hi @Ricardo_Calle , welcome to SimpleFOC!

With 4300KV I think this motor will be hard to drive. What’s its phase resistance?

I’m guessing it’s quite low and the driver is going into over-current protection. You can check its fault pin to see if it’s in a fault state.

What’s your power supply voltage? If it’s really 5V this is too low, the DRV8313 likes 8V or more.

Once everything is set up right you could try open loop with a low voltage limit (maybe 0.1V), depending on the phase resistance, and see if you can get it working but my guess is it will be difficult, and the motor will get hot. I assume you will need a position sensor for closed loop mode.

Hi @runger, thank you for your rapid reply!

As a matter of fact, you right…the phase resistance of the motor is about 0.9 Ohms. With only 5V, the current will be much higher than the allowable provided by the driver. So, your suggestion is to power VM with 8V, but in code to limit the voltage so the current doesn’t go up to 3.5A?

Yes, if the resistance is really 0.9Ohm then limiting the voltage to about 0.1-0.5V should keep you within the motor’s allowable current levels.

You’ll have to see if it works at all though - even at 0.1V it would want to spin at 430RPM and it can be hard getting open loop “under control” with such a jumpy motor. Try to change the speed gradually rather than in big jumps, that can help…

Oh yes, actually the open loop is only to see if the motor rotates; eventually we will add a analog encoder for the close loop control. I will test your suggestion once I purchase a power source.

Before this issue appeared, I have a custom DRV8316 board we used first to test the same motor, but there is a problem: the motor starts vibrating (we used the code version that uses the 6PWM channels). Should I open a new thread for these case?