2 in 1 hotend with one stepper motor and servo drive for switching between the rockers of the clamping mechanism for two filaments

Good day to all! I am trying to realize the possibility of two-color 3D printing through one hotend and one stepper motor. The essence of the idea is that there is a servo motor, two clamping mechanisms and one stepper motor. Two different filaments are pressed against the shaft of the stepper motor on both sides. When it is necessary to change the plastic, we roll it out of the hotend and use the servo motor to switch the mode to the other side. I managed to create a prototype of the mechanism, but there were difficulties with the implementation of the software part. I need to make it so that when I change from T0 to T1, my only stepper motor changes its direction in the opposite direction. I tried to create an extruder1 with the same parameters, but inverted dir_pin. Klipper complains that this parameter has already been activated. Can you tell me how to implement the change from T0 to T1 with dir_pin conversion? Thank you in advance!

Just don’t use two extruders, use only one and just do the switching to other filament.

As I remember almost all slicers have support for custom GCode for switching extruders - just use it for switching servo.

Another approach - you can override GCode which is responsible for switching and just do servo switch.

This is understandable about switching servers and commands, but the essence of the issue is different. I have the thread on the other side, so I need to invert the rotation of the motor. That’s why I created a post asking how you can reverse the rotation of the engine? I couldn’t find a solution to this issue.

From Configuration reference - Klipper documentation

dir_pin:

More on this:

dir_pin:
#   Direction GPIO pin (high indicates positive direction). This
#   parameter must be provided.

Pin names may be preceded by ! to indicate that a reverse polarity should be used (eg, trigger on low instead of high).


One request:

When you write longer texts, please give them some structure (paragraphs etc). Such a long block like in your first post is hard to read.

About the sign “!” I know. The bottom line is that we can apply it once when working, for example, with the left bar. When we change the instrument to the right duct, we need to change the dir_pin value there. But the whole problem lies in the fact that we cannot change this parameter and the pin value in macros, for example, in T0 and T1. My question is how to change the rotation of the same stepper motor when changing the tool, provided that we cannot prescribe one specific pin in one or more sections. Please read the topic and the question to it more carefully!

It would be way more easy if you would not write such long spaghetti texts.

Oh, i see …

Then you can try to do it following way:
Switch your slicer to Relative extrusion mode (M83),
Then override G1 with your new wrapper (G0 is forwarding everything to G1).
That wrapper should check which extruder is active now and if it’s second one - then just flip E sign (if you did receive E1.27, change it to E-1.27 and vise versa)

Another approach is to customize gcode_move.py file to handle your case - but it will require from you to maintain it after each upgrade of klipper.

I’m running a DIY MMU 5in1 solution, based on this config
sample-mmu2s-diy.cfg (line 80 and below, load / unload macros)
Some of the macros are not well written, but they give you an idea of how to solve the problem
hints:

  • Macros are evaluated as a whole. If submacros are called, then they are executed afterwards, regardless of where the call is in the macro. This sometimes makes the whole thing complicated, e.g. when using “if”
  • using relative extrusion will help alot
1 Like

To reverse the rotation of an extruder at runtime one can use the SET_EXTRUDER_ROTATION_DISTANCE command: G-Codes - Klipper documentation

Typically, one would put that command in T0 and T1 macros, as many slicers will emit those commands on filament changes.

-Kevin

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.