Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Stallguard to detect the filament hitting the extruder #150

Open
wants to merge 2 commits into
base: no_toolhead_sensor
Choose a base branch
from

Conversation

whi-tw
Copy link

@whi-tw whi-tw commented Sep 8, 2022

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
Copy link
Author

whi-tw commented Sep 8, 2022

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

@sloscotty
Copy link

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

Copy link

@motwok motwok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All in a good idea.

This is a "code" review i never run the changes! (may i do a functional test later)

See remarks for requested changes.

Intresting is that the self.toolhead.wait_moves() is called every time before the measurment is taken from the decoder (except once). I suspect that this code isn't working w/o this call.

It looks like we identified the measurment problem in paralell, see #151 🥇

Klipper_Files/Extra module/ercf.py Outdated Show resolved Hide resolved
Klipper_Files/Extra module/ercf.py Outdated Show resolved Hide resolved
Klipper_Files/Extra module/ercf.py Show resolved Hide resolved
Copy link

@motwok motwok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now i cant find any issues.
Again this is a pure code review, will do a function test soon.

@ningpj
Copy link

ningpj commented Sep 13, 2022

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
Copy link
Author

whi-tw commented Sep 14, 2022

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
Copy link

ningpj commented Sep 15, 2022

@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
Copy link

ningpj commented Sep 16, 2022

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
Copy link

ningpj commented Sep 17, 2022

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
Copy link

ningpj commented Sep 18, 2022

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
Copy link

ningpj commented Sep 21, 2022

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
Copy link

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.

The TMC2209 has stallguard which can be used for sensorless homing of
steppers.

Rather than just ramming the filament into the extruder and watching
for skipping, instead, use the stallguard feature to be a little more
delicate.
* ercf_hardware.cfg
    * reorder [manual_stepper gear_stepper] and
      [tmc2209 manual_stepper gear_stepper] sections, otherwise klipper
      blows up
    * add commented `diag_pin` and `driver_SGTHRS`
* ercf_parameters.cfg
    * add new setting `toolhead_use_stallguard`, defaulting to False
@whi-tw
Copy link
Author

whi-tw commented Oct 10, 2022

@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
Copy link

kovmarci86 commented Oct 14, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants