I am in the process of developing a human control input based on a brushless motor and simpleFOC.
The problem I am facing is the calibration during startup, I don’t think this is very user friendly and can potentially even be dangerous.
Is it possible I can do the calibration once, save some values and then have the motor start up without needing to calibrate?
Thanks in advance and thank you so much for the awesome work!
Hey Luca,
It depends which kind of sensor your are using. For encoders there is no way to do it.
For magnetic sensors you will be able to do it quiet easily.
run the example from utils called: find_sensor_offset_and_direction.ino
it will give you the sensor configuration parameters ,sensor offset and direction
And then just provide it to the initFOC() function
// Something like
motor.initFOC(2.1, Direction::CCW);
// or
motor.initFOC(1.64, Direction::CW);
Hello,
Just additional information, the rotor position tion versus stator is cut in X sectors,
in sector 0 the rotor is between -150º and -90º, so we considered centered at -120º.
in sector 1 is between -90º and -30º, and so on.
If the motor is turning in positive direction the hall transition match with the lowest possible angle of the new sector (sector middle angle - 30) otherwise it match the highest possible angle (sector middle angle +30)
To find the absolue angle of the 3 halls Theta will be at (180/PI) * (HALL_SEQ_120[HallsValue] * 60 - 120 - 30);
what it will approximatively give the offset angle to put to motor.initFOC(offset, direction) ? Is it correct or I make a mistake ? I have tried but it doesn’t seem to work why ? How to do so ?
The hall sensor code hasn’t had a massive amount of testing. I wrote it. It worked for me. I used it with a motor that came with hall sensors already attached (hoverboard motor), sounds like you are trying to add (and correctly place) yours hall sensors. This sounds tough!
I’d suggest you forget about motor.initFOC() initially and just focus in the sensor. Start with the hall sensor example
Are the interrupts triggering? Does this give you any angles? Do they seem sensible? The hallsensor has a public property called state that should change on each commutation.
Any reason you are adding hall sensors when you could be adding magnetic sensors?
Many thanks for your answer, and I think to have finally found, because it works now.
To avoid to use the calibration at the starting with the hall sensors, I wrote in the code:
float offset = PI/(2*PP) // PP is the pole pairs of the motor
…
motor.initFOC(offset, Direction::CW);
…
The reason is that the BLDCs are often provided with their hall sensors, and it is less expensive versus others solution, despite their poor resolution (depends on number of the motor poles).
The magnetic sensors are very interesting, you are quite right, but it stays more expensive than hall sensors even if its resolution is best for the control motor (profile position).