How to tune Stall Detection?
-
From comparing other motors, I estimate the inductance of that motor to be about 8 to 10mH. What maximum Z speed at full torque does that give?
-
I am not 100% sure, if all the other values I have are correct.
I took them from this site: http://www.mytechnologie.de/2017/05/22/projekt-3d-drucker-die-motoren/I suppose by "maximum Z speed at full torque" you mean "Speed at which torque starts to drop (mm/sec), high slip angle".
For 8mH this gives me 32,7mm/s and for 10mH it is 27,9mm/s.
-
No additional suggestions?
This feature was one of the main reasons for buying the Duet -
Is it just the Z motor that you can't get stall detection working on? Does it work on the X and Y motors? How about U?
-
It works on X and Y. I tuned the values until I got no more false detections. S22 seems to be the value to go on these axes.
I tried [c]M915 Z S-50 F0 R1[/c] and [c]M915 P2:4 S-50 F0 R1[/c] for Z but never got stall detections on drives other than 0 and 1 (X and Y).
-
I have added this to my list of pending investigations. I should get to it before the end of this coming week.
-
Great, thank you!
-
Any news on this already?
-
-
Do you have one Z motor or two? If you have two, how are they connected?
-
See this post: https://www.duet3d.com/forum/thread.php?pid=37997#p37997
-
If you run M915 without parameters, what stall detect configurations does it report for drivers 2 and 4?
-
The console does not show the whole response. Seems to be too long:
Driver 0: stall threshold 23, filter off, steps/sec 200, coolstep 0, action: log
Driver 1: stall threshold 23, filter off, steps/sec 200, coolstep 0, action: log
Driver 2: stall threshold -10, filter off, steps/sec 200, coolstep 0, action: log
Driver 3: s -
You can send M915 D# where # is the drive number, to report the settings for a single drive.
-
Yeah, sure.
Drive 4 is the same as 2.
Tried this before with -50 instead of -10 for drives 2 and 4. -
Please can you set up a config.g file and test script (based on your Z homing file) that I can use to test this. I don't mind whether you have 1 Z motor or 2, just so long as I can put those files on a bench test setup and replicate the fault.
-
I have not tried to implement the sensorless Z homing because the stall detection does not seem to work at all and I do not want to damage the printer.
My confi.g is pretty big already but I can send it to you along with a test gcode (which simply moves Z up and down slowly at low current so that blocking the axis should trigger stall detection) as soon as I am at home.
-
That type of test code should suffice.
-
You can download my config.g and the gcode here:
https://1drv.ms/u/s!Al1_ZNc7d8A1k_4Qr_b1D1yZMFp0LQ
At least the network section of the config.g has to be adjusted, of course.
I set the current for the Z motors in the first line of the gcode file so it can be adjusted for testing. -
I also have tuned the stall detection for homing for X and Y, but for Z is getting very hard to tune. Also for an Anet A8 with dual Z motors and threaded rod. According to trinamic Apllication Note for Stall Guard, in order to find the stallGuard Threshold the challenge is to choose a range of speed for operation (https://www.trinamic.com/fileadmin/assets/Support/Appnotes/AN002-stallGuard2.pdf)
My steps for tuning have been the following:
1) Choose nominal phase current
My XYZ steppers are rated for 1A. I am working at 80% to keep them cold. The value on config.g is as follows:[[language]] M906 X800 Y800 Z800 E1200 I30 ; 30% idle factor
2) Choose velocity.
My starting point was DC42 Excel Sheet, that will calculate my maximum speeds. Inserting the specs for my motors I got the following results:
Axis: X Y Z E
Speed at which torque starts to drop (mm/sec), low slip angle: 106.8 106.8 13.2 34.0
Speed at which torque starts to drop (mm/min), low slip angle: 6411 6411 793 2043These values will define my config.g speeds:```
[[language]]
M203 X6000 Y6000 Z700 E2000**3) Search SGT within the range -10 … +10, starting with SGT = 0** I testing started with a S0 for Home X and Y:``` [[language]] M915 X S0 F0 R1
The homing worked fine for X and Y on the first attempt and the stall was detected, however during the print I received a stall notification on each high speed infill. I fine tuned the following homex.g to avoid the false reports on each print:
[[language]] M400 ; make sure everything has stopped before we make changes M915 X S0 F0 R1 ; increase stall sensitivity for endstop homing M913 X50 ; reduce motor current to 50% to prevent belts slipping G91 ; relative mode G1 Z4 F200 S1 ; raise Z to avoid collisions and stop if endstop is switched (if already homed) G1 X-240 F3000 S1 ; Move towards origin and stop if endstop detected G4 P500 ; wait 500msec G90 ; absolute mode M400 ; make sure everything has stopped before we reset the motor currents M913 X100 ; motor currents back to normal M915 X S12 F1 R1 ; Increase StallGuard thresold to prevent false readings
On homey.g the difference is the StallGuard thresold M915 Y S17 F1 R1 because Y stepper continued giving false readings. This might be because the Y motor moves the bed with the print and has a higher load than X motor moving a light bowden carriage. Probably I will have to tune it higher for big prints that might add extra load due to the print weight over the bed.
For the Z motor, however I have not found the settings after many tries. Starting with an speed of 350 the StallGuard will not trigger and will hit the maximum, increasing to >450 it will trigger at the current position regardless of the sensitivity. The following is my text macro that I have used:
[[language]] M574 Z2 S3 ; set Z-max to use motor StallGuard M400 ; make sure everything has stopped before we make changes M915 Z S0 F0 R1 ; Set StallGuard sensitivity for endstop homing G91 ; relative mode G1 Z200 F450 S1 ; Move towards origin and stop if endstop detected G4 P500 ; wait 500msec G90 ; absolute mode M915 Z S10 F1 R1 ; reduce stall sensitivity to prevent false readings M574 Z2 S0 ; restore settigns Z-max active high switch NC endstops
The second problem that I have not solved is the precision: I tried to use M915 with R3 as opposed to R1 to home and resume printing. I have created a rehome.g file, but on this scenario my test prints stopped on each false report, the print paused executed rehome.g and resumed printing. after each homing I have an offset of 0.2mm.
I do not know how to bypass this offset.