I’m working with a project that uses AMT212B encoders to commutate some BLDC motors. These are absolute encoders, with a non-volatile, user-settable zero.
I’m “sprucing up” everything in preparation for a public demo, and to streamline the startup sequence I’m trying to eliminate the need for each motor to run sensorAlign() on startup. For the purposes of the project, I have several identical systems (MCU + multiple BLDC motors) that I need to have running the same code, so simply hardcoding the correct zero angle offset isn’t a viable option. Instead, I would like to write a “calibration script” that zeros the encoders at the correct angle, so I can set all motors’ zero_angle_offset to zero in code, and skip the sensorAlign() step at startup.
I had been planning to simply replicate the steps of
sensorAlign() in my own code but replace the line
zero_electric_angle = electricalAngle() with
ZeroEncoder(), but I’m finding I can’t do that since
setPhaseVoltages() is a private function. Does anyone have any advice for how to replicate the functionality of
sensorAlign() in my own code?