Welcome! Log In Create A New Profile

Advanced

Dual Nozzle, Dual Stepper, Servo Actuated Nozzle - Marlin Settings?

Posted by Swift 
Dual Nozzle, Dual Stepper, Servo Actuated Nozzle - Marlin Settings?
February 27, 2017 04:28PM
Good Day,

I have a printer, with two nozzles, and two steppers (one for each filiment), Nothing unusual so far.

The second nozzle is servo-actuated, i.e it slides vertically to be either above or below the primary nozzle. (thus also requires a Z_HOTEND_OFFSET).

I.e when switching to the second Nozzle, the Z axis should raise by Z_HOTEND_OFFSET, and then the servo should move the second nozzle so it is now below the (fixed) first nozzle.

Note: this is very similar in operation to a "SWITCHING_EXTRUDER" in Marlin (see video below), with the sole difference being a SWITCHING_EXTRUDER has a single stepper motor to drive the two filiments.

Example of a SWITCHING_EXTRUDER: [hackaday.com]


I am seeking how to configure and/or code Marlin for it to work on this configuration. I don't expect it to be too complicated, most of the work appears to be in working out *where* to code. Any pointers appreciated.


Summary: trying to get a printer working, dual nozzle, dual filiment steppers (bowden), and second nozzle is servo-actuated to below/above height of first nozzle. What settings for Marlin?


Thanks.

Edited 1 time(s). Last edit at 03/01/2017 12:06PM by Swift.
Re: Dual Nozzle, Dual Stepper, Servo Actuated Nozzle - Marlin Settings?
March 02, 2017 09:54AM
Solved it. For anyone else looking to do this:

Problem: How to configure Marlin for a: dual-extruder, extruder E1 height toggled by servo, X / Y / Z Offsets required, individual stepper motor for each extruder/filament.

In this configuration: E0 is fixed in space, with E1 parked above. When E1 is in use, it is lowered by the servo to be below the position of E0 - hence X & Z Offset is required, and Y is good to have for fine tuning.


This configuration could be considered a subset of Marlins "Switching_Extruder". The only difference being we have a seperate stepper for each extruder, instead of a single shared stepper. So we add a new #define SWITCHING_EXTRUDER_WITH_MULTIPLE_STEPPERS


The following solution is not ideal or refined, but it works well, including here in case it helps someone (or I get better guidance) until I have a more permanent solution - such as a recode of Marlin to support a servo (and Z Offset) for every extruder.

Notes: "...." means "include the existing code from Marlin, unchanged"
1)
in Configuration.h, alter the following as follows:
#define EXTRUDERS 2
#define SWITCHING_EXTRUDER
#if ENABLED(SWITCHING_EXTRUDER)  
  ...
  #define SWITCHING_EXTRUDER_WITH_MULTIPLE_STEPPERS
#endif

2)
At the bottom of ConditionalsLCD.h, add the following:
    #if ENABLED(SWITCHING_EXTRUDER_WITH_MULTIPLE_STEPPERS)
    #undef HOTENDS
    #undef E_STEPPERS
    #undef E_MANUAL
    #undef TOOL_E_INDEX
    #define HOTENDS      EXTRUDERS
    #define E_STEPPERS   EXTRUDERS
    #define E_MANUAL     EXTRUDERS
    #define TOOL_E_INDEX current_block->active_extruder
  #endif
#endif //CONDITIONALS_LCD_H

3)
In Indirection.h, find the following block of code:
#if ENABLED(SWITCHING_EXTRUDER)
  #define E_STEP_WRITE(v) E0_STEP_WRITE(v)
  #define NORM_E_DIR() E0_DIR_WRITE(current_block->active_extruder ?  INVERT_E0_DIR : !INVERT_E0_DIR)
  #define  REV_E_DIR() E0_DIR_WRITE(current_block->active_extruder ? !INVERT_E0_DIR :  INVERT_E0_DIR)

and change the #if statement to:
#if ENABLED(SWITCHING_EXTRUDER) && (!ENABLED(SWITCHING_EXTRUDER_WITH_MULTIPLE_STEPPERS))

Thats all. You should now be able to tune your X/Y/Z offset between E0 and E1 with M218
e.g
M218 T1 X20 Z-2
will set the offset of E1 as shown

And then you can test the Nozzle servo activation/offset/toolchange with just "T1" and "T0"
Re: Dual Nozzle, Dual Stepper, Servo Actuated Nozzle - Marlin Settings?
March 02, 2017 11:25AM
Awesome!
What happens during tool change? Does the planner wait for the servo?
Re: Dual Nozzle, Dual Stepper, Servo Actuated Nozzle - Marlin Settings?
March 02, 2017 01:47PM
Yep it does, in the existing Marline code, there is forced half second delay.

A hardcoded magic number (delay(500)) on line 6792 of Marlin_main.cpp

I'll post the relevent section from the marlin code below:

void tool_change(const uint8_t tmp_extruder, const float fr_mm_m/*=0.0*/, bool no_move/*=false*/) {
          <...code cut here....>
          #if ENABLED(SWITCHING_EXTRUDER)

            // <0 if the new nozzle is higher, >0 if lower. A bigger raise when lower.
            float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder],
                  z_raise = 0.3 + (z_diff > 0.0 ? z_diff : 0.0);

            // Always raise by some amount
            planner.buffer_line(
              current_position[X_AXIS],
              current_position[Y_AXIS],
              current_position[Z_AXIS] + z_raise,
              current_position[E_AXIS],
              planner.max_feedrate_mm_s[Z_AXIS],
              active_extruder
            );
            stepper.synchronize();

            move_extruder_servo(active_extruder);
            delay(500);

            // Move back down, if needed
            if (z_raise != z_diff) {
              planner.buffer_line(
                current_position[X_AXIS],
                current_position[Y_AXIS],
                current_position[Z_AXIS] + z_diff,
                current_position[E_AXIS],
                planner.max_feedrate_mm_s[Z_AXIS],
                active_extruder
              );
              stepper.synchronize();
            }
          #endif

Edited 1 time(s). Last edit at 03/02/2017 02:47PM by Swift.
Re: Dual Nozzle, Dual Stepper, Servo Actuated Nozzle - Marlin Settings?
May 25, 2017 09:53AM
Thanks a lot mate.
You helped me really a lot with that Code. I had the exactly same problem, but I would have never be able to solve it winking smiley
Re: Dual Nozzle, Dual Stepper, Servo Actuated Nozzle - Marlin Settings?
November 14, 2018 04:56PM
Hi Everyone
Thank you very much for the detailed information on switching extruder. Im looking for a version to configure dual extruder for my project. If someone can help me with the actual version of Marlin that can do this job.
Thanks in advance.
Avishek.
Re: Dual Nozzle, Dual Stepper, Servo Actuated Nozzle - Marlin Settings?
November 14, 2018 07:04PM
I am sure Marlin would do a great job.

Personally, I ended up switching from Marlin to Klipper for my dual extrusion needs: [github.com]
Hi Swift,

Would you be able to provide the enire code (package) that i can upload and test?
Tried to work with change/modifications from marlin 1.1...getting several errors.
I'm using Arduini 2560+Ramps 1.3 +A4988 stepper drivers.

Would be very helpful if you can provide the wroking code.

Thank you very much.
Re: Dual Nozzle, Dual Stepper, Servo Actuated Nozzle - Marlin Settings?
April 06, 2019 01:36AM
The" Switching Extruder" can use two extruder motors and single motor also ok.
Sorry, only registered users may post in this forum.

Click here to login