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

119,995

94

28

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

About: I'm blogging about my projects before they make it to Instructables.com Once I've finished a subject on my blog, I'll put it together and post it on Instructables, so you can get a preview on my site.

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

Tech Contest

Participated in the
Tech Contest

Be the First to Share

    Recommendations

    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Metalworking Contest

      Metalworking Contest
    • Maps Challenge

      Maps Challenge

    28 Discussions

    0
    carlhurles28
    carlhurles28

    5 weeks ago

    ive just follows these steps in pronterface all my end stops was open then i moved my axis to the endstops and they was triggerd my problem is when i home my 3d printer all 3 axis hit the endstop then try to keep going any advice?

    0
    carlhurles28
    carlhurles28

    Reply 5 weeks ago

    nevermind i figured it out i had the endstops pluged in wrong i went over this tutorial again and it sorted it thanks!!

    but now i have a different problem im trying to print a 20mm cube it starts printing and half way through my printer makes some strange noises like its about to explode then stops printing i have to turn the printer off and back on again to make it run again i tried this twice now same at exactly 7 min into printing.

    0
    NapierDeltic
    NapierDeltic

    3 months ago

    Hi Dintid, I very much appreciate your tutorial. I now understand why my probe (z axis) goes both below and above z =0.00. I have asked before on forums as homing (-z) is meant to be a safety feature, at least logically. Now It's clear. It-s very few explanation about a lot of features - why they were created, why they were modified from original intent.
    I have a specific problem, I want to switch a LinuxCNC into a Marlin one, having both milling and printing capabilities. I want to keep also LinuxCNC/breakout board operational as alternative. Can I configure Marlin to work with the same configuration of endstops (connected in series for each +/- axis. Should I connect them only to -x/y/z terminals of the board? Can they work properly being simultaneously connected to both boards or I should physically switch them to the intended active one.
    Thank you !

    0
    dintid
    dintid

    Reply 3 months ago

    Hello Napier.
    I honestly can't answer your questions, as I don't have any experience with the setups you are suggesting.
    I wouldn't advice connecting endstops to both cards at the same time as any failure in one card (shorting out) will likely transfer to the other controller as well. Nor am I sure wheter it would work in any case as limit switches effectively work by closing or opening a circuit and each controller might act out in some way - I'm not a component person, so can't help you here.
    For CNC the use of limit switch is primarily a safety feature while you can't really get a 3D printer without this feature now for ease of use. If you don't use endstops you need to manually place each axis at your intended 0 for that axis in order for the machine to know where it is at.

    0
    NapierDeltic
    NapierDeltic

    Reply 3 months ago

    Thank you very much for your answer, Dintid. Seemed to me that Grbl has only one signal entry open /close per axis and it coroborates with stepper dirrection as to consider it min or max endstop, so we can have both switches in series. I was thinking that Marlin, being inspired by Grbl, has the same.approach.
    But usually I face the truth, be it unpleasant. This makes things a lot complicated and you are right, better safe than sorry.
    And, by the way, I have one of your belt extruders installed on a printer. I am satisfied :) but don't ask how much as I have used it only for some trials. So far so good and I expect best.

    0
    jasond114
    jasond114

    7 months ago on Introduction

    Thank you very much for this instructable. I was close to chucking my build out the window...this instructable is clear, concise and educational.

    Again..thanks vrry much!!

    0
    a-sacramento
    a-sacramento

    Question 2 years ago on Introduction

    I cannot connect Pronterface to my printer. I got an error, but I can connect Repetier host. Can you give me a clue on the problem? Also Only Z endstop is working X and Y are not working and they are equal and configured the same way. What can be the problem?

    0
    misterxp
    misterxp

    2 years ago

    Great! Thanks!

    0
    SunixDev
    SunixDev

    2 years ago

    Finnally a clear explaination finnaly got my end stop working

    Thank you

    0
    dintid
    dintid

    Reply 2 years ago

    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 :)

    0
    fbujold
    fbujold

    3 years ago


    • IMG_5665.MOV says forbidden when i click on it? am not doing something?
    0
    dintid
    dintid

    Reply 3 years ago

    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 :)

    0
    banman11
    banman11

    3 years ago


    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... :-)


    0
    dintid
    dintid

    Reply 3 years ago

    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

    0
    andersoon_fm
    andersoon_fm

    3 years ago

    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?

    0
    dintid
    dintid

    Reply 3 years ago

    yes, true.

    0
    sMartinM
    sMartinM

    4 years ago

    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)?

    0
    dintid
    dintid

    Reply 4 years ago

    Hello Martin. You might want to take a look at the instructables I wrote:
    Configuring Endstops on Ramps 1.4 with Marlin firmware - @section homing
    https://www.instructables.com/id/Configuring-Endstops-on-Ramps-14-with-Marlin-firmw/

    What you need to do is use the M119 command to see which, if any, endstops are triggered. You simply "invert" the triggered endstops in firmware.
    It is listed in Step 3 in the instructables :)

    If you want to test your extruder motor, you also need to allow cold extrusions by issuing M302
    http://reprap.org/wiki/G-code#M302:_Allow_cold_extrudes

    Once you have sorted the endstops, you can figure out wheter you need to invert the direction of your motors.
    Motion Configuration on Ramps 1.4 with Marlin firmware @section machine
    https://www.instructables.com/id/Motion-Configuration-on-Ramps-14-with-Marlin-firmw/

    Regards,
    Morten
    Denmark

    0
    sMartinM
    sMartinM

    Reply 4 years ago

    I read already the article an I understood the part about inverting the endstops, but I have no Endstop switches at all and I am trying to configure the firmware to disable them but all my attempts are unsuccesful. Is it mandatory to have minimum 3 endstops to let it work or if I just invert the endstop logic the firmware will no longer make problems with moving in negative direction?

    I will try with M119 and M302 atleast and let you know abut the results.

    0
    dintid
    dintid

    Reply 4 years ago

    It is not mandatory to have endstops, but you there is no option to just disable them.

    Instead you invert them, so they are listed as not triggered.

    You then define software endstops and min/max for your axes.

    When starting your printer it will then assume it is positioned at XYZ 0,0,0 and will go no further than your defined MAX in each direction.

    Just remember to remove the G28 command from Cura's start-gcode, which it use as default to home endstops to it hits limit switches.