

An endstop is a mechanical switch or sensor designed to detect the position of a moving part in a machine. It is commonly used in 3D printers, CNC machines, and other automated systems to define the limits of movement and ensure precise operation. Endstops play a critical role in preventing mechanical components from moving beyond their intended range, which could otherwise result in damage or misalignment.








The pinout for a typical 3-pin endstop is as follows:
| Pin Name | Description | Notes |
|---|---|---|
| Signal | Outputs the state of the switch | HIGH or LOW depending on state |
| VCC | Power supply for the endstop | Typically 5V |
| GND | Ground connection | Connect to system ground |
For 2-pin endstops (simpler models), the configuration is:
| Pin Name | Description | Notes |
|---|---|---|
| Signal | Outputs the state of the switch | HIGH or LOW depending on state |
| GND | Ground connection | Connect to system ground |
Wiring the Endstop:
Placement:
Testing:
The following code demonstrates how to use an endstop with an Arduino UNO:
// Define the pin connected to the endstop signal
const int endstopPin = 2; // Connect the Signal pin to digital pin 2
const int ledPin = 13; // Built-in LED for status indication
void setup() {
pinMode(endstopPin, INPUT_PULLUP); // Set endstop pin as input with pull-up resistor
pinMode(ledPin, OUTPUT); // Set LED pin as output
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int endstopState = digitalRead(endstopPin); // Read the state of the endstop
if (endstopState == LOW) { // Endstop triggered (assuming active LOW)
digitalWrite(ledPin, HIGH); // Turn on LED
Serial.println("Endstop triggered!");
} else {
digitalWrite(ledPin, LOW); // Turn off LED
Serial.println("Endstop not triggered.");
}
delay(100); // Small delay to avoid spamming the serial monitor
}
INPUT_PULLUP mode is used to simplify wiring by enabling the internal pull-up resistor.Endstop Not Triggering:
False Triggers:
No Signal Detected:
Microcontroller Not Responding:
Q: Can I use an endstop with a 3.3V microcontroller?
A: Yes, but ensure the endstop is compatible with 3.3V logic levels or use a level shifter.
Q: How do I know if my endstop is Normally Open (NO) or Normally Closed (NC)?
A: Use a multimeter to test continuity. In the untriggered state, NO will show no continuity, while NC will show continuity.
Q: Can I use an endstop for non-linear motion detection?
A: Yes, as long as the moving part can reliably trigger the switch or sensor.
Q: What is the difference between mechanical and optical endstops?
A: Mechanical endstops use physical contact to detect motion, while optical endstops use light interruption for detection. Optical endstops are more precise and durable but may require additional circuitry.