

The YL-99 Limit Switch is a mechanical device designed to detect the presence or position of an object. It operates by opening or closing an electrical circuit when a predetermined limit is reached. This makes it an essential component in automation, robotics, and industrial control systems. The YL-99 is compact, reliable, and easy to integrate into various projects, making it a popular choice for hobbyists and professionals alike.








The YL-99 Limit Switch is a simple yet robust device. Below are its key technical details:
| Parameter | Specification |
|---|---|
| Operating Voltage | 5V DC |
| Maximum Current | 300mA |
| Contact Type | Normally Open (NO) or Normally Closed (NC) |
| Switch Type | Mechanical |
| Dimensions | 27mm x 10mm x 10mm |
| Mounting Hole Diameter | 2mm |
| Operating Temperature | -25°C to 85°C |
The YL-99 Limit Switch typically has three pins:
| Pin | Name | Description |
|---|---|---|
| 1 | Common (COM) | The common terminal for the switch circuit. |
| 2 | Normally Open (NO) | Open circuit by default; closes when the switch is pressed. |
| 3 | Normally Closed (NC) | Closed circuit by default; opens when the switch is pressed. |
Wiring the Switch:
COM pin to the positive terminal of your power source or signal input.NO pin if you want the circuit to close (activate) when the switch is pressed.NC pin if you want the circuit to open (deactivate) when the switch is pressed.Integration with Microcontrollers:
Example Circuit:
COM pin to the ground (GND) of the Arduino.NO pin to a digital input pin on the Arduino (e.g., D2).// YL-99 Limit Switch Example Code
// This code reads the state of the limit switch and prints it to the Serial Monitor.
const int switchPin = 2; // Pin connected to the NO pin of the YL-99
int switchState = 0; // Variable to store the state of the switch
void setup() {
pinMode(switchPin, INPUT_PULLUP); // Set the pin as input with internal pull-up
Serial.begin(9600); // Initialize serial communication
}
void loop() {
switchState = digitalRead(switchPin); // Read the state of the switch
if (switchState == LOW) {
// Switch is pressed (NO pin connected to GND)
Serial.println("Switch Pressed");
} else {
// Switch is not pressed
Serial.println("Switch Released");
}
delay(100); // Small delay to avoid spamming the Serial Monitor
}
Switch Not Responding:
COM pin is properly connected and the correct output pin (NO or NC) is used.Unstable Readings:
Switch Stuck in One State:
Arduino Not Detecting the Switch:
INPUT_PULLUP mode in your Arduino code or add an external resistor.Q: Can the YL-99 Limit Switch handle AC voltage?
A: No, the YL-99 is designed for low-voltage DC applications only. Using it with AC voltage may damage the switch or pose a safety hazard.
Q: How do I choose between the NO and NC pins?
A: Use the NO pin if you want the circuit to activate when the switch is pressed. Use the NC pin if you want the circuit to deactivate when the switch is pressed.
Q: Can I use the YL-99 in outdoor environments?
A: The YL-99 is not weatherproof. If outdoor use is required, consider enclosing it in a waterproof housing.
Q: What is the lifespan of the YL-99 Limit Switch?
A: The lifespan depends on usage conditions but is typically rated for thousands of mechanical operations under normal conditions.