Hi!
I’m trying to run my motor using my new low side current sense code.
When I use the TorqueControlType::voltage mode the current readings seem very good. As I set the target to e.g. 1.0, and manually force the motor away from this point, the phase currents raise in a predictible manner:
motor.torque_controller = TorqueControlType::foc_current;
motor.controller = MotionControlType::angle;
// contoller configuration based on the control type
motor.PID_velocity.P = 0.2;
motor.PID_velocity.I = 20;
motor.PID_velocity.D = 0;
// contoller configuration based on the control type
motor.P_angle.P = 5;
motor.P_angle.I = 0.1;
motor.P_angle.D = 0.5;
// default voltage_power_supply
// COMMENTED !!! motor.phase_resistance = 0.14; <- not set
motor.voltage_limit = 1;
motor.current_limit = 0.1;
// velocity low pass filtering time constant
motor.LPF_velocity.Tf = 0.01;
// angle loop velocity limit
motor.velocity_limit = 50;
force ph A ph B ph C timestamp angle sensor
0 18.43 18.99 19.03 12887837 1.02
CCW: 22.46 18.99 17.98 142493226 0.60
CW: 15.84 19.20 20.21 218107287 1.45
My motor phase resistange has been measured to be 0.14 ohm with an high precision ohm meter (YR2050). More precisely, the resistance between wire pairs are 0.28028, 0.27975 and 0.28077 ohm.
Then I triy to actually use the current sensor using these settings
motor.torque_controller = TorqueControlType::foc_current;
motor.controller = MotionControlType::angle;
// contoller configuration based on the control type
motor.PID_velocity.P = 0.2;
motor.PID_velocity.I = 20;
motor.PID_velocity.D = 0;
// contoller configuration based on the control type
motor.P_angle.P = 5;
motor.P_angle.I = 0.1;
motor.P_angle.D = 0.5;
// default voltage_power_supply
motor.phase_resistance = 0.14;
motor.voltage_limit = 1;
motor.current_limit = 0.1;
// velocity low pass filtering time constant
motor.LPF_velocity.Tf = 0.01;
// angle loop velocity limit
motor.velocity_limit = 50;
The initFOC() passes (yes @Antun_Skuric, I uncommented the driverAlign() code and it passes) but as soon as the loop() begins, the motor locks with a big CLANK! and my 12V/15A old ATX psu shuts down (protection). I’m using a DRV8305 BOOSTXL kit with 0.007 Ohm shunt resistors.
BLDCDriver6PWM driver(UH, UL, VH, VL, WH, WL, DRV_GATE_EN);
LowsideCurrentSense current_sense(0.007f, 10.0f, DRV_SOA, DRV_SOB, DRV_SOC);
If I look at the 6 PWM signals it is completely erratic with long dead period alternating on phases, nothing to do with the nice regular signal I get in voltage mode.
Any hnts?
Thank you!