Bad Speed Measurement MA732

Hi everyone,

I’m facing an issue with position and speed measurements using an ODrive Pro and an MA732 encoder (SPI communication), and I’m struggling to identify the root cause.


Setup

  • Controller: ODrive Pro
  • Encoder: MA732 (SPI)
  • I also tested reading the encoder with a Raspberry Pi, and I observe the same behavior

Mechanical configuration

  • The motor has an external rotor with a static shaft, so I cannot mount the encoder on-axis
  • I designed a 3D-printed part fixed to the rotor, on which I mounted a ring magnet
  • The encoder is placed off-axis

More precisely, the geometry is the following:

  • The distance between the motor axis and the sensing center of the encoder is equal to the external radius of the ring magnet
  • So the center of the sensor is aligned radially with the outer edge of the ring magnet
  • The sensor is not facing the magnet radially
  • Instead, it is oriented parallel to the motor axis and “looks” along the axis direction, towards the motor

In other words, the sensor is positioned beside the rotor, at the same radius as the outer edge of the magnet, and measures the magnetic field along a direction parallel to the shaft
(see schematic)

Observed issue

At low speed (when I rotate the motor slowly by hand):

  • The measurements look correct
  • I observe one acceleration followed by one deceleration
  • The position evolves smoothly

At higher speed (still by hand, but faster):

  • The measurements become incorrect
  • I observe multiple acceleration and deceleration events, even though I only applied a single impulse
  • This suggests that the position measurement is also corrupted

Additional checks

  • I initially suspected an ODrive configuration issue
  • However, when reading the encoder directly via SPI with a Raspberry Pi, I observe the same behavior
    → So the issue likely does not come from ODrive itself

Hypothesis

I am considering possible magnetic disturbances:

  • The shaft is ferromagnetic (but uniform over one revolution)
  • The magnet has about 1.28 T internal flux density
  • Intuitively, I would expect the magnet field to dominate

What I find surprising:

  • The issue appears only at higher speed
  • And results in multiple speed peaks for a single motion input

Measurement example

I recorded several manual accelerations (7 attempts with increasing force):

  • The first two measurements look correct
  • The following ones show multiple speed peaks, even though each corresponds to a single acceleration of the motor

Questions

  • Could this be due to magnetic field distortion from the motor or shaft?
  • Could this off-axis + axial measurement configuration create angle errors that worsen with speed?
  • Could this be related to sampling / aliasing / SPI timing issues at higher speed?
  • Has anyone seen similar behavior with the MA732 in non-standard geometries?

Any insights or similar experience would be greatly appreciated!

Thanks in advance :pray:

Thank you for all the information!!

This is textbook off-axis sensing – it introduces a periodic error in the sensed position, that needs to be compensated. You can write to registers in the MA732 itself to do this compensation in the chip itself, but the ODrive has much more fine-grained compensation it can do onboard.

Note you have to be careful with ring magnets – there’s a big dead zone in the field strength right where you have the MA732 mounted right now. You ideally want it to be aligned more above the magnet, or a bit further out.

Specifically this is because the field sensor needs to be able to sense a radial component to the magnetic field, but there’s a general region (denoted by the red line) where the flux vector is primarily vertical. So having it more on either side of that line is best. Usually people will position it around one of the two blue boxes.

This is a really great tool to find the ideal sensor location: https://sensors.monolithicpower.com/

Then once you have the k value from the simulation, you can write it to off_axis_k on the ODrive: ODrive API Reference — ODrive Documentation 0.6.12 documentation

Then, you’ll want to run harmonic compensation to fine-tune any distortion.

After that, you can run encoder calibration as normal, and it should work fine!