Arduino-FOC icon indicating copy to clipboard operation
Arduino-FOC copied to clipboard

Magnetic Sensor find the wrong sensor direction bug

Open lordary opened this issue 3 years ago • 1 comments

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); 
     }

lordary avatar Apr 22 '22 02:04 lordary

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!

runger1101001 avatar Apr 22 '22 07:04 runger1101001