Configuring Endstops on Ramps 1.4 With Marlin Firmware - @section Homing

71,139

84

21

Posted

Introduction: Configuring Endstops on Ramps 1.4 With Marlin Firmware - @section Homing

This is going to be a, hopefully, complete tutorial on configuring endstops on 3D printers build on Ramps 1.4 using Marlin firmware.

I am going to use Pronterface/Printrun host program to connect to my printer and issue terminal commands (G-codes). That sounded very hairy, but it is just a simple program with a graphical interface.

Even though I'm going to use Ramps 1.4 and Marlin firmware, this tutoral will most likely be usefull for most setups. We are going to use the newest Arduino IDE to edit the Marlin firmware.

Configuring endstops often boils down to being methodical in finding faults, which is why it is causing so many problems for many people, as many hope they can, and try to, just plug in the printer and hope it works. Which it rarely does.

If it doesn't Work it can be tempting to do something rash in hope of a quick fix, which in turn tends to compound the issues and make it much worse.

Common symptons of faulty endstops are motors/axes which refuses to move, move in the wrong direction or move a tad this and then that way.

In short: setting up endstops correctly is not just recommended, but is mandatory before beginning to configure movement, including homing -settings for the Axes.

In this tutorial we are going to:

  1. Explorer physical endstop pin-layout on Ramps 1.4 board.
    1. Connect 2 and 3 pin endstops.
  2. Get endstop status and configure Marlin firmware @section homing using Pronterface and the newest Arduino IDE
  3. All done. Ready for motion configuration.

Step 1: Endstop Pin-layout on Ramps 1.4

Our first task is to identify the pins we are going to use on our Ramps 1.4 board.

Endstop pin-layout

When looking at the Ramps 1.4 board with the power-plugs facing left, the endstop-pins are located in the upper right corner as shown in the image.

From left to right we have X-min, X-max, Y-min, Y-max, Z-min, Z-max

The top most pins are Signal pins, the middle pins are ground and the lower pins are 5v/Vcc.

Connecting Endstops

If we use a simple limit-switch as our endstop, shown on an image here, which only uses 2 wires, we are going to connect them to the Signal and Ground pin. It does not matter in which order they are connected. Signal and Ground are the 2 top-most pins.

The limit-switch has 3 legs where 1 is for signal and the other 2 are labeled NC and NO, which means Normally Closed and Normally Open, respectively.

Choosing NC or NO

I prefer using NC which Means a current is running through it all the time. When depressing the arm on the switch the circuit is broken and it triggers a response. It also means a fault is registered if a wire breaks, a connector comes loose, or something similar.

If you use NO the Circuit is closed, a current runs through it, when the arm is depressed. This means that no alarm is triggered if a wire or connector comes.

Some years ago NO was the norm as it wasn't as sensitve to noise and Thus did not make false positive (triggering the endstop) due to noise from motors.

The Electronics now, even on cheap Ramps 1.4 has imrpoved a lot and the noise should not be an issue any more, so I'll recommend using the NC pin.

3-pin endstops

More advanced endstops which have LEDS or other Electronics Integrated use 3 wires. One for signal, ground and 5v/vcc.

When connecting these kinds of endstops it is vitally important that the wires are correctly connected. The Signal and Ground becomes important, as opposed to the 2-wire switches, as you risk shorting out the Electronics if you connect the signal to gnd and gnd to signal, while also using the 5v/vcc pin.

Testing wires

When you have soldered the two wires to your endstop, you should test for continuity on the wires using a Multimeter. If you do not have one, I'll recommend you go buy one. A cheap one will do.

If you use more advanced endstops like IR sensors or similar, you should test it according to the manufacturers documentation.

Step 2: Endstop Status Using Pronterface and Setup Marlin in Arduino

Now we have successfully connected our endstop and it is time to setup our firmware.

Using Pronterface

Fire up Pronterface and connect to your printer.

You can see in the middle of the program, marked by a blue Square, I have added some custom bottoms for actions I use a lot like getting Endstop status, allowing Cold Extrusion and Vis Temperature on Extruder (Vis = show in Danish).

You do not have to create any button, but it is a nice tool. Just click the +, type in some text and the Gcode you want to use. The code for Get Endstop Status is M119

Commands can also just be written in the input boxt in lower right corner, see image, and exectud by pressing enter or send.

Using M119 command

First make sure no endstops are triggered. Move the Axes if neccessary. It makes it much easier to do this if all endstops has the same status. When all is ready you issue the M119 command.

After issueing the command you will most likely see some endstops with the status of OPEN and some with the status TRIGGERED

