[SimpleFOC Shield V3.2] Detecting mechanical endstops via current spike at initialization

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:

  1. 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?

  2. Does the SimpleFOC library expose a reliable current reading (e.g. via motor.current.q or current_sense.getPhaseCurrents()) that I can monitor in a loop?

  3. 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)?

  4. 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!

I’d watch for the angle to stop changing rather than a current spike. Probably the simplest method would be a timeout if velocity stays below some small threshold. Just set the current limit to something that will never overheat or damage the mechanism by over torque.

I think v3.2 of the shield has ACS712 which will be a bit noisy. v3.7 has INA240 which is less noisy but costs twice as much and wastes a bit of power in the sense resistors. Either one is fine.

Thank you dekutree64
Where can I find the v3.7?