How to capture loss of motor zero angle calibration?

An interesting challenge appeared - if you use the AS5048 and attached the magnet to a motor using 3d printed fidget and if you overheat the motor, the fidget can offset a bit. As a result, the calibration gets lost during motor operation and motor heats even more and this becomes a runaway condition.

Simple solution is to use something, which does not get soft at 100deg.

I was looking for some inspiration if there might be a way to catch this loss of calibration while motor is operating?

Appreciate any ideas? direction?

Is the magnet glued to the axle? What glue are you currently using? I’m using super glue.

This is probably not the answer you want, but at 100 deg C you are in danger of permanently damaging your motor magnets - they’ll start to demagnetise at 80+C. So perhaps the solution is not to run your motor this hot. Are you running in open loop? Closed loop will likely run a lot cooler than open loop.

Thanks Owen - superglue it will be.

My question was more about how to catch this error in firmware. I can hear when calibration is being off as the motor is making a much louder hissing sound (unscientific and unspecific, I know) - so was wondering if there is a a way. Only thing comes to mind is with current consumption at idle speed - is so this means new board design. Perhaps motor reaction to voltage ramp - that’s when hissing goes louder?

Tricky to answer this as I’m guessing most people don’t have problems with it decalibrating!!

Your code could observe if the target velocity (or angle) isn’t being reached
For velocity you could add this pseudo code to your loop:

if (motor.shaft_velocity_sp - motor.shaft_velocity > VELOCITY_ERROR_TOLERANCE)  {
  if (fault_start_time == 0) {
      fault_start_time = millis()
  if (millis() - error_start_time > FAULT_TRIGGER_MILLIS) {
} else {
   fault_start_time = 0;