Beeps but no motion

Hi All

I have been trying to run my motors using the odrivetool. The following are my parameters:

Connected to ODrive 207A3589524B as odrv0
In [1]: odrv0.axis1.motor.config.resistance_calib_max_voltage = 10

In [2]: odrv0.axis1.motor.config.phase_inductance = .5

In [3]: odrv0.axis1.motor.config.calibration_current
Out[3]: 10.0

In [4]: odrv0.axis1.motor.config.phase_resistance = 1

In [5]: odrv0.axis1.motor.config.phase_resistance
Out[5]: 1.0

In [6]: odrv0.axis1.requested_state = AXIS_STATE_MOTOR_CALIBRATION

In [7]: odrv0.axis0.motor.config.phase_resistance
Out[7]: 0.0

In [8]: odrv0.axis0.motor.config.phase_resistance = 1

In [9]: odrv0.axis0.motor.config.calibration_current
Out[9]: 10.0

In [10]: odrv0.axis0.motor.config.resistance_calib_max_voltage = 10

In [11]: odrv0.axis0.motor.config.phase_inductance = .5

In [12]: odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION

In [13]: dump_errors(odrv0)
axis0
  axis: no error
  motor: no error
  encoder: no error
  controller: no error
axis1
  axis: no error
  motor: no error
  encoder: no error
  controller: no error

As per the topic, I couldn’t get the motors to move. Any ideas? My power supply corresponded to my parameters but after the beep, they went back to initial readings…

When you do the motor calibration, it only beeps to check the resistance and inductance. You need to also run ENCODER_OFFSET_CALIBRATION or FULL_CALIBRATION to do the encoder calibration, and then you can put it in CLOSED_LOOP_CONTROL

I’m using sensorless mode at the moment so I don’t need to do the encoder calibration right? I got the following errors when I entered the parameters…

The motor turned but stopped shortly after. My motor is Maytech MTO5065-HA-C 170kv.

In [14]: odrv0.axis1.controller.config.vel_gain = 0.01

In [15]: odrv0.axis1.controller.config.vel_integrator_gain = 0.05

In [16]: odrv0.axis1.controller.config.control_mode = 2

In [17]: odrv0.axis1.controller.vel_setpoint = 400

In [18]: odrv0.axis1.motor.config.direction = 1

In [19]: odrv0.axis0.sensorless_estimator.config.pm_flux_linkage = 5.51328895422 / (7 * 170)

In [20]: odrv0.axis0.sensorless_estimator.config.pm_flux_linkage
Out[20]: 0.00463301595300436

In [21]: odrv0.axis1.sensorless_estimator.config.pm_flux_linkage = 5.51328895422 / (7 * 170)

In [22]: odrv0.axis1.sensorless_estimator.config.pm_flux_linkage
Out[22]: 0.00463301595300436

In [23]: odrv0.axis1.requested_state = AXIS_STATE_SENSORLESS_CONTROL

In [24]: odrv0.axis1.requested_state = AXIS_STATE_SENSORLESS_CONTROL

In [25]: odrv0.axis1.controller.vel_setpoint = 2000

In [26]: odrv0.axis1.requested_state = AXIS_STATE_SENSORLESS_CONTROL

In [27]: odrv0.axis1.requested_state = AXIS_STATE_MOTOR_CALIBRATION

In [28]: odrv0.axis1.motor.config.direction = 0

In [29]: odrv0.axis1.requested_state = AXIS_STATE_SENSORLESS_CONTROL

In [30]: odrv0.axis1.motor.config.direction
Out[30]: 0

In [31]: odrv0.axis1.motor.config.direction = 1

In [32]: odrv0.axis1.requested_state = AXIS_STATE_SENSORLESS_CONTROL

In [33]: dump_errors(odrv0)
axis0
  axis: no error
  motor: no error
  encoder: no error
  controller: no error
axis1
  axis: Error(s):
    ERROR_MOTOR_DISARMED
    ERROR_MOTOR_FAILED
  motor: Error(s):
    ERROR_CURRENT_UNSTABLE
  encoder: no error
  controller: no error

Probably, you need to spin the motor faster to get a good commutation signal from the back-EMF.
There’s a parameter called something like lockin_vel which defines how fast the drive tries to spin the motor in open-loop to initialise the commutation.

However, you should be aware that sensorless control is pretty much useless below a certain speed (usually quite a high one), and therefore cannot be used for servo position control, where you need to be able to hold position at zero speed.
The whole point of the ODrive really is to provide closed-loop servo control using an encoder. If you don’t use an encoder, all you have is an expensive “ESC” :stuck_out_tongue:

Ah I see. I’ll have a look at the lockin_vel thing.

