Configure endstops in a 3d Printer

In these pages I will show you how I configured endstops for my printerina 3d Printer. I tried to leave the description open in order to describe generically how to configure enstops so to be used by anyone building a 3d printer

If you need additional specific information about this topic or if you want to look it personally please write an email

EndStops Setup tutorial

I hope this will be for you a 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.
Marlin firmware is an interpreter of GCode language. It simply open a serial port, accept those command and execute each command. Pronterface is just a serial interface and you can send G command to the printer using it.
Even though I'm going to use Ramps 1.4 and Marlin firmware, this tutoral will most likely be useful 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.

What we will see in this page

* Quick introduction to Endstops and Ramp 1.4
* Connect 2 and 3 pin endstops.
* Get endstop status and configure Marlin firmware @section homing using Pronterface and the newest Arduino IDE

For more information you can visit also the pages I built to show you my new 3d printer Printerina

Ramps 1.4 Schema

Ramp Schema

Following you will see two picture. The first one contains a view of a mechanical endstop. In the second one you will see where endstops are connected on a Ramp 1.4 board

EndStop
EndStop

How to identify Pins we will connect on Ramps 1.4

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.

How to connect 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.

Select Normally Closed or Normally open

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.

How to manage 3 pin endstops

I preferred to buy for my printerina 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.

Test connections

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.

Pronterface


pronterface views

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

Install and start Pronterface and connect to your printer.
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.

Command M119

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.

Search for a fault

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.

Configure Marlin

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. In my printerina I have also a Zmin endstop connected because I have a Zprobe configuration. In this case you will need also to work on the section related to the Zprobe configuration in the marlin software
If you don't use the Zprobe option, you need simply to configure the zero height of your Z axis

If you performed all these steps properly you should have configured your endstops and now you can try to home your printer. Enjoy your prints!!!

Leave a Comment