Thank you for your help!
About the I2C signal and DIR pin, I have 4.7k pullups, and I have tied the DIR and GP0 to GND/VCC.
I have tried adding a print statement during calibration, more precisely in BLDCMotor::alignSensor(), I now print the angle read during cw and ccw movement. And I find something interesting.
// find natural direction
// move one electrical revolution forward
for (int i = 0; i <=500; i++ ) {
float angle = _3PI_2 + _2PI * i / 500.0f;
setPhaseVoltage(voltage_sensor_align, 0, angle);
sensor->update();
SIMPLEFOC_DEBUG("TEST: angle:", sensor->getAngle());
_delay(2);
}
I modified the code so, when the calibration is done and the result is printed out, the ESP32 restarts itself and redoit again. This way I can just let it work and save the log in a file and then analyze it. I have run two tests:
- The first one, I just leave the ESP and the motor doing their calibration.
- During the second test, I just move the motor randomly so every calibration starts in a different angle.
And here are the results for test one, it is amazing how similar they are, I have check the log and yes, there is no problem in the script, the data are as similar as is shown in the graph. Also notice some startup movement in the bottom left side. However, with this results, I would say that the sensor is working pretty nice.
Lets go with the second test, where I change the starting position of the motor before running the calibration. And here are the results…
Now we can see that there are huge movement spike during startup which may affect the results. Also, here the movement is not consistent between runs. I will try to run this test with different magnet configuration, or different magnet holder to check if I can improve this. Nevertheless, it is impossible to calculate the PP with this data, is so random.
I will keep investigating, I just leave this here if someone is interested in this problems.
Thank you all