At this point in time, I just want to get the motors running but still no luck. If I use sensor mode, I would only add complexity to my problem. I’m totally new to odrive. It’s frustrating. The tutorial I watched online they got the motor running so easily and it’s my first time dealing with BLDC motors too.

Hey @madness_Hero

Couple things. First, I don’t see you setting your pole pairs anywhere (odrv0.axis0.motor.config.pole_pairs). Also, the phase inductance and phase resistance should be automatically measured by the ODrive when you do the motor calibration. You shouldn’t have to fill these in manually.
Once you’ve done motor calibration be sure to save your settings and reboot:
odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION
odrv0.save_configuration()
odrv0.reboot()

Finally, it looks like you used the default settings from here for setting up sensorless. Make sure that your pm_flux_linkage is correct (pole_pairs * rpm/v). RPM/V is just your motor’s KV rating.

Also check out this post for some additional help!

1 Like

Hi @kedvall

Thanks for the tips.
I moved a small magnet around the motor and it stopped 7 times. So what should I put my pole pairs value? odrv0.axis0.motor.config.pole_pairs doesn’t seem to accept 3.5…

Oh, in that case put 7. The number of times it stops is the number of pole pairs you have :slightly_smiling_face:

From the docs:

try sliding a loose magnet in your hand around the rotor, and counting how many times it stops. This will be the number of pole pairs.

Also you may find you’re off by one when counting. So if 7 doesn’t work try 6 and 8 just to be sure you didn’t miss one, it’s easy to do!

Hope that helps

I tried 6,7,8 for the pole pairs and still no luck. Here’s what I got:

In [19]: odrv0.axis0.motor
Out[19]:
error = 0x0080 (int)
armed_state = 0 (int)
is_calibrated = False (bool)
current_meas_phB = -0.0004513859748840332 (float)
current_meas_phC = -0.05449879169464111 (float)
DC_calib_phB = -0.8449786901473999 (float)
DC_calib_phC = -0.42870375514030457 (float)
phase_current_rev_gain = 0.02500000037252903 (float)
thermal_current_lim = 45.106475830078125 (float)
get_inverter_temp()
current_control:
  p_gain = 0.0 (float)
  i_gain = nan (float)
  v_current_control_integral_d = 0.0 (float)
  v_current_control_integral_q = 0.0 (float)
  Ibus = 0.0 (float)
  final_v_alpha = 0.0 (float)
  final_v_beta = 0.0 (float)
  Iq_setpoint = 0.0 (float)
  Iq_measured = 0.0 (float)
  Id_measured = 0.0 (float)
  I_measured_report_filter_k = 1.0 (float)
  max_allowed_current = 60.75 (float)
  overcurrent_trip_level = 67.5 (float)
gate_driver:
  drv_fault = 0 (int)
timing_log:
  TIMING_LOG_GENERAL = 0 (int)
  TIMING_LOG_ADC_CB_I = 2470 (int)
  TIMING_LOG_ADC_CB_DC = 12858 (int)
  TIMING_LOG_MEAS_R = 6606 (int)
  TIMING_LOG_MEAS_L = 0 (int)
  TIMING_LOG_ENC_CALIB = 0 (int)
  TIMING_LOG_IDX_SEARCH = 0 (int)
  TIMING_LOG_FOC_VOLTAGE = 6582 (int)
  TIMING_LOG_FOC_CURRENT = 0 (int)
config:
  pre_calibrated = False (bool)
  pole_pairs = 6 (int)
  calibration_current = 10.0 (float)
  resistance_calib_max_voltage = 10.0 (float)
  phase_inductance = 0.0 (float)
  phase_resistance = 0.37835389375686646 (float)
  direction = 1 (int)
  motor_type = 0 (int)
  current_lim = 10.0 (float)
  current_lim_tolerance = 1.25 (float)
  inverter_temp_limit_lower = 100.0 (float)
  inverter_temp_limit_upper = 120.0 (float)
  requested_current_range = 60.0 (float)
  current_control_bandwidth = 1000.0 (float)

error = 0x0080 seems to correspond to ERROR_MODULATION_MAGNITUDE. I observed tried to spin in one direction briefly. Then it turned in opposite direction with a click sound then stopped. What does that mean? Could my wiring from the motor to the odrive be wrong?

Hmmm your inductance doesn’t seem to be measured properly. It should be > 0.
I would double check you motor’s connections.
Also you can try lowering your resistance_calib_max_voltage. Start at 2 and work your way up. Make sure you stay within these limits though:

resistance_calib_max_voltage > calibration_current * phase_resistance
resistance_calib_max_voltage < 0.5 * vbus_voltage

I’ve got ERROR_MODULATION_MAGNITUDE before when the motor was not calibrated correctly.

