To prevent damage to the power supply, you must configure the ODrive such that it never pulls too much power out of the power supply, or puts too much power back into the power supply.
For this, the ODrive continuously measures the supply voltage and estimates the current going in and out of the power supply (referred to as DC voltage and DC current). When DC voltage or DC current exceeds the user-configured limits, the ODrive turns off the motor to prevent damage to the power supply (and/or itself).
DC voltage Limits:
In almost all cases, you should at least configure the overvoltage trip level.
In general it is also advisable to set the undervoltage trip level, although most AC/DC supplies will simply shut down and not take permanent damage if the ODrive pulls too much power.
Both voltage limits should be set to the rated voltage of your power supply, with a bit of a margin in both directions. This margin accounts for the voltage drop between the power supply and the ODrive. For most systems, a margin of ±2V is a good starting point, but may need to be larger if your DC cables are long or thin.
These limits cannot be set beyond the ODrive’s own rated limits.
DC current limits:
These limits are typically only needed for batteries.
Set them according to the discharge and charge rating of your battery. The ODrive’s DC current estimate can be quite noisy, so you will need to add a bit of a margin.
When operating at speeds exceeding those commanded by the controller, or during braking, the ODrive functions as an electrical generator,
feeding current back to the power supply.
The maximum regenerated current is set by
If this limit is surpassed, the ODrive will trigger a
It is important to set this value in accordance with the allowable negative current of your power source.
Some AC/DC supplies have sensitive overvoltage protection, and any amount of regenerated power will cause the supply to shut down. To avoid this, a high power diode can be installed between the power supply and ODrive. The diode should be rated for above the operating voltage of the ODrive, and for the maximum continuous current that will be drawn from the power supply.
A suggested diode for this application is the SMC SK2S120-100. It is a dual diode array, however only one of the internal diodes needs to be used.
It is strongly suggested that a diode on the power supply should only be used with ODrives that have a brake resistor control feature, with a properly connected brake resistor and proper software configuration.
additionally, Voltage Feedback (S1 Only) should be enabled when using a power supply diode.
Using an external regen clamp removes the requirement for a power supply diode.
For ODrive Pro, an external regen clamp module can be used instead of a brake resistor
The brake resistor control feature can dissipate surplus regenerated energy through an external brake resistor.
If enabled, energy dissipation begins once the regenerated current reaches
and continues until the regenerated power drops below this limit or until the resistor is fully saturated.
To enable the brake resistor control feature:
ODrives equipped with a brake resistor control feature can guard against the DC bus voltage rising.
This feature requires the brake resistor to be active, and
enable_dc_bus_voltage_feedback must be True.
If the detected DC bus voltage goes above the provided limit, surplus power is diverted to the brake resistor:
dc_bus_voltage_feedback_ramp_start, => brake_duty_cycle += 0%
dc_bus_voltage_feedback_ramp_end, => brake_duty_cycle += 100%
dc_bus_voltage_feedback_ramp_start= nominal bus voltage + 2V
dc_bus_voltage_feedback_ramp_end= nominal bus voltage + 6V
This feature is active even when all motors are disarmed.
dc_bus_voltage_feedback_ramp_start below the nominal bus voltage will quickly saturate the brake resistor.
The brake resistor will not be able to dissipated any regen current, and can produce unintentional and potentially dangerous amounts of heat.
Over Temperature Current Limiting
There are two temperature sensitive current limiting modules on the ODrive Pro/S1, one for the inverter (the onboard power electronics) (
<axis>.motor.fet_thermistor) and one for the motor (
Each of these modules can independently reduce the current limit of the current controller as the corresponding temperature approaches a predefined limit.
The configuration for these modules can be found under:
For the motor:
For the inverter (read-only):
fet_thermistor is always active, while
motor_thermistor can be enabled by setting
motor_thermistor.config.enabled to True.
When enabled, either module will start limiting the motor current when the
temp_limit_lower threshold is exceeded.
The current limit will then ramp down, ending with 0A once
temp_limit_upper is reached.
If the temperature continues to rise past
temp_limit_upper + 5°C, the ODrive will exit
CLOSED_LOOP_CONTROL with an error of either
MOTOR_OVER_TEMP, depending on which thermistor exceeded this threshold.
Motor Thermistor Configuration
Set the thermistor parameters:
motor_thermistor.config.r_ref: Resistance of the thermistor at the reference temperature (usually at 25°C). This can be found in the datasheet of your thermistor and is usually denoted as R_25.
motor_thermistor.config.beta: Beta value of the thermistor. Can be found in the datasheet of your thermistor. Sometimes denoted as B (25/85) or similar.
motor_thermistor.config.t_ref: Reference temperature (in °C) for which
r_refis given. Defaults to 25.
For users migrating from ODrive v3.*, no external circuitry is required to use a motor thermistor. The ODrive Pro has a built in 1k ohm voltage divider.
Used for cooling the ODrive FETs. Feedback is received from the integrated
Used for cooling the motor. Feedback is received from an offboard
<fan> modules use hysteresis control, where the fan is engaged once the temperature reading reaches
<fan>.upper and remains on until the temperature drops below
either module can be enabled by setting
<fan>.enabled to True.
If both modules are activated at the same time, the hysteresis control runs for each module separately and the fan is switched on when either of the two modules requests it to be on.
All encoders supported by ODrive require that you do some sort of encoder calibration. This requires the following:
Selecting an encoder and mounting it to your motor, refer to Known and Supported Encoders to make sure your hardware is compatible.
Connecting the pins to the ODrive
Configure the ODrive
The calibration procedure may vary depending on the type of encoder, please refer to the relevant section below.
During calibration the rotor must be allowed to rotate without any biased load during startup. That means mass and weak friction loads are fine, but gravity or spring loads are not okay.
The current limit during encoder calibration is set with
<axis>.config.calibration_lockin.current. The default value is enough for most applications, but can be increased for larger motors or loads.
Save the settings in the ODrive for correct bootup behavior by running
After the calibration procedure has completed, verify that
procedure_result is equal to
This can be done easily from
odrivetool by running
dump_errors(odrv), or from the GUI by inspecting the ODrive icon in the bottom left corner.
If instead, you see
ProcedureResult.BUSY then the calibration has not yet completed, check again after a couple more seconds.
ODrive Pro and ODrive S1 both come with an integrated magnetic encoder. To use this encoder, a diametric neodymium magnet must be mounted to the end of the motor shaft. For general purpose use we recommend the 6x5 N45SH magnets sold in our shop If this isn’t suitable, any diametric neodymium magnet with a diameter ≥ 4 mm and thickness ≥ 2.5 mm will work.
When mounting, a 1 mm gap between the onboard encoder and the magnet is ideal.
Incremental encoders have two signal connections A, B, an optional index signal Z, and will require power and ground from the ODrive.
All parameters pertaining to an incremental encoder can be found at
Proper configuration requires the Count Per Revolution (CPR), this should be found in the encoder datasheet.
Calibrate by running
If the index (Z) signal is not used,
ENCODER_OFFSET_CALIBRATION must be run after every reboot before
CLOSED_LOOP_CONTROL can be used.
If you would like to automate this process at startup, set
<axis>.config.startup_encoder_offset_calibration to True.
If you have an encoder with an index (Z) signal, you can avoid running
ENCODER_OFFSET_CALIBRATION on every startup, and instead use the index signal to re-sync the encoder to a stored calibration.
This process is only required once, it is recommended that you mechanically disengage the motor from anything other than the encoder, so that it can spin freely.
Identify the index signal pin number N on the ODrive, for Pro this is 7 (G07) and for S1 this is 10 (G10).
pos_vel_mapper: (optional, only required for absolute position setpoints)
If you are using the index (Z) signal,
ENCODER_INDEX_SEARCH must be run after every reboot before
CLOSED_LOOP_CONTROL can be used.
If you would like to automate this process at startup, set
<axis>.config.startup_encoder_index_search to True.
Save the configuration with
Reversing Index Search
Sometimes you would like the index search to only happen in a particular direction (the reverse of the default). Instead of swapping the motor leads, you can ensure that the following three values are negative:
Your motor should find the same rotational position when the ODrive performs an index search if the index signal is working properly.
This means that the motor should spin, and stop at the same position if you have set
<axis>.config.startup_encoder_index_search, so the search starts on reboot,
or if you request
ENCODER_INDEX_SEARCH after reboot.
You can test this. Send the
<odrv>.reboot() command, and while it’s rebooting turn your motor, then make sure the motor returns to the correct position each time when it comes out of reboot.
Try this procedure a couple of times to be sure.
Noise on the index signal (Z) can have unexpected consequences, watch out for the common warning signs:
ENCODER_OFFSET_CALIBRATION, where your calibration sequence may not complete
strange behavior after performing
when performing an index_search, the motor does not return to the same position each time.
One easy step that might fix this is to attach a 22nF-47nF capacitor between the ENC1_Z pin and GND.
RS-485 encoder signals use a differential pair A, B and will require power and ground from the ODrive.
At this time, only the CUI AMT21 series of encoders and the ODrive OA1 encoder are supported by the RS-485 interface
All parameters pertaining to an RS485 encoder can be found at
To configure, set
...config.modeto your protocol of choice:
Calibrate by running
Hall effect encoders have three signal connections A, B, and C, and will require power and ground from the ODrive.
All parameters pertaining to a hall effect encoder can be found at
The hall feedback has 6 states for every pole pair (PP) in the motor, therefore the resolution is equal to 6 * PP. Since this is lower than most incremental or absolute encoders, we need to reduce the
encoder_bandwidthto get smoother velocity estimates.
Due to the relatively low resolution of hall effect encoders, ODrive Robotics recommends a different encoder type for position control or applications requiring high performance at low speeds.
SPI encoders usually measure an absolute angle, which means you don’t need to repeat the encoder calibration after every ODrive reboot.
Some of these chips come with evaluation boards that can simplify mounting the chips to your motor. For our purposes if you are using an evaluation board you should select the settings for 3.3v.
The AMT23x family has a hardware bug that causes them to not properly tristate the MISO line. To use them with ODrive, there are two workarounds. One is to sequence power to the encoder a second or two after the ODrive receives power. This allows 1 encoder to be used without issue. Another solution is to add a tristate buffer, such as the 74AHC1G125SE, on the MISO line between the ODrive and each AMT23x encoder. Tie the enable pin on the buffer to the CS line for the respective encoder. This allows for more than one AMT23x encoder, or one AMT23x and another SPI encoder, to be used at the same time.
The SPI interface has three required and one optional signal connections: clock (SCK), data (MISO), chip select (nCS), and optionally data out (MOSI). Additionally, the encoder will require power and ground from the ODrive.
If you want to save a wire with AMS encoders, you can also connect the encoder’s MOSI to the encoder’s Vcc instead.
All parameters pertaining to an SPI encoder can be found at
Only the following modes are supported at this time:
CUI protocol: Compatible with the AMT23xx family (AMT232A, AMT232B, AMT233A, AMT233B).
AMS protocol: Compatible with AS5047P and AS5048A.
Identify the chip select pin number N on the ODrive, for Pro this is 17 (G17+) and for S1 this is 12 (G12).
Calibrate by running
If you are having calibration problems, make sure that your magnet is centered on the axis of rotation on the motor. Also make sure that your magnet height is within range of the spec sheet.
Sensorless mode is considered experimental in this firmware version.
The ODrive can run without encoder/hall feedback, but there is a minimum speed, usually around a few hundred RPM. In other words, sensorless mode does not support stopping or changing direction!
Sensorless mode starts by ramping up the motor speed in open loop control and then switches to closed loop control automatically.
The sensorless speed ramping parameters are in
sensorless_ramp.accel (in [radians/s] and [radians/s^2]) parameters control the speed that the ramp tries to reach and how quickly it gets there.
When the ramp reaches
<axis>.controller.input_vel is automatically set to the same velocity, in [turns/s], and the state switches to closed loop control.
If your motor comes to a stop after the ramp, try incrementally raising the
The goal is to be above the minimum speed necessary for sensorless position and speed feedback to converge - this is not well-parameterized per motor.
The parameters suggested below work for the D5065 motor, with 270KV and 7 pole pairs.
If your motor grinds and skips during the ramp, lower the
sensorless_ramp.accel parameter until it is tolerable.
Below are some suggested starting parameters that you can use for the ODrive D5065 motor. Motor calibration and setup must also be completed before sensorless mode will work.
<axis>.controller.config.vel_limit= <a value greater than
<axis>.config.sensorless_ramp.vel/ (2pi * <pole_pairs>)>
<axis>.config.motor.current_soft_max= 2 *