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
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”
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.
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!
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…
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:
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.
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?