Ok. I managed to get the phase inductance > 0. The current ramped up to about 4A and then went back to 0 after the beep. Here’s my output:

Reconnected to ODrive 207A3589524B as odrv0
In [29]: odrv0.vbus_voltage
Out[29]: 21.981739044189453

In [30]: odrv0.axis1.requested_state = AXIS_STATE_MOTOR_CALIBRATION

In [31]: odrv0.axis1.motor
Out[31]:
error = 0x0000 (int)
armed_state = 0 (int)
is_calibrated = True (bool)
current_meas_phB = -0.07093062996864319 (float)
current_meas_phC = -0.01252734661102295 (float)
DC_calib_phB = 0.1917944848537445 (float)
DC_calib_phC = -0.9945860505104065 (float)
phase_current_rev_gain = 0.02500000037252903 (float)
thermal_current_lim = 46.84187316894531 (float)
get_inverter_temp()
current_control:
  p_gain = 0.22612974047660828 (float)
  i_gain = 353.1379089355469 (float)
  v_current_control_integral_d = 0.0 (float)
  v_current_control_integral_q = 0.0 (float)
  Ibus = 0.0 (float)
  final_v_alpha = 0.0 (float)
  final_v_beta = 0.0 (float)
  Iq_setpoint = 0.0 (float)
  Iq_measured = 0.0 (float)
  Id_measured = 0.0 (float)
  I_measured_report_filter_k = 1.0 (float)
  max_allowed_current = 60.75 (float)
  overcurrent_trip_level = 67.5 (float)
gate_driver:
  drv_fault = 0 (int)
timing_log:
  TIMING_LOG_GENERAL = 0 (int)
  TIMING_LOG_ADC_CB_I = 3926 (int)
  TIMING_LOG_ADC_CB_DC = 14626 (int)
  TIMING_LOG_MEAS_R = 8434 (int)
  TIMING_LOG_MEAS_L = 8438 (int)
  TIMING_LOG_ENC_CALIB = 0 (int)
  TIMING_LOG_IDX_SEARCH = 0 (int)
  TIMING_LOG_FOC_VOLTAGE = 8398 (int)
  TIMING_LOG_FOC_CURRENT = 0 (int)
config:
  pre_calibrated = False (bool)
  pole_pairs = 7 (int)
  calibration_current = 10.0 (float)
  resistance_calib_max_voltage = 5.0 (float)
  phase_inductance = 0.00022612973407376558 (float)
  phase_resistance = 0.35313791036605835 (float)
  direction = 0 (int)
  motor_type = 0 (int)
  current_lim = 10.0 (float)
  current_lim_tolerance = 1.25 (float)
  inverter_temp_limit_lower = 100.0 (float)
  inverter_temp_limit_upper = 120.0 (float)
  requested_current_range = 60.0 (float)
  current_control_bandwidth = 1000.0 (float)

In [32]: dump_errors(odrv0)
axis0
  axis: no error
  motor: no error
  encoder: no error
  controller: no error
axis1
  axis: no error
  motor: no error
  encoder: no error
  controller: no error

No errors but the motor won’t continue to spin…

Not sure if this helps but here’s my setup:

Hi everyone

I still couldn’t get it to work. Anyone experienced something similar as my previous post?

@madness_Hero
Hey sorry for the late reply.

Can you post the exact process you’re using (what steps you do).
Does the ODrive fail when you go into closed loop?
Have you tried turning your gains to see if the motor responds?

You may also be able to run the encoder calibration routine (using requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE) and see if that rotates the motor at all. This works fine for me (even with no encoder connected) although mine is not set to use sensorless so I’m not sure.

Of course since you don’t have an encoder it will through an ERROR_NO_RESPONSE error but this is using a different method that the closed loop control and is a simple way to see if the ODrive can at least turn the motor.

Hope this helps

The motor that I use(70Kv) : https://maytech.cn/collections/all-brushless-motors/products/mto5065-170-ha-c?variant=29503884492894

  1. I set my current limit to 10A
  2. Velocity is set to 20,000
  3. calibration current is set to 9
  4. as you pointed out, I made sure the following:
  1. Pole pair is set to 7
  2. odrv0.axis0.controller.vel_setpoint = 400
  3. I tried using requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

It behaved as described in the guide: “After about 2 seconds should hear a beep. Then the motor will turn slowly in one direction for a few seconds, then back in the other direction.” Is that it?

On a side note, odrv0.axis0.controller.vel_setpoint value cannot be saved. Is that intended?

Problem solved but one question still remained. odrv0.axis0.controller.vel_setpoint value cannot be saved. Is that intended?

Yes. Only .config values are saved

What solved your problem?

Wrong Kv apparently…