Hello, I’ve had a request from my mechanical engineering collaborator, for my firmware to detect when the sensor (AS5600) has lost connection to my microcontroller (ESP32-S2). I am using the SimpleDCMotor library to request a DC motor to ramp up to velocity, hold a velocity, ramp down velocity back to zero, and then repeat. This part works great.
The problem is that sometimes unexpected mechanical errors occur: the shaft magnet loses alignment with the sensor PCBA, or a cable gets mistakenly disconnected or shaken loose. When this happens, the SimpleDCMotor library instructs the motor to spin up to maximum velocity as it attempts to meet a target velocity without any feedback from the sensor.
Is there a way I can enforce a simple check in my code to check that the sensor is still present? If I could do this, I can stop the firmware, and throw up an error code for him.
Thank you!
Aran
(Yes, my collaborator is also working on making sure this error never happens in the first place, but I would still like my code to be fail safe)