How does Stall Detect Homing Work?

Look here to see if your question has already been answered.
Post Reply
User avatar
Doug
Posts: 343
Joined: Fri Feb 02, 2018 4:56 pm

How does Stall Detect Homing Work?

Post by Doug » Wed Dec 23, 2020 5:09 pm

Version 0.4.15 of the Buildbotics Controller introduced "stall detect homing". It's a pretty cool feature if you can get it set up. Unfortunately, configuring it can be tricky. This post is an attempt to explain how to configure it.

Overview

Before attempting to explain the individual configuration settings, it will be helpful to provide an overview of how it stall detect homing works. Here are the highlights:
  • Traditionally, homing has been done by detecting a change of state on a limit switch. Stall detect homing works when the a motor stall is detected. This stall is caused when the axis runs into an end stop.
  • Technically, motor stalls are detected when the controller senses that there is no back emf caused by the rotating motor. Put differently, the controller detects that the motor has stopped turning as it would when it runs into an end stop.
  • The controller can only determine that there is no back emf being generated when no other current is flowing in the motor coil. This happens once per full motor step when the motor coil current is zero amps. At this instant, the only voltage present on the motor connection is from back emf. If there is no back emf at that instant, then the motor must not be turning.
  • The zero current period only lasts for one microstep. The goal is to measure the voltage during this microstep. There is actually a settling period, so it's best to measure the voltage during the last half of that microstep.
  • Back emf varies with the speed at which the motor is turning. If the motor is turning too slowly, the change in back emf will not be distinguishable from noise.
  • If the motor is turning too fast, the axis may hit the end stop too hard and cause physical damage. So, there it a 'sweet spot' in the velocity.
  • It's best not to run the motor at full current during stall detection. That way the torque and physical stress will be reduced when the motor hits the end stop.
  • Configuration is usually done by trial and error and this involves manipulating several variables.
Explanation of parameters
Stall detect homing is configured in the 'Homing' section of the 'Motor' configuration pages.
  • 'homing-mode' should be set to 'stall-min' or 'stall-max' depending on whether you want to detect the maximum or minimum end of the axis.
  • 'stall-microstep' - It can be helpful to reduce the microstepping level used during stall detection. This makes the measurement window a little bigger. Try 8 as a starting point.
  • 'search-velocity' - This sets the speed at which the axis will approach the 'end-stop'. If this speed is too slow, the back emf may not be sufficient to reach the value set in 'stall-volts' causing a stall to be detected even though the axis is still moving.
  • 'stall-volts' - This sets the threshold voltage for the back emf. If the back emf drops below this value, then a stall is detected. If this value is too high, false stalls will be detected. If it is too low, the voltage may not drop low enough during the zero current step to flag a stall.
  • 'stall-sample-time' - This value should be set to cause the system to measure the voltage during the last half of the zero-current microstep. The field to the right of the 'stall-microstep' field reports how many microsteps per second occur at the 'search-velocity'. Use the reciprocal of this number to determine the length of a microstep. For instance, if the field reads '(10.7k usteps/sec)', then the microstep duration is 93 microseconds. In this case, you should select 50 from the 'stall-sample-time' pull-down menu.
  • 'stall-current' - This value sets the motor current to be used during stall detect homing. It is best to reduce this from the full motor current in order to reduce the torque and therefore stress applied when the axis hits the end stop.
  • 'zero-backoff' - this is the distance that the axis will move away from the stall point after the stall is detected. The controller will set this point to the soft limit.
Final note
If you have two motor ports assigned to a single axis, stall detect homing will be a little rough. This is because the stall will be detected on one motor before the other. The motor that has not stalled will not stop stalling until the Controller tells it to stop.

Post Reply