I am aware that the rotor position is critical in FOC, but I am using the Hall sensors I get rotor position during Hall transition, please suggest me the algorithm to calculate the rotor position between the hall transitions. I am using the STM32 board, i have the source code but i don’t understand what is implemented, it is complex code. Please advise.
We have a HallSensor class, and we have some examples of using it in our examples directory.
Examples have to be adapted to your pinouts / hardware but it should get you started…
I’d not looked at the SimpleFOC code, but you ask for a suggestion. What you have here is a case where you need to querry the possition of the motoer and want resolution that is MUCH better then what the sensor has. I case I saw was a machine tool where you want to know the rotational position of the spindel but the one sensor was “Index” that gives one pulse per revoltion.
The general algorithm is to use the index ulse to measure phase and rotational velocity. You update the phase the rate once per revolution. Then what iti s time to respond to a position query you computer the estimated position from phase and rate.
This works OK if there is a lot of rotational inertia and th rate can never change quickly
In your case you have three sensors and six “edges” you should be able to update the phase and rate estimates 6 times per revolution. In fact with 6, yo might be able to also track acceleration
The above may or may not be what SimpleFOC does.