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);
}