I’m using an ODrive S1 on FW 0.6.10 with a PMSM hub motor (15 pole pairs) and the onboard magnetic encoder.
My mechanical setup has the encoder geared relative to the motor: the encoder rotates about 5× faster than the motor (encoder_turns ≈ 5 × motor_turns). The encoder signal itself looks good — onboard_encoder0.raw moves smoothly and wraps correctly.
Motor calibration succeeds, but ENCODER_OFFSET_CALIBRATION always fails with POLE_PAIR_CPR_MISMATCH. The diagnostic value:
axis.observed_encoder_scale_factor ≈ 0.206
which matches the 1/5 ratio, so it seems the calibration logic is still seeing the mechanical gearing.
The GUI recommends i set my pole pairs to 3. But when i try that i get the same error.
I have tried a number of approaches but nothing seams to work.
Is this use case even supported?
Hi! Typically, it’s required to have the commutation encoder directly coupled to the motor. If you do need to have it geared (I assume because you’re using a hub motor), you need to divide the pole pairs by the gear factor – so a pole pair number of 3 would work. When doing this, it’s very important that the gear reduction be as low backlash as possible, as any small amount of mechanical error will multiply quite a bit – for instance, even 1° of backlash would multiply to 1*5 = 5°, and on a 15 pole pair motor, this is 5*15 = 25° electrical degrees of error, which results in a 1-sin(90°-25°) = 10% torque error. This could also be caused by:
- Encoder nonlinearity due to tolerance in mounting (see here).
- Insufficient calibration current.
I would recommend the following:
- Ensure your gear reduction is as low backlash as possible. Maybe adding a tensioned belt reduction just for the encoder, that’s 1:1 with the motor, would be good. However, if this is a geared hub motor (like an Maxon drive motor or something), I understand if that might not be an option.
- Upgrade the S1 to 0.6.11. Configure the motor as 3 pole pairs, and set the calibration lock-in current to the maximum continuous motor current. In the GUI, after running steps 1-3 in the Apply & Calibrate section of the configuration flow (e.g. erase → apply config → save and reboot), go to the inspector tab and set axis0.requested_state to MOTOR_CALIBRATION, then (when finished, if successful) HARMONIC_COMPENSATION, then (when finished, if successful) ENCODER_OFFSET_CALIBRATION. Then you can go back to the configuration flow, skip step 4 (calibrate, since you just did this), and then save the config normally. The harmonic compensation should greatly help with any encoder nonlinearity caused by improper mounting, and raising the calibration lockin current should help with friction in the motor gearbox. You can also increase calib_scan_distance, e.g. doubling it.
All that being said, what motor specifically are you using? Does it have hall sensors? If so, you can combine the hall sensors for commutation with the magnetic encoder for pos/vel control – this is frequently a recommended approach.