Native Sensorless Homing
Added 2024-12-15 16:02:01 +0000 UTCIf you’ve been following my T250 build, you know I’ve spent considerable time fine-tuning a sensorless homing procedure for the TMC5160 drivers. Achieving consistent results wasn’t easy, but after much experimentation, I’ve developed a over 300 lines long macro that delivers constant results.
The Challenge of Sensorless Homing on TMC5160
In theory, sensorless homing is relatively straightforward: as the stepper motor moves the axis toward its home position, the printer controller monitors the motor's electrical current. A sudden spike in current indicates the motor has "stalled," signaling that the axis has reached a physical stop and can no longer move further.
In practice, however, the process is much more complex. The TMC5160 driver, designed for high-current applications, is inherently less sensitive compared to the TMC2209. This is because its components must handle significantly more noise during current measurement. To achieve a reliable signal-to-noise ratio and detect a stall condition accurately, the TMC5160 requires higher currents.
Higher currents, however, introduce their own challenges. The motor exerts greater force on the axis, and flexible components like belts can stretch under this force, adding noise back into the system. This creates a delicate balancing act: the current must be high enough to produce a detectable spike for stall detection, yet low enough to avoid belt stretching or other mechanical distortions that compromise reliability.
Finding this "sweet spot" is crucial but tricky. It requires a balance where the motor force is low enough to avoid system noise yet strong enough to create a clear signal for stall detection. Unfortunately, the standard Klipper implementation lacks both the tools to fine-tune this balance and the robustness needed for such a sensitive and error-prone homing process.
After weeks of adjustments and testing, I’ve streamlined the process. By integrating my learnings into my Klipper fork, I was able to replace over 300 lines of complex macros with a clean, functional configuration. This new method is not only simpler but also more reliable. Here’s what the configuration looks like:

The Homing Routine: Step-by-Step
Here’s what happens during a homing cycle with this configuration:
Current Adjustment: The stepper driver current is reduced to 1A (home_current).
Stabilization: A dwell time of 0.8 (current_change_dwell_time) seconds ensures the current change settles.
Homing Movement: The toolhead moves at 100mm/s (homing_speed) until a stall is detected.
Scenario 1: Stall Detected Early (<50mm) (min_home_dist)
This could happen if the toolhead is too close to the gantry or if the axis is obstructed. The routine moves the toolhead back by 50mm and retries.
Scenario 2: Stall Detected at Exactly 50mm
Everything is working as expected, and homing is complete.
Scenario 3: Stall Detected Late (>50mm)
An error is flagged, indicating something went wrong during the initial homing attempt.
This new approach not only simplifies the setup but also give you the tools to create a reliable and consistent sensorless homing procedure that stops when something unexpected happend.
Comments
Very good that sensorless homing now works! I was already toying with the idea that I would have to install limit switches...
Stuart
2024-12-15 17:40:42 +0000 UTCI bought the g penny's and they around be good for a fair bit of speed, they don't slouch around. The speedys are nice but if you aren't going for the pinnacle of speed I wouldnt.
Garry
2024-12-15 17:11:33 +0000 UTCWill the g-penny stepers be good enough for the t250 or should I get LDO speedys?
Eamon Thomas
2024-12-15 16:12:38 +0000 UTC