The ones with the OPEN status are most likely configured correctly, while the other endstops are either defective, activated by your axes or the firmware needs to be corrected.

Fault finding/verifying

Now that we have our status we check to see that all the endstop with OPEN status are working correctly. You do that by manually activating them one by one while issue in the M119 command. If the status does not change when activated it is most likely due to bad pin-wiring on Ramps, but it can also be the firmware.

If you have any endstops not behaving you turn off the printer, unplug the USB and Check the pin-connection.Correct as nesccesary.

Also check for continuity again, using a multimeter.

Make a list of the endstops which shows the staus as TRIGGERED when not triggered, or just keep pronterface open to see the output.

Configuring Marlin firmware in Arduino IDE

Open the Configuration.h file/sketch/tab and scroll Down to the @section homing - around line 330 or so.

Make sure you do not have 2 // in front of #define ENDSTOPPULLUPS. If you have, then remove them, upload the firmware to your printer and redo the tests we just did in Pronterface.

Note: remmeber you have to discconnect in Pronterface before uploading firmware or you will get an error in Arduino IDE

Now go Down a few line to "// Mechanical endstop with COM to ground and NC..." and change the value from false to true or the other way, see image, for the endstops outputting TRIGGERED when not triggered.

// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert... const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert... const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert... const bool X_MAX_ENDSTOP_INVERTING = true; // set to true to invert... const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert.. const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert... //#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS

Upload the firmware and redo the test in Pronterface.

I changed my Z-min to true from false and it now displays correctly in Pronterface - see image.

Step 3: All Done. Ready for Motion Configuration

Congratulate yourself as you have just setup one of the most important features of your printer.

You actually don't need to use endstops, but when you do, you really need to have them configured correctly before you can move on and setup the motion of your printer.

I am going to make an Instructable on setting up the movement direction of the axes, homing direction and configuration of Travel limits after homing.

Update: you can find it here: Motion Configuration on Ramps 1.4 with Marlin firmware @section machine

Share

    Recommendations

    • Science of Cooking

      Science of Cooking
    • Pocket-Sized Contest

      Pocket-Sized Contest
    • Trash to Treasure

      Trash to Treasure
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    21 Comments

    Great! Thanks!

    Finnally a clear explaination finnaly got my end stop working

    Thank you

    Glad you found it usefull :)

    I'm actually planning to update the Marlin posts some, as I just recieved a Prusa MK2 I need to setup for someone :)

    I don't know fbujold. Been a LONG while since I made this one, and worked so far. Must be instructables.com making some changes... lets hope they sort it :)


    Hi dintid,

    Great instructable, very clear and methodical.

    I had actually came to the same assumption on the switch wiring on my own before I found this article. Wish I'd found this earlier. Would have saved me time and effort.

    I would just like to clarify an issue I had with my set up. It might not be as obvious to some new comers.

    I had my end-stop connectors plugged into the max section of the input headers RAMPS 1.4 board .and not the min headers section . I would say it is a very easy thing to do. Especially for newbies like my self.

    As a result the endstop reporting status to Pronterface was giving me reversed flags. Very frustating.

    On looking at this article I shifted the connectors so that the first one plugged into the first pair of pins on the left hand side of the end-stop input headers (having the board orientated so that the USB and power connectors are to the left hand side looking from above) . I skipped plugging in connectors to every second input .

    I ran the the end-stop status reporting and everything came up as you have in the images in your instructable. This made a huge difference to how the RAMPS1.4 reports its end-stop status just having the input pins in the wrong inputs. So much so I thought about reconfiguring the firmware. A good thing I saw your informative article.

    Thank you... :-)


    Hello Banman11.

    Thank you for your very usefull feedback. I have actually done pretty much the same thing on occasion as you just describe.. it's really a pain.

    Cheers

    Thanks a lot!!!

    I just didn't understood something: if you want to use NC, you have to get open when endstops aren't pressed and if you want to use NO, you have to get triggered when endstops aren't pressed?

    If that's correct, the only change i need to choose between NO or NC is the #define X_MIN_ENDSTOP_INVERTING true or false?

    yes, true.

    Hello Dintid,

    I am building now a 3d printer from old CD ROMs and I'm facing a problem during the tests. I am using no endstops and have no hotend and termistor yet. When I connect the stepermotors to Pronterface I click the moving arrows, but the steppers from each dimension are moving just in positive direction. I click to negative direction but no motor moves. Maybe this is because i have no endstops, but can you confirm and tell me how to disable them from the Firmware (I am using Marlin 1.1.0)?