Is it possible to command servo/extruder in g-code with tool change

I have a Prusa i3 with dual extruders with (own make) moving nozzles. Most parts were printed by the printer servo holder, part for moving the extruders and the extruder holder. The nozzles went up and down by a servo (command M340 P0 S720 for T0 and M340 P0 S1200 for T1). The other nozzle does the opposite (coupled). There is a free way (nozzle down) to adjust the high exactly. This works very well when I put in lines by hand in the g-code at tool change. Can this be done automatically? I use Slic3r and Repetier-Host V2.0.5


  • Sure. Firmware has teh possibility to set a start/end gcode for each extruder. Put your command in there. Also conside to add a timeout to M340 so serve gets unpowered after position is set.
  • The timeout is arranged bij adding R2000 at the command (=2000 msec).
    The problem is that I can only put the M340 P0 S720 R2000 or M340 P0 S1200 R2000 at the <Tool change G-code> in Printer settings. If I put both lines there, both are executed. What I need is choose A or B with Tool change. See above. Like IF THAN.
    At the <Extruder 1> or <Extruder 2> tab in Printer Settings there is no possibility to fill in something.
    Hope you can help.
  • Sorry: IF THEN
  • Not sure where you try to change it - I was talking about firmware solution, so you must edit configuration.h best with config tool. There you have per extruder:

    /** You can run any GCODE command on extruder deselect/select. Separate multiple commands with a new line \n.

    That way you can execute some mechanical components needed for extruder selection or retract filament or whatever you need.

    The codes are only executed for multiple extruder when changing the extruder. */

    #define EXT0_SELECT_COMMANDS "M117 Extruder 1"


    So you have one script per extruder, no overlapping.
  • I did as you said and it works very good. It is strange that they sell 3D-printers with two nozzles without any information about that.
    Again THANX.
Sign In or Register to comment.