Sensorless and motor errors

Hello Community

I have been reading around trying to find out what is going on with my setup. I am running a Odrive v3.6-24V with some success but it is just missing that last little bit for it to work in my project. The end goal is stable velocity ripple at 7000 to 7500 RPM before I am able to reach that speed I get a MOTOR_ERROR_CURRENT_LIMIT_VIOLATION. the load is very light and the torque of the motor is more than enough to run at the commanded speed. but I am not able to pass 85 RPS.

Motor info
16 amps rated
0.0155 Nm/A
0.25Nm rated torque
24 Vdc
650 Kv
Pole pairs 7

hw_version_major = 3 (int)
hw_version_minor = 6 (int)
hw_version_variant = 24 (int)
fw_version_major = 0 (int)
fw_version_minor = 5 (int)
fw_version_revision = 1 (int)
fw_version_unreleased = 1 (int)

odrv0.axis0.motor.config.pole_pairs = 7
odrv0.axis0.motor.config.resistance_calib_max_voltage = 4
odrv0.axis0.motor.config.requested_current_range = 16
odrv0.axis0.motor.config.torque_constant = 0.0155
odrv0.axis0.motor.config.current_lim = 16
odrv0.axis0.controller.config.vel_gain = 0.05
odrv0.axis0.controller.config.vel_integrator_gain = 0.1
odrv0.axis0.controller.config.vel_limit = 150
odrv0.axis0.controller.config.control_mode = 2
odrv0.axis0.controller.config.input_mode = 2
odrv0.axis0.controller.config.vel_ramp_rate = 4
odrv0.axis0.controller.config.pos_gain = 1
odrv0.axis0.motor.config.direction = 1
odrv0.axis0.config.sensorless_ramp.accel = 200
odrv0.axis0.config.sensorless_ramp.vel = 400
odrv0.axis0.config.sensorless_ramp.current = 4
odrv0.axis0.sensorless_estimator.config.pm_flux_linkage = 0.001271171
odrv0.axis0.motor.config.current_control_bandwidth = 500
odrv0.axis0.encoder.config.bandwidth = 500

Motor calibration
odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION
phase_inductance = 3.111668411293067e-05 (float)
phase_resistance = 0.08896870911121368 (float)
odrv0.axis0.motor.config.pre_calibrated = True

motor.sensorless.pm_flux_linkage = 5.51328895422 / ( * <rpm/v>)

from what I was able to find the MOTOR_ERROR_CURRENT_LIMIT_VIOLATION happens when I_trip = config_.current_lim_tolerance(not sure how current_margin affects thsi since it replaced tolerance) * effective_current_lim(); if (SQ(Id) + SQ(Iq) > SQ(I_trip)). the effective current limit is auto determined from the thermal limits and the Current_lim and requested_current_range. I have increased the current lim and requested current much higher with limited change to when the error happens. in the below two images. the setting above could not exceed 60 RPS but in any of these instances there is a simlar disturbance. is there a setting missed or a reason the current controller is spiking other than that the motor is going from ramping to rapid deceleration from the error.

start_liveplotter(lambda: [odrv0.axis0.sensorless_estimator.vel_estimate])

(I had another image but could only post one if you need other graphed data let me know)

I also have tried adjusting the Bandwidth settings I have found that increasing the current_control_bandwidth higher than default can help a bit but the encoder.config.bandwidth need to stay at or below 1000.

I have also tried halls using the hoverboard example but the stability at around 85 RPS was not great event with the Caps added.

Any help would be great

After more testing today I tested with an encoder and I am able to reach speed but in the final build I do not have space for the encoder.

the CUI AMT103 was used at 1024(CPR) / 4096(PPR)

After looking in the Source code on how the MOTOR_ERROR_CURRENT_LIMIT_VIOLATION is checked. I decided to adjust the p_gain and i_gain in the current_controller. reducing the i_gain reduced what ever current spike that was happening down so that i_trip would not trigger. the motor does get warm now to the touch but that can be worked with. also a small bump to p_gain can also help.

(SQ(Id) + SQ(Iq) > SQ(I_trip))

odrv0.axis0.motor.current_control.p_gain = .15
odrv0.axis0.motor.current_control.i_gain = 75
odrv0.axis0.motor.current_control.p_gain = .123
odrv0.axis0.motor.current_control.i_gain = 350.9

1 Like

85 rps at 7 pole pairs is close to the 600 Hz electrical limit of the controller. 816 Hz may not be possible depending on settings. I would actually increase your current_control_bandwidth and encoder bandwidth, since you’re running such high speeds. 4000 is the max

Are you sure it is 600 hz because I got to 125 RPS with the changes above and with an encoder it had no trouble. could it be 600 hz per phase? setting current_control_bandwidth to 4000 helps

The question about max speed was another part that interested me I did find conflicting info on this. I did see a previous post where you said 600hz but I also saw the link below and I did see that only 75% of rated speed can be achieved for a given motors KV.

Neat! It is 600Hz, but it’s not a hard limit. If you get the right combination of settings it can work! I’m not sure - maybe there is a separate sensorless estimator bandwidth setting that will help it get to high speeds in sensorless mode?

And yeah, the 75% limit is because we have to limit the modulation due to only having 2 current shunts.


Thank you for the info for now I have what I need. the only thing is I need to set the odrv0.axis0.motor.current_control.p_gain and odrv0.axis0.motor.current_control.i_gain every time on start up.

Those are adjusted automatically by setting the current controller bandwidth, according to the measured inductance and resistance. You shouldn’t set them manually. Has setting them manually helped?

Yes it has, above the 600 hz range the current control begins to not be as stable. It looks like since the CURRENT_LIMIT_VIOLATION shows up under no load. reducing the odrv0.axis0.motor.current_control.i_gain in the current controller helps over come this. I was not able to get up to the speed I needed with the pre-calculated PI settings for the current controller even when I changed the current bandwidth I would not end up with the values needed.

my motor is a bit of an oddity being a custom wound hollow shaft out runner motor with a high KV.