MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.16k stars 19.21k forks source link

[FR] Sensorless Sensitivity autotune #19005

Open hackebike opened 4 years ago

hackebike commented 4 years ago

Some drivers like TMC 2209 or TMC 2226 have StallGuard for sensorless homing or probing.

It would be great to have a autotune feature to find the sensitivity value to set for the X/Y/Z driver's sensitivity. I have found that same driver like 2209 have different values for X/Y/Z so it's always difficult to find the correct sensitivity value. Right now cannot find a correct sensitivity value for 2226 on Y/Z but for X found to be 65 !

An autotune would help a lot instead of going through all 256 values for each axis.

Der-WU commented 4 years ago

Nice FR. But is it possible? I Hope....

hackebike commented 4 years ago

Not sure but it would be great! I am trying to find a value for sensitivity on TMC 2226, found one for X but cannot find one for Y and Z. On 2209 found all. But it's a pain doing it manually!

ellensp commented 4 years ago

not really possible... how can it tell that it is smashing into the end of travel when sensitivity is wrong...or it just hitting a slightly rough patch and it not really at the end of travel? It can't.

It also depends on a number of factors... driver current, rate of movement, type of stepper driver... for some combinations there is no value that will work.

hackebike commented 4 years ago

StallGuard works to detect those situations, so it should be possible to do an autotune detection.

ellensp commented 4 years ago

Only when its already configured. catch 22

hackebike commented 4 years ago

Where is the code StallGuard defined ?

tesla128 commented 3 years ago

Turn off StallGuard Move backwards 10mm (all numbers configurable) Turn on StallGuard Move forward 10mm. decrease sensitivity if stalls early. Repeat until 10mm movement is consistent Move forward until stopped decrease sensitivity 10% Move back and forward again If stopped again, stop If axis is not at end-stop, re-run tuning with minimum sensitivity from previous run or EEPROM value if reset

Might not be perfect, but seems like it would give a good starting point over poke-and-hope