Connecting endstop switches
The Duet provides one endstop switch input for each axis, and one for each extruder.
Duet WiFi/Ethernet and 0.6/0.8.5 endstop inputs
Each endstop input has ground, +3.3V and sense pins in that order, labelled GND, 3V3 and STP respectively on the back of the board.
Each input has a pullup resistor and red LED between the STP pin and +3.3V. The LED will be illuminated when an endstop switch or other device connected to the input holds the voltage close to 0V (ground). Whether the LED is illuminated when the endstop switch is triggered or not triggered depends on whether your endstop switch produces and active-high or active-low output:
- An endstop switch with an active-high output holds the input pin at about 0V when the switch is not triggered, and about +3.3V when it is triggered. A typical example is a normally-closed microswitch. The LED on the Duet will be illuminated when the switch is connected but not triggered.
- An endstop switch with an active-low output holds the input pin at about 3.3V when the switch is not triggered, and about 0V when it is triggered. One example is a normally-open microswitch (which is not recommended, because a normally-closed switch is safer). Another example is a Hall sensor with an open-drain output that is connected directly to the Duet endstop input. The LED on the Duet will be illuminated when the switch is connected and triggered.
The endstop switches each need to be able to sink 1.5mA current for the Duet 2 WiFi and Duet 2 Ethernet, and 2.1mA for the Duet 06 or 085. This is not usually a problem, except with some optical endstop switches that were not designed properly for 3.3V operation.
Note: some types of endstop (e.g. opto endstops designed for 5V operation) may pull the endstop input low enough to light the LED, but not low enough for the Duet to recognise that the input is in the LOW state.
Duet Maestro endstop inputs
Each endstop input has ground, +3.3V and sense pins in that order, labelled GND, 3V3 and STP respectively on the back of the board (same pinout as for the Duets covered in the previous section).
There is no LED provided, just a 10K pullup resistor. So the endstop devices only need to sink 0.3mA.
Duet 3 endstop inputs
Endstop devices can be connected to the IO_0 through IO_9 connectors. Each endstop input has a 27K pullup resistor, so the endstop devices only need to sink 0.12mA.
Maximum input voltage on STP or IN pin
Duet 06 and 085: 3.3V
Duet WiFi/Ethernet hardware rev 2.03 and earlier: 3.3V (in practice a little more is unlikely to damage the Duet)
Duet WiFi/Ethernet hardware rev 2.04 and later: 8.3V. Higher voltages may damage the endstop LED.
Duet Maestro and Duet 3: 30V
Each axis endstop input can be configured in firmware for a Max (high end of axis) or Min (low end of axis) endstop, and with an active high or active low signal level. Configuration is done in config.g using the M574 command.
You can check the state of the endstop inputs read by the Duet using either of the following methods:
- In Duet Web Control, go to the Settings page and then the machine properties tab. There is a column showing the endstop states.
- Send M119 from a USB host program, or from PanelDue, or from the web interface.
On most types of printers except delta, you do not need to have a Z endstop switch if you use a Z probe for Z homing.
Configuring endstop switches in firmware
The M574 gcode is used to configure endstops. For more detail on specific types of printers see:
- Configuring RepRapFirmware for a Cartesian printer
- Configuring RepRapFirmware for a Delta printer
- Configuring RepRapFirmware for a CoreXY printer
- Configuring RepRapFirmware for an IDEX printer
- Configuring RepRapFirmware for a SCARA printer
- Configuring RepRapFirmware for a CNC machine
- Configuring RepRapFirmware for a Polar printer
- Configuring RepRapFirmware for a Hangprinter printer
Duet 2 series has endstop labels with axis names. The following table shows a conversion between axis names and numbers of all 12 available endstop inputs
|5||E2 (E2_STOP)||Expansion Header/DueX2/DueX5|
|6||E3 (E3_STOP)||Expansion Header/DueX2/DueX5|
|7||E4 (E4_STOP)||Expansion Header/DueX5|
|8||E5 (E5_STOP)||Expansion Header/DueX5|
|9||E6 (E6_STOP)||Expansion Header/DueX5|
|10||Stop 10 (ENC_B)||CONN_LCD Header|
|11||Stop 11 (ENC_A)||CONN_LCD Header|
Connecting different types of endstop switch
In the following descriptions, STP/IN refers to the IN pin of the connector if you are using a Duet 3, otherwise to the STP pin of the connector.
This applies to a bare microswitch, not to a microswitch on a board with a LED.
- Duet WiFi, Duet Ethernet and Duet Maestro: connect the switch between GND and STP/IN. These are the outer 2 pins of the 3-pin connector. Note: this is not the same as on RAMPS.
- Duet 3: connect the switch between the IN and GND pins of your chosen IO_x connector.
We recommend you use the normally-closed contacts of the microswitches, which are generally the outside two connections on the microswitch, and set the signal polarity to active high (S1) in the M574 command. If for any reason you use normally-open microswitch contacts, then if you use RepRapFirmware 1.x or 2.x then you will need to set the signal polarity to active low (S0) in the M574 command, and if you are using RepRapFirmware 3 then you will need to use S1 but invert the polarity by putting a ! character at the start of the pin name in the M574 command.
Makerbot Mechanical Endstop v1.2
Connect it to the Duet endstop connector as follows. Note: the pins on the Duet endstop connector are not in the same order as on RAMPS!
|Makerbot endstop pin number||Function||Duet 2 endstop pin marking||Duet 3 IO_x pin marking|
|2 or 3||GND||GND||GND|
Unfortunately the pin markings on the Makerbot endstop board are hidden underneath the connector. Pin 1 is next to the long edge of the board that does not have the microswitch on it, and pin 4 is nearest the edge with the microswitch.
These devices produce an active-low output. If using RepRapFirmware 1.x or 2.x, use the S0 parameter in your M574 command. If using RepRapFirmware 3, invert the polarity by putting a ! character in front of the pin name.
3.3V-compatible Hall sensor
Connect Gnd to Gnd, Vcc of the Hall sensor to 3V3, and the output of the Hall sensor to STP/IN. Simple Hall sensors normally have active low outputs, so use S0 in the M574 command if using RRF 1.x or 2.x, or put ! at the start of the pin name if using RRF 3.x. If your Hall sensor is a circuit board with a sensitivity adjustment potentiometer on it, then it may provide an active high output instead of active low. If your hall switch is just the IC then you should also connect a 0.1uF capacitor between Vcc and Gnd close to the IC.
5V Hall sensor with open-collector or open-drain output
Examples: Allegro A3141, A3142, A3143, A3144 (all of these are discontinued products, but still found on eBay)
Duet 3: as for 3.3v Hall sensor, but connect Vcc to the 5V pin of the IO_connector instead of the 3.3V pin.
Other Duets: Preferably, use 3.3V-compatible Hall sensors instead. However, If your 5V Hall sensor has an open-collector or open-drain output (as the devices listed above do), or if you are using a Duet WiFi/Ethernet hardware rev 1.04 or later or a Duet Maestro, you can wire it as for a 3.3V sensor except that Vcc must be connected to +5V (available at pin 1 of the expansion connector) instead of to the 3v3 endstop connector pin.
3.3V-compatible optical endstop
Connect Gnd to Gnd, Vcc of the opto sensor to 3V3, and the output of the opto sensor to STP/IN. Opto sensors usually have active high outputs, so use S1 in the M574 command.
Note: opto endstops made to the Generation 7 design are often claimed to be 3.3V-compatible, but in fact the design is marginal with a 5V supply and frequently doesn't work at all on 3.3V. Here are some workarounds:
- This design normally works with a 3.3V supply if you replace the 180 ohm opto switch series resistor resistor by 100 ohms. Tip: if your opto endswitch uses surface mount resistors, instead of removing the 180 ohm resistor it is easier to solder a 200 or 220 ohm resistor on top of it, so that the two resistors are connected in parallel. Make sure you pick the correct resistor to replace or solder another on top of! There is often also a load resistor, value 1K or higher.
- If you are using Duet 3 then you can use the 5V pin on the IO_ connector to provide power to the opto endstop instead of using 3.3V power.
- If you are using a Duet WiFi/Ethernet hardware rev 1.04 or later or a Duet Maestro, these boards can tolerate 5V on the endstop inputs. So you can provide them with a 5V supply instead (leaving the centre pin of the endstop connector not connected) and connect the outputs of your endstops directly to the STP/IN pins of the endstop connectors.
Test endstop switches
Testing endstop switches using the web interface
Note: the following does not work if you are using stall detection instead of wired endstops.
- Apply power to the printer. You need only 5V power for this test, so we suggest you leave the main power turned off and just connect the printer to a PC via the USB cable. Note: if you have a PanelDue with 7" screen then USB power may not be sufficient.
- Connect to your printer from a web browser
- If you are using Duet Web Control 2.02 or later, select the Machine Specific page. If you are using Duet Web Control 1.22.6 or earlier, select the Settings page, then the Machine Properties tab.
*In the Endstops or Endstop Hit column you can see the state of each endstop.
- Test that the Endstop Hit value displayed is No when the corresponding axis is not pushed against the endstop, and Yes when it is
What might go wrong:
- If the Duet fails to boot up with the endstops switches connectors, or if it disconnects from the browser as soon as you trigger an endstop switch, this usually means that you are using microswitch endstops and you have connected to the wrong pins of the endstop connector. 2-wire microswitches must be connected to the outer two pins of the connector, which is not the same as many other 3D printer control boards.
- If the endstop switches read in reverse, then the remedy depends on the type of endstop sensor:
- If the sensor is a 2-wire microswitch, we recommend that you use the normally-closed contacts, which are the two outermost tags on the switch (leave the centre tag not connected).
- If you are already using those contacts, or you are using a different type of endstop sensor, in the M574 command in config.g change S0 to S1 or vice versa.
- If the Endstop hit value doesn't change when you trigger the endstop:
- Check the wiring
- If they are optical endstops, first make sure that you have S1 in the M574 command. Then, if the endstops show as triggered all the time, your endstops are probably not 3.3V compatible and you need to modify them - see Connecting endstop switches. If they never show as triggered, check that the flag on the end of the axis blocks the slot completely, and that there is a pullup resistor between the sensor output and +3.3V (10K is usually suitable).
Testing endstop switches using M119
If you don't have access to your Duet from a browser, you can send M119 commands from USB or PanelDue to read the endstop state while doing the tests listed above.
Multiple endstops on one axis
RepRapFirmware only supports one endstop per motor per axis. If your axis only has one motor, you can only have one endstop. If your axis has two or more motors, you can have an endstop per motor, if the motors are plugged into their own stepper driver, and the motors can be homed individually to their own endstop. To do this, see Bed levelling using multiple independent Z motors