Hi everyone,
I’m working on an application where I need to mechanically home a brushless motor at startup. The idea is simple: on initialization, the motor rotates clockwise until it hits the mechanical endstop, then rotates counter-clockwise until it hits the other endstop. From these two positions I can derive the full range of motion.
To detect each endstop, I would like to rely on the current spike that occurs when the rotor is blocked against the stop — similar to how some stepper motor drivers detect stall via back-EMF or current sensing.
My questions:
-
Is the SimpleFOC Shield V3.2 capable of reading phase current in real time? I know it has inline current sensing pads — are they populated and usable out of the box?
-
Does the SimpleFOC library expose a reliable current reading (e.g. via
motor.current.qorcurrent_sense.getPhaseCurrents()) that I can monitor in a loop? -
What would be a safe current threshold to detect a blocked rotor without burning the motor or tripping the driver? Is there a recommended approach (e.g. rolling average, single-sample peak, timeout guard)?
-
Are there any known caveats with using current sensing on the V3.2 shield (ADC noise, shunt resistor values, calibration needed)?
Below is a rough sketch of the init sequence I have in mind:
// Pseudo-code — homing sequence
motor.voltage_limit = HOMING_VOLTAGE; // low voltage for safety
motor.controller = MotionControlType::velocity;
// Move CW until current spike
motor.target = HOMING_SPEED;
while (current_rms < CURRENT_THRESHOLD) {
motor.loopFOC();
motor.move();
current_rms = read_current();
}
endstop_CW = motor.shaft_angle;
motor.target = 0;
// Move CCW until current spike
motor.target = -HOMING_SPEED;
while (current_rms < CURRENT_THRESHOLD) {
motor.loopFOC();
motor.move();
current_rms = read_current();
}
endstop_CCW = motor.shaft_angle;
motor.target = 0;
Any feedback, code snippets, or pointers to existing examples would be greatly appreciated. Thanks in advance!