EtteGit / EnragedRabbitProject

GNU General Public License v3.0
2.38k stars 338 forks source link

Use Stallguard to detect the filament hitting the extruder #150

Open whi-tw opened 2 years ago

whi-tw commented 2 years ago

Rather than just ramming the filament into the extruder gears, allow people to use stallguard to detect the extruder a little more gently.

This will need documentation in the PDF, as tuning the stallguard threshold is important.

whi-tw commented 2 years ago

this could be something to put on the pile of options, because of potential 'sticky' buffers

sloscotty commented 2 years ago

I want this too. I will definitely give it a try!

ningpj commented 2 years ago

would like to confirm the physical setup to enable this with easy brd - i have tried with the jumper set to aux (PA7) and diag pin hardwired but cant see any evidence the "self.gear_stepper.do_homing_move(max_length, 5, self.gear_stepper_accel, True, True)" attempts to move the gear selector to home to the bmg gear. If i shorten the reference calibration length to pull up short, the motor fails to move the filament and the load will error reporting no progress detected by the encoder

whi-tw commented 2 years ago

would like to confirm the physical setup to enable this with easy brd - i have tried with the jumper set to aux (PA7) and diag pin hardwired but cant see any evidence the "self.gear_stepper.do_homing_move(max_length, 5, self.gear_stepper_accel, True, True)" attempts to move the gear selector to home to the bmg gear. If i shorten the reference calibration length to pull up short, the motor fails to move the filament and the load will error reporting no progress detected by the encoder

@nigelpjames I'm honestly not 100% sure about easy brd - I'm using fysetc/fysetc-erb on my ERCF.

The way I did the calibration was:

  1. Push the filament manually all the way to the end of the reverse bowden, until it hits the extruder gears, then pull it back about 1cm.
  2. set the TMC stallguard threshold for the gear motor as-per Finding the right StallGuard threshold to ~100 as a start point
  3. RUN ERCF_HOME_FILAMENT_TO_EXTRUDER and observe the console, and physically on the machine, to see if the filament moves.
  4. As-per the voron docs above, keep changing the SGTHRS parameter for the gear motor, until you are happy with the homing.

The value for SGTHRS is very dependant on your individual setup. Things like the bowden ID, bowden length, your buffer setup etc are all factors which can vastly change the experience.

Frankly, I'm not super happy with this, and I have stopped using it on my setup - mostly because my filament buffer solution is super shitty. once I have that optimised, I'll revisit this. For now, as I can't very well test it, it's mostly a POC.

ningpj commented 2 years ago

@nigelpjames I'm honestly not 100% sure about easy brd - I'm using fysetc/fysetc-erb on my ERCF.

The way I did the calibration was:

  1. Push the filament manually all the way to the end of the reverse bowden, until it hits the extruder gears, then pull it back about 1cm.
  2. set the TMC stallguard threshold for the gear motor as-per Finding the right StallGuard threshold to ~100 as a start point
  3. RUN ERCF_HOME_FILAMENT_TO_EXTRUDER and observe the console, and physically on the machine, to see if the filament moves.

Thanks for the guidence. I had an issue with a crimp on my diag -> aux connector patch cable i made up for the easy brd and have it working now. Works really well with my setup and will keep testing and provide feedback. Less stress on the ercf and build up of filiment grinds in the carts

ningpj commented 2 years ago

Seeing more frequent load and prints abort with "!! No trigger on manual_stepper gear_stepper after full movement when loading to extruder"....will keep playing around and tweaking stall guard threshold and cart adjustment & tophats to tune. had no issues with standard sensor-less logic branch with this setup...WIP

ningpj commented 2 years ago

These "!! No trigger on manual_stepper gear_stepper after full movement" are a pain as they instantaneously abort the print...guess its not a problem when homing x&y but a major when 150 changes into a print and a filament change doesnt go to plan. Unsure how to over come this at this stage and have reverted to normal sensorless mode for the time being

ningpj commented 2 years ago

After further research it appears the "!! No trigger on manual_stepper..." may have been due to my system still running with gear stepper microsteps set to 8 vs 16 to work around an earlier issue with serverless code & too many interrupts on Easy Brd's....and probably an overly cautious stall guard sensitivity. Now running with 16 microsteps & 65 stall guard threshold and havent had a repeat issue for 200+ swaps. I also noticed loads would occasionally fail after built up filament tension against the BMG gears was released abruptly causing the filament to back out of the gears and not grab. I'm currently testing with a 2mm extruder pre move added to _load_to_nozzle prior to releasing the servo and continuing the _load_to_nozzle process (theres plenty of slack in the 2.5mm ID ERCF bowden to the extruder). So far so good and have observed a drastic improvement in swap reliability. Stall guard appears to be the way to go as its much less brutal on filament and carts (possibly ok with harder TPU options as well). With the other sensor-less approach, depending on filament it would often end up grinding chunks before the encoder detected no filament movement.

ningpj commented 2 years ago

ok, net-net with stall guard enabled, any fault feeding filament through to the gearset that causes klipper to exceed the max homing distance will result in a "!! No trigger on manual_stepper..." error and your print to abort. the homing safe guard is deliberately brutal and experienced occasional faults I havent been able to tune out such as a bad spear/tip or a filament grind that prevented it from advancing and exceeding the limit.

miguelangel-nubla commented 2 years ago

This is working phenomenally for me, no more filament grinding.

Just one small issue, when the 50mm Stallguard-home-to-extruder movement runs, it reaches the extruder, stops as expected but stays paused for some seconds. Looks to me like does not matter if it reaches the extruder in 5mm or 45mm, it adds a wait after stopping and ends up with the time that would take to move the full 50mm requested. As far as I am aware, when doing Stallguard homing on the printer axis it continues right on. I am not familiar with the internal Klipper functions, maybe someone else knows how to make it continue right away.

whi-tw commented 2 years ago

@miguelangel-nubla I've noticed this too. I'm not 100% sure exactly where the delay is coming from. I wonder if there's some internal 'clear the stallguard flag' routine going on here, which causes the delay, maybe.

Happy to take suggestions from anyone who knows more about this!

kovmarci86 commented 2 years ago

For "!! No trigger on manual_stepper gear_stepper after full movement": Just came across this function in Klipper (I'm was just searching for something related):

homing_move(self, movepos, speed, probe_pos=False,
                    triggered=True, check_triggered=True):

if you call this with check_triggered=false, you will not trigger:

elif check_triggered and error is None:
                error = "No trigger on %s after full movement" % (name,)

https://github.com/Klipper3d/klipper/blob/9c45f53b24754fb92e03836e22796d06ab1e9825/klippy/extras/homing.py#L68

edit: I think this is the last parameter here https://github.com/EtteGit/EnragedRabbitProject/pull/150/files#diff-3347b23c4e7c6e72e5d49df7776d1d54d132fa733c3747d3657e7939351fe580R1005