Calibration Voltage/Current
When setting up motors in odrivetool
or the GUI, you must specify key parameters like calibration voltage and current. Incorrect values can cause calibration failures or poor control performance.
In this page we’ll go over what these mean and how to choose them.
Note
In the GUI, the parameters called “Motor calib. current”, “Motor calib. voltage”, and “Lock-in spin current” map to the internal parameters <axis>.config.motor.calibration_current
, <axis>.config.motor.resistance_calib_max_voltage
, and <axis>.config.calibration_lockin.current
, respectively. We’ll be using the names of the internal parameters for this article.
Quick Summary
As a rule of thumb, you can start with the following values, appropriate for most situations:
<axis>.config.motor.calibration_current
about 50% of your motor’s maximum continuous current<axis>.config.motor.resistance_calib_max_voltage
below 1/2 your supply voltage, and above<axis>.config.motor.calibration_current
*phase_resistance
, wherephase_resistance
is the estimated phase-neutral resistance of your motor.<axis>.config.calibration_lockin.current
about 75% of your motor’s maximum continuous current
What does calibration do?
At the core of the ODrive is a high-performance current controller. This allows the ODrive to directly control the torque through the motor, and thus achieve high-precision torque, velocity, and position control. However, different motors behave differently, so the ODrive’s calibration procedure allows it to automatically tune the current controller to your particular motor.
Specifically, the MOTOR_CALIBRATION
procedure has two parts — resistance calibration, phase inductance calibration. You can probably guess what each of these steps are calibrating! Both the motor’s resistance and inductance are required to be known to properly control the motor.
Resistance Calibration
During resistance calibration, the ODrive will apply a DC voltage to the motor, slowly raising it until it detects that calibration_current
amps of current are flowing through the motor. As an extra precaution, this voltage is limited by resistance_calib_max_voltage
. Using Ohm’s law, the ODrive is able to measure the motor’s resistance.
Inductance Calibration
During inductance calibration, the ODrive uses resistance_calib_max_voltage
(despite the name), and applies it in a square wave to the motor. By measuring the current ripple, the ODrive is able to measure the motor’s inductance.
Picking Values
Typically, we recommend setting calibration_current
to around 50% of the motor’s continuous current limit. This will ensure accurate calibration, without heating the motor or ODrive too much.
If you know the motor’s phase-neutral resistance, you can set resistance_calib_max_voltage
slightly higher than \(R_{phase-neutral} \cdot \frac{3}{2} \cdot I_{calibration}\).
Note
Most manufacturers specify phase-phase resistance, which is exactly 2x phase-neutral resistance.
If you don’t know your motor’s phase-neutral resistance, you can start with a resistance_calib_max_voltage
of about 1-2V, and raise it if calibration fails.
Warning
resistance_calib_max_voltage
must be less than 1/2 of the DC bus supply voltage, or calibration will fail with an error message.
Troubleshooting
Resistance Calibration
Common failure causes for resistance calibration include:
PHASE_RESISTANCE_OUT_OF_RANGE
: The output voltage needed to achievecalibration_current
exceededresistance_calib_max_voltage
.CURRENT_LIMIT_VIOLATION
: The motor’s measured current exceeded<axis>.config.motor.current_hard_max
.CALIBRATION_ERROR
:resistance_calib_max_voltage
is greater than 1/2 of the DC bus supply voltage.UNBALANCED_PHASES
: The motor’s measured resistance between all three phases differs by over 10%. This can be caused by faulty connections, a damaged motor, orcalibration_current
being too low, especially on lower resistance motors.
Ensure that your desired calibration_current
is actually achievable given your motor and supply voltage. For instance, with a 12V resistance_calib_max_voltage
, a motor with 1Ω phase-neutral resistance can only achieve 12V / (1Ω * 3/2) = 8A. If you entered a calibration_current
of 10A, your calibration would fail with a PHASE_RESISTANCE_OUT_OF_RANGE
error; you’d need to pick a value under 8A.
If you’re getting a CURRENT_LIMIT_VIOLATION
error, ensure your calibration_current
is less than the motor’s current limit.
Most resistance calibration errors can be solved by either reducing calibration_current
, or increasing resistance_calib_max_voltage
. Note that low values of calibration_current
can affect calibration accuracy.
Inductance Calibration
Inductance calibration will fail in the following situations:
CURRENT_LIMIT_VIOLATION
: The motor’s current ripple exceeds<axis>.config.motor.current_hard_max
(common on very high current and/or high KV motors with higherresistance_calib_max_voltage
).PHASE_INDUCTANCE_OUT_OF_RANGE
: The measured inductance is below 2uH, or above 4mH.CALIBRATION_ERROR
:resistance_calib_max_voltage
is greater than 1/2 of the DC bus supply voltage.
If you’re getting a CURRENT_LIMIT_VIOLATION
error, try reducing resistance_calib_max_voltage
. Note this may need a proportional reduction in calibration_current
for the resistance calibration phase.
If you’re getting a PHASE_INDUCTANCE_OUT_OF_RANGE
error, you can try increasing or reducing resistance_calib_max_voltage
, and ensuring all wiring between the motor and the ODrive is secured and well-connected.
Calibration lock-in / Lock-in spin current
One more parameter to note is calibration lock-in current, or <axis>.config.calibration_lockin.current
(and “Lock-in spin current” in the GUI). This is the current sent through the motor during encoder calibration.
If this value is too low, the encoder calibration can be inaccurate (especially if there’s load or friction on the motor, or it’s a motor with high cogging torque).
Assuming your motor’s current limit is properly set, there’s not too much downside to setting this value high, so we typically recommend setting this around 75% of the motor’s maximum continuous current.