A limit switch is an electromechanical sensor that opens or closes an electrical contact when a moving part physically presses its actuator at a defined position. Among sensors in robotics, it is the simplest way to answer one binary question: has this axis reached the end of its travel?
Robots and motion systems use limit switches for homing, which establishes a known reference position after power-up, and for overtravel protection, which stops an axis before it collides with its mechanical end stop. Their value lies in robustness and directness rather than resolution.
How a limit switch detects position
A limit switch detects position through direct mechanical contact: a cam, dog or part of the moving axis pushes an actuator such as a lever, roller or plunger, which moves an internal snap mechanism and changes the state of one or more contacts. The output is purely binary, either actuated or released.
Most switches use a snap-action mechanism, a spring that flips the contacts abruptly once the actuator passes a trip point. This gives a clean, fast transition regardless of how slowly the axis approaches. The switch then has hysteresis, called differential travel: it releases at a slightly different position than it trips, which prevents chatter when the axis rests near the trip point.
The table below lists the travel terms found on a typical datasheet and why each matters to a robot designer.
| Characteristic | Typical value | Why it matters |
|---|---|---|
| Pretravel | 0.5 to 4 mm | Distance from rest to the trip point |
| Overtravel | 1 to 6 mm | Safe motion after tripping before damage |
| Differential travel | 0.1 to 1 mm | Hysteresis between trip and release |
| Repeatability | About 0.01 to 0.05 mm | Consistency of the trip position |
| Operating force | 0.5 to 10 N | Load the moving part must apply |
Overtravel is the safety margin. An axis that is still decelerating after the trip must stop within the overtravel distance, otherwise the moving part crushes the actuator or the switch body.
Contact configurations and wiring
A limit switch is wired as normally open (NO), normally closed (NC) or with both contacts in a changeover arrangement, and the choice determines how the controller reacts when a wire breaks. This decision is about failure behavior, not convenience.
| Contact type | State at rest | State when actuated | Behavior on broken wire |
|---|---|---|---|
| Normally open | Open circuit | Closed circuit | Fault looks like not reached |
| Normally closed | Closed circuit | Open circuit | Fault looks like reached, axis stops |
| Changeover (SPDT) | One path closed | Other path closed | Fault detectable by comparing both |
| Positive opening NC | Closed circuit | Forced open | Contacts open even if welded |
For end-of-travel protection, normally closed wiring is the standard practice because a cut cable or loose connector stops the axis instead of silently disabling the limit. Safety-rated switches add positive opening operation, defined in IEC 60947-5-1, in which the actuator mechanically forces the contacts apart even if they have welded together.
Mechanical contacts bounce for roughly 1 to 10 ms when they change state. Microcontroller inputs therefore need hardware filtering or software debouncing, or a single trip may be counted as several events.
Limit switch roles in robot motion systems
In robots, a limit switch serves one of three roles: homing reference, software-independent overtravel limit, or presence detection of a part or tool. Each role places different demands on placement and accuracy.
- Homing: on power-up, an axis with an incremental encoder moves slowly toward the switch, records the trip point and sets that position as zero. Accuracy improves by approaching from the same direction at low speed, and many controllers then search for the encoder index pulse.
- Hard limits: switches at both ends of a linear axis cut the motor driver enable signal directly, providing protection that works even if the software crashes.
- Detection: in grippers and fixtures, a switch confirms that a part is seated or a tool changer is locked before the program continues.
A common architecture combines soft limits in software with physical switches placed slightly beyond them. The software normally stops the axis first, and the switch acts only as a last line of defense.
Limit switches compared with non-contact sensors
The limit switch differs from proximity, inductive, Hall effect and photoelectric sensors mainly because it requires physical contact and has moving parts. That makes it simple and immune to many environmental effects, but it also wears out.
| Sensor | Sensing principle | Mechanical life | Main advantage | Main drawback |
|---|---|---|---|---|
| Limit switch | Mechanical contact | 1 to 30 million cycles | Simple, positive, any target material | Wear, bounce, needs contact force |
| Inductive sensor | Eddy currents in metal | Practically unlimited | Sealed, no wear | Detects metal only |
| Hall effect sensor | Magnetic field | Practically unlimited | Compact, fast | Needs a magnet on the axis |
| Photoelectric sensor | Interrupted light beam | Practically unlimited | Long range, high precision | Sensitive to dust and alignment |
| Encoder index | Optical or magnetic mark | Practically unlimited | Very precise homing | Needs a coarse reference first |
Limit switches remain popular where positive mechanical confirmation is desirable, for example on safety guards, or where cost and simplicity outweigh cycle life. High-cycle axes in modern industrial robots increasingly use sensorless homing against a hard stop or absolute encoders, which remove the need for a homing switch entirely.
Selection, installation and common mistakes
Correct selection depends on actuator style, electrical rating and environmental protection. A roller lever suits a cam passing at an angle, a plunger suits straight-line contact, and a sealed housing rated IP65 or IP67 suits washdown or dusty cells.
Most field problems trace back to installation rather than to the switch itself. The following table summarizes typical faults.
| Symptom | Likely cause | Remedy |
|---|---|---|
| Home position varies between runs | Fast approach speed | Two-stage homing at low final speed |
| Multiple triggers per contact | Contact bounce | Debounce filter of a few milliseconds |
| Switch body crushed | Insufficient overtravel | Reposition or reduce stopping distance |
| False trips near motors | Electrical noise on long cables | Shielded cable, pull-up, filtering |
| Contacts fail early | Inductive load arcing | Relay rating check, suppression diode |
One more mistake is mounting the switch so the moving part strikes it head-on at speed. The actuator should be engaged by a ramp or cam so force builds gradually, which protects both the mechanism and the repeatability of the trip point.
A non-technical view
A limit switch is a small button that a moving machine part bumps into when it reaches the end of its path. When pressed, it tells the controller this is as far as it should go.
It works much like the light switch inside a refrigerator door. In a robot, it helps the machine find its starting point after it is switched on and keeps it from crashing into its own frame.
A concrete example
A small engineering firm builds a three-axis gantry robot that picks electronic components from trays. Each axis uses a stepper motor, a belt drive and an incremental encoder, so the robot does not know its position when powered on.
The team mounts a roller-lever limit switch at the home end of each axis, wired normally closed, and a second switch at the far end that cuts the motor driver enable line directly. The homing routine moves each axis toward its switch at 50 mm/s, backs off 3 mm and approaches again at 2 mm/s.
With the slow second approach, the measured home position repeats within about 0.02 mm, well inside the 0.1 mm tolerance needed for the trays. During commissioning, a software error once drove the Y axis past its programmed limit, and the far-end switch stopped the carriage before it reached the frame, avoiding a damaged belt.