Hello! I am currently trying to control the velocity of a T-Motor GB2208 with an Arduino and a SimpleFOC Mini driver. I am also using an AS5600 magnetic encoder. It’s like the kind on the small white PCB you can get on Amazon. When I run the SimpleFOC open-loop velocity control example code, the motor works great, but when I change to the closed-loop control with a PID controller, it doesn’t. Instead of moving at some set velocity, it holds its position. It’s not dead, it’s applying torque to the motor, but not only is it not rotating, but it’s not letting me rotate it. It does the same thing in the Torque control example; however, instead of just applying a constant torque to hold its position, regardless of the value I set to the motor as it does in velocity control, it actually reflects what I set the voltage to be. For example, it’s way harder to move it out of its position when I set the voltage to 6 than when I set it to 2. There clearly seems to be something going on with the encoder, but I don’t know what. When I ran the SimpleFOC as5600 example code, it read accurate values. It does, however, hit a minimum twice in a 360-degree rotation for some reason, which means the direction is not always accurate. Here’s the serial port I got when it initialized:
MOT: Init
MOT: Enable driver.
MOT: Align sensor.
MOT: sensor_direction==CW
MOT: PP check: fail - estimated pp: 23.41
MOT: Zero elec. angle: 4.33
MOT: No current sense.
MOT: Ready.
Obviously, the pole pair count is not 23.41, it’s supposed to be 6 for this motor, so that’s another reason why I think something’s wrong with the encoder, but again I have no idea what, because it gives good values in the example code. How should I go about fixing this?