

A limit switch is an electromechanical device that detects the presence or absence of an object or the position of a moving part. It is widely used in industrial and mechanical systems to control machinery or equipment. The switch operates by making or breaking an electrical connection when a physical object comes into contact with its actuator.








The pin configuration of a limit switch depends on its contact type. Below is a general description for a common 3-terminal limit switch:
| Pin Name | Description |
|---|---|
| COM | Common terminal, connected to the moving contact inside the switch |
| NO | Normally Open terminal, connected to COM when the actuator is engaged |
| NC | Normally Closed terminal, connected to COM when the actuator is not engaged |
Below is an example of how to connect and use a limit switch with an Arduino UNO:
// Define the pin connected to the limit switch
const int limitSwitchPin = 2;
// Variable to store the state of the limit switch
int switchState = 0;
void setup() {
// Set the limit switch pin as input with an internal pull-up resistor
pinMode(limitSwitchPin, INPUT_PULLUP);
// Initialize serial communication for debugging
Serial.begin(9600);
}
void loop() {
// Read the state of the limit switch
switchState = digitalRead(limitSwitchPin);
// Check if the switch is pressed (LOW state due to pull-up resistor)
if (switchState == LOW) {
Serial.println("Limit switch is engaged!");
} else {
Serial.println("Limit switch is not engaged.");
}
// Add a small delay to avoid spamming the serial monitor
delay(200);
}
Switch Not Responding:
False Triggering:
Actuator Not Engaging:
Switch Damaged:
Q: Can I use a limit switch with AC circuits?
A: Yes, many limit switches are rated for both AC and DC circuits. Check the specifications of your switch to confirm compatibility.
Q: How do I protect the switch in harsh environments?
A: Use a limit switch with a high IP rating (e.g., IP67) for protection against dust and water.
Q: Can I use multiple limit switches in a single circuit?
A: Yes, you can wire multiple switches in series or parallel, depending on your application requirements.
Q: What is the difference between NO and NC configurations?
A: In a Normally Open (NO) configuration, the circuit is open until the actuator is engaged. In a Normally Closed (NC) configuration, the circuit is closed until the actuator is engaged.