Arduino-FOC
Arduino-FOC copied to clipboard
Magnetic Sensor find the wrong sensor direction bug
During the initialization of magnetic sensor, if the direction of rotation is not set, the program will execute to find the direction of rotation. When I use this feature, the AS5600 magnetic sensor sometimes find the wrong direction. The code rotate the motor and check the data of magnetic sensor during the rotation to find the rihgt direction. Maybe the wrong direction because the initial data of magnetic sensor is not correct, so I add sensor.update() during the rotate of the motor:
for (int i = 0; i <=500; i++ ) {
float angle = _3PI_2 + _2PI * i / 500.0f;
setPhaseVoltage(voltage_sensor_align, 0, angle);
sensor->update();
_delay(2);
}
Thank you! Just by chance we have a pull-request from another user with exactly this change. It will be merged soon, and will be part of an upcoming release soon now!