AS5048A Sensor Initialization at Negative Angle

Hello, I’ve encountered an odd behavior when running stand-alone SPI sensors (AS5048A, using sensor.get_angle()). Using the example provided here ( Magnetic sensor SPI | Arduino-FOC ), if the sensor is initialized at a positive (physical) angle, it works as expected, but if it is initialized at a negative angle, it will report values with an offset of 2 pi radians. (e.g. initializing at a physical angle of -0.01 radians, the sensor reading will be +6.27 radians.)

Since my mechanism has relatively limited travel, I can just apply a conditional offset after initialization, but I didn’t see any previous discussions of this issue, so hopefully this will save somebody time in the future.

1 Like