Hi,
I have the following setup:
Motor: MY-4021F (Product - Huizhou JD-power Technology Co.,Ltd)
Sensor: AS5270B – PWM
Driver: SimpleFOCShield v2.0.3
MCU: Nucleo-144 STMF767zi
I have been struggling with this setup for some days now, without removing the vibration in the motor. Thus, wondered if anyone in this community has come across something similar before?
Here is a video of the vibration: https://youtu.be/MwfljzbmEFM
I have tuned the angle P and velocity PI(D) controllers without achieving a better result, so I don’t believe this is a pure tuning case. I have noticed that I use a relatively high value for TF compared to other examples, but this is necessary to avoid the system oscillate and become unstable. This may indicate that there is too much noise from the sensor?
Here is a plot with angle and velocity:
Here is the code I currently use:
#include <SimpleFOC.h>
MagneticSensorPWM sensorBot = MagneticSensorPWM(10, 4, 512);
void doPWMBot() { sensorBot.handlePWM(); }
BLDCMotor motor = BLDCMotor(11);
BLDCDriver3PWM driver = BLDCDriver3PWM(5, 9, 6, 8);
float target = 3;
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target, cmd); }
void doPidAngle(char* cmd) { command.pid(&motor.P_angle, cmd); }
void doPidVelo(char* cmd) { command.pid(&motor.PID_velocity, cmd); }
void doLpf(char* cmd) { command.lpf(&motor.LPF_velocity, cmd); }
void doMotor(char* cmd) { command.motor(&motor, cmd); }
void setup() {
sensorBot.init();
sensorBot.enableInterrupt(doPWMBot);
motor.linkSensor(&sensorBot);
driver.voltage_power_supply = 24;
driver.init();
motor.linkDriver(&driver);
motor.foc_modulation = FOCModulationType::SpaceVectorPWM;
motor.controller = MotionControlType::angle;
motor.voltage_limit = 6;
motor.PID_velocity.P = 1.5;
motor.PID_velocity.I = 5;
motor.PID_velocity.D = 0;
motor.LPF_velocity.Tf = 0.1;
motor.PID_velocity.output_ramp = 1000;
motor.P_angle.P = 5;
motor.velocity_limit = 5;
Serial.begin(115200);
motor.useMonitoring(Serial);
motor.init();
motor.initFOC();
command.add('T', doTarget, "target angle");
command.add('C', doPidVelo, "PID vel");
command.add('A', doPidAngle, "PID angle");
command.add('L', doLpf, "LPF vel");
command.add('M', doMotor, "Motor");
Serial.println(F("Motor ready."));
Serial.println(F("Set the target angle using serial terminal:"));
_delay(1000);
}
void loop() {
Serial.print(motor.shaft_angle);
Serial.print('\t');
Serial.print(motor.shaft_angle_sp);
Serial.print('\t');
Serial.print(motor.shaft_velocity);
Serial.print('\t');
Serial.print(motor.shaft_velocity_sp);
Serial.print('\n');
motor.loopFOC();
motor.move(target);
command.run();
}
Hoping for some good suggestions that can help me further with the project.