Hello everyone,
I have a lot of small bldc motors with hall sensors that I really want to get working with the odrive.
To get the pole count I connected two leads of the motor to a bench power supply and rotated the motor for a single revolution and counted the snapping positions. This ended up being 8 snapping positions. So there should be 16 pole pairs according to this guide.
Since I don’t know the correct wiring for the 3 hall leads I tried all 6 combinations and two of them worked without given an ERROR_ILLEGAL_HALL_STATE
error.
So now should having the correct wiring I run a full calibration sequence. But I get an ENCODER_ERROR_CPR_POLEPAIRS_MISMATCH
error.
Investigating further I checked odrv0.axis0.encoder.shadow_count
and then manually turn the motor for a single revolution and check odrv0.axis0.encoder.shadow_count
again. This turned out to be 36 counts. So that would mean I have 6 pole pairs and not 16? Anyway to test I set odrv0.axis0.motor.config.pole_pairs
to 6 and odrv0.axis0.encoder.config.cpr
to 36. But still the ENCODER_ERROR_CPR_POLEPAIRS_MISMATCH
error is occuring.
I’m not sure what to do now. How can I figure out the pole pairs?
Here is the full set of commands I ran in odrivetool
:
odrv0.axis0.motor.config.torque_constant = 1
odrv0.axis0.motor.config.pole_pairs = 6
odrv0.axis0.motor.config.current_lim = 1
odrv0.axis0.motor.config.calibration_current = 1
odrv0.axis0.encoder.config.bandwidth = 100
odrv0.axis0.controller.config.pos_gain = 1
odrv0.axis0.controller.config.vel_gain = 0.02 * odrv0.axis0.motor.config.torque_constant * odrv0.axis0.encoder.config.cpr
odrv0.axis0.controller.config.vel_integrator_gain = 0.1 * odrv0.axis0.motor.config.torque_constant * odrv0.axis0.encoder.config.cpr
odrv0.axis0.controller.config.vel_limit = 10
odrv0.axis0.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL
odrv0.axis0.encoder.config.mode = ENCODER_MODE_HALL
odrv0.axis0.encoder.config.cpr = 6 * odrv0.axis0.motor.config.pole_pairs
odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
Below is a picture of such a motor where the rotor has been removed.