Hall-sensored motor jumps around during calibration and then produces error

Hi everyone,

I’m trying to setup a Maxon EC45 hall sensored motor (datasheet here) with ODrive. When I run the full calibration sequence, the motor beeps and then jumps back and forth very quickly by about 30 degrees several times (I know this behavior isn’t correct as it should turn slowly).

I did successfully set up one of these motors previously, so I know it can work, but I guess something is off with how I’m using this one.

This is my setup process:

odrv0.axis0.motor.config.current_lim = 5
odrv0.axis0.motor.config.calibration_current = 2
odrv0.axis0.motor.config.pole_pairs = 8
odrv0.axis0.encoder.config.mode = ENCODER_MODE_HALL
odrv0.axis0.encoder.config.cpr = 48
odrv0.axis0.encoder.config.bandwidth = 100


odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

Running dump_errors after the calibration shows:

axis: Error(s):
motor: no error
encoder: Error(s):
controller: no error

I’ve checked as much as I am able to that the encoder is wired correctly:

+5V -> Motor Pin 3 (Vhall)
A -> Motor Pin 1 (Hall sensor 1)
B -> Motor Pin 2 (Hall sensor 2)
Z -> Motor Pin 5 (Hall sensor 3)
GND -> Motor Pin 6 (GND)

I tested with a short detector on a multimeter to make sure that the pins on the ODrive are connected to the sensor outputs in the motor. I tried switching the encoder pin connections around to a few different combinations, but I’m not sure that that matters? (Am I right in thinking the sensors are like the 3 phases of the motor, switching any of them only changes directionality, which is accounted for in calibration?)

I checked the encoder signals using an Arduino, and they seem to look as they should (high value is a solid 5V):

Additionally, turning the motor one “step” at a time while repeatedly checking odrv0.axis0.encoder.hall_state shows the hall state cycling between 1 - 6.

What else could I try to debug this? Thanks for your help.


I ended up just taking the setup apart and making all new connection cables, and it works great now.

I guess it was something connection-related that I missed. I’m not sure what was wrong before, but a guess would be that one of my motor lead connections was unreliable or accidentally shorted to one of the other motor leads. (Since the encoder connections were easily verifiable, but the motor characteristics are harder for me to check by hand)

For future reference and general BLDC curiosity, if anyone has an idea of a specific cause for that behavior, I’d be interested to know.

1 Like

Hi @isabel I would like to use two Maxon EC45 Flat to drive a mobile robot.

So I wonder if you have any feedback about these motors and if you have any tips to use it with the Odrive.

Thank you!

Yes I’ve been using these motors in a few places. (For what its worth, I later found out that this thread’s particular issue was caused by a scratch on one of the motor phase PCB traces, likely by my own doing, which led to an inconsistent connection.)

They are excellent motors, maybe the most elegant outrunner available. I’m using them as actuators with position control, which I know is not often done with only hall sensor encoders, but I’m gearing them down by ~50x which gives a fair ~2400 counts per revolution on the output. This is for an animatronic application where the intent is smooth and fast motion, not necessarily precise motion, and due to the shape of the machine there are many places where there isn’t room for encoders, hence my choice of these motors.

I use various combinations of timing pulleys and NEMA 17 gearboxes as reducers, which as expected does entail modifications to the motor shaft. I haven’t tried the Maxon gearboxes that are specifically made for these motors.

I will say that having the connector PCB coming out the side feels a little fragile at times, and has made mounting and wire routing a challenge in some places. I’m considering switching to the versions of the motors that come with the wires soldered on. But as is, still totally workable, and on the whole, for sure the best build quality among the various brands of motors I’m using. Very quiet and smooth motion.

This is the configuration I use with ODrive:

odrv0.axis0.motor.config.current_lim = 5
odrv0.axis0.motor.config.calibration_current = 2

//For testing (very slow):
odrv0.axis0.controller.config.vel_limit = 1500

//For operation:
odrv0.axis0.controller.config.vel_limit = 4200

odrv0.axis0.motor.config.pole_pairs = 8
odrv0.axis0.encoder.config.mode = ENCODER_MODE_HALL
odrv0.axis0.encoder.config.cpr = 48
odrv0.axis0.encoder.config.bandwidth = 1000
odrv0.axis0.controller.config.vel_integrator_gain = 0.001
odrv0.axis0.controller.config.vel_gain = 0.0035
odrv0.axis0.controller.config.pos_gain = 20