# Homing a stepper motor as an extruder using E0/E1 with an limit switch and end stop

Note: I have extended my question as some of you mentioned that the question is not clear.

I am using a RAMPS 1.4 board with an Arduino mega 2560. I need to drive a stepper motor as an extruder using either E0 or E1. I am using Repetier-Firmware and can drive the extruder (stepper motor) using the E0 (RAMPS 1.4). Now for my application, I need to make sure that the extruder is in home position before it starts to drive for the very first time. I am trying to use a switch to connect to the end stop and perform this homing operation. I can do this for X, Y, and Z axes. I was wondering how (h/w connections and firmware modification) can I do it for the extruder?

• I don't understand why you need to set home for the extruders. – Fernando Baltazar Apr 12 '18 at 5:40
• I want to make sure it is in home position before it starts to move. I need to do this for my project. Thanks! – Osmani Apr 12 '18 at 5:43
• This question is really unclear. Try describing your problem, before your intended solution - this might help people to give you a better answer. – Sean Houlihane Apr 12 '18 at 8:52
• You did not clear it up, unless you mean you want to home the extruder stepper itself? Why would you, the extruder is left in the state the last print left it. You need to prime the extruder anyways at the start and then use G92 E0 to tell the extruder it starts fresh with 0, sort of home. – 0scar Apr 12 '18 at 21:28
• @Osmani Normally the gcode generator, Cura, slic3r, simplify3D always writes G92 0 to set "HOME" just before start printing. At least within these 2 years printing I never had to worry about this. – Fernando Baltazar Apr 12 '18 at 22:44

The edited question appears to mention that the actual extruders of the print head need to home / limit themselves. The answer is that this is not required. When operating direct or Bowden driven extruder setups, you know (or you can measure or find out experimentally) the distance that the filament has to travel from extruder entry to hot end (e.g. to load new filament). If already loaded, because you have printed before, you also know where the filament is (filament could stop after printing, personally I retract the filament en few mm after a print). When a new print starts you usually reverse the retraction at temperature and extrude some extra filament to prime the nozzle to counteract oozed out filament for instance. At that point, the nozzle is primed and the gcode G92 E0 is then used to tell the extruder this is the start at zero length, sort of the home position of the filament. All this is usually done in the start code of your slicer, similar to disabling bed and hot end temperature or final retract is done in the end code of your slicer.

This answer below addresses the initial question, this question was not quite clear. It was phrased as of the head containing the extruders needed to be homed correctly. The normal end-stops (can be mechanical or optical switches) already ensure that the printer head (containing the extruder or extruders) is homed correctly (if correctly configured in your printer firmware). The home offsets you define in the firmware define that you start at the origin (0,0,0).

Your question does not state what firmware you use, but e.g. in Marlin firmware these settings are found in the firmware configuration file.

In this file the following is defined:

// Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS 0
#define Y_MIN_POS 0


These values must be changed according to the offset between your switch and the origin of the heat bed (e.g. Prusa style printers have the origin at the front left).

For my Prusa clone printer I have defined:

// Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS -35
#define Y_MIN_POS -12


What this says is that the homing switch for the X axis is 35 mm left of the origin, etc.

• Thanks, I extended my question for better understanding. – Osmani Apr 12 '18 at 17:55

I think the question has already been answered(if at all possible because the question is still not clear exactly what you mean), but let me try putting this a different way.

You have to ask yourself what is homing and why are you doing it. The purpose of homing your axes is to set their 0 position in space. This then means that any subsequent movements will be relative to these 0 positions and assuming the motors skip no steps should allow accurate positioning of the head inside the build volume throughout the print. In other words their relative position should match their absolute position. As has already been stated the extruder axis does not work like this.

Now I think some of the confusion from your question comes around what you mean by homing the extruder. The extruder position is defined by the previously mentioned X, Y and Z axis. The extruder axis however controls the position of the filament inside the hotend and therefore how much filament is extruded into the build volume. This axis is arbitrarily set to 0 using G92 at the beginning of the print because unlike the spacial axes the absolute position of this axis is not particularly important. Strictly speaking if you were to care about the extruder axis’ absolute position, home would probably be the start of the roll. This however is irrelevant. All that you care about during a print is that the extruder axis remains consistent throughout the print to allow accurate extrusion.

So typically at the beginning of a print you will prime the nozzle to ensure plastic is ready to be extruded as ooze from the previous print may create a delay between moving the extruder axis and plastic actually being extruded. Once the nozzle is primed however the axis position will just be set to 0 and then all future positions of that axis will be relative to where it started on the roll.

Hopefully that helps but if it doesn’t I think we still need more clarification of what you are actually trying to accomplish.