Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use YL-99 Limit switch and LED: Examples, Pinouts, and Specs

Image of YL-99 Limit switch and LED
Cirkit Designer LogoDesign with YL-99 Limit switch and LED in Cirkit Designer

Introduction

The YL-99 is a compact and versatile limit switch module that integrates a mechanical switch and an onboard LED indicator. It is commonly used in projects requiring position detection, end-stop detection, or mechanical event triggering. The module is designed for ease of use with microcontrollers like Arduino, Raspberry Pi, and other development boards.

The onboard LED provides a visual indication of the switch's state, making it ideal for debugging and monitoring. Its small size and simple interface make it suitable for robotics, CNC machines, 3D printers, and other automation systems.

Explore Projects Built with YL-99 Limit switch and LED

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Battery-Powered Smart Light with Photocell and Transistor Control
Image of Smart Drawer New: A project utilizing YL-99 Limit switch and LED in a practical application
This circuit is a light-sensitive LED control system powered by a 9V battery. It uses a photocell (LDR) to detect ambient light levels and an NPN transistor to switch a high-power LED on or off based on the light intensity, with additional control provided by a rocker switch and a limit switch.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered LED Toggle Switch Circuit
Image of EXP. 7 E: A project utilizing YL-99 Limit switch and LED in a practical application
This circuit consists of a red LED, a toggle switch, and a power source. The LED is powered by a 3.7V supply from the MAHIR 1.mini module, and its illumination is controlled by the toggle switch, which connects or disconnects the LED's cathode to ground.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered LED Circuit with Rocker Switch Control
Image of Switchglow: A project utilizing YL-99 Limit switch and LED in a practical application
This circuit is a simple LED control system powered by a 9V battery. It includes a rocker switch to turn the LED on and off, with a 200-ohm resistor to limit the current flowing through the LED.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered LED Toggle Switch Circuit
Image of EXP. 7 E: A project utilizing YL-99 Limit switch and LED in a practical application
This circuit consists of a toggle switch, a red LED, and a power source. The toggle switch controls the connection between the power source and the LED, allowing the LED to be turned on or off.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with YL-99 Limit switch and LED

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Smart Drawer New: A project utilizing YL-99 Limit switch and LED in a practical application
Battery-Powered Smart Light with Photocell and Transistor Control
This circuit is a light-sensitive LED control system powered by a 9V battery. It uses a photocell (LDR) to detect ambient light levels and an NPN transistor to switch a high-power LED on or off based on the light intensity, with additional control provided by a rocker switch and a limit switch.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of EXP. 7 E: A project utilizing YL-99 Limit switch and LED in a practical application
Battery-Powered LED Toggle Switch Circuit
This circuit consists of a red LED, a toggle switch, and a power source. The LED is powered by a 3.7V supply from the MAHIR 1.mini module, and its illumination is controlled by the toggle switch, which connects or disconnects the LED's cathode to ground.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Switchglow: A project utilizing YL-99 Limit switch and LED in a practical application
Battery-Powered LED Circuit with Rocker Switch Control
This circuit is a simple LED control system powered by a 9V battery. It includes a rocker switch to turn the LED on and off, with a 200-ohm resistor to limit the current flowing through the LED.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of EXP. 7 E: A project utilizing YL-99 Limit switch and LED in a practical application
Battery-Powered LED Toggle Switch Circuit
This circuit consists of a toggle switch, a red LED, and a power source. The toggle switch controls the connection between the power source and the LED, allowing the LED to be turned on or off.
Cirkit Designer LogoOpen Project in Cirkit Designer

Technical Specifications

  • Operating Voltage: 3.3V to 5V DC
  • Switch Type: Mechanical momentary switch
  • Output Type: Digital (HIGH/LOW)
  • Indicator: Onboard LED (lights up when the switch is pressed)
  • Dimensions: 32mm x 10mm x 10mm (approx.)
  • Mounting Holes: 2 holes for secure attachment

Pin Configuration and Descriptions

The YL-99 module has a 3-pin interface. Below is the pin configuration:

Pin Name Description
VCC Power supply input (3.3V to 5V DC)
GND Ground connection
OUT Digital output signal (HIGH/LOW)

Usage Instructions

How to Use the YL-99 in a Circuit

  1. Wiring the Module:

    • Connect the VCC pin to the 3.3V or 5V pin of your microcontroller.
    • Connect the GND pin to the ground (GND) of your microcontroller.
    • Connect the OUT pin to a digital input pin on your microcontroller.
  2. Operation:

    • When the switch is not pressed, the OUT pin outputs a HIGH signal.
    • When the switch is pressed, the OUT pin outputs a LOW signal, and the onboard LED lights up.
  3. Example Circuit:

    • Use a pull-up resistor if necessary to ensure stable signal levels.
    • The onboard LED provides a visual cue, but you can also monitor the OUT pin in your microcontroller code.

Arduino UNO Example Code

Below is an example code snippet to use the YL-99 module with an Arduino UNO:

// Define the pin connected to the YL-99 OUT pin
const int limitSwitchPin = 2; // Digital pin 2
const int ledPin = 13;        // Built-in LED on Arduino UNO

void setup() {
  pinMode(limitSwitchPin, INPUT); // Set the limit switch pin as input
  pinMode(ledPin, OUTPUT);        // Set the built-in LED pin as output
  Serial.begin(9600);             // Initialize serial communication
}

void loop() {
  int switchState = digitalRead(limitSwitchPin); // Read the state of the switch

  if (switchState == LOW) {
    // If the switch is pressed
    digitalWrite(ledPin, HIGH); // Turn on the built-in LED
    Serial.println("Switch Pressed!");
  } else {
    // If the switch is not pressed
    digitalWrite(ledPin, LOW);  // Turn off the built-in LED
    Serial.println("Switch Released!");
  }

  delay(100); // Small delay for stability
}

Important Considerations and Best Practices

  • Ensure the module is powered within its operating voltage range (3.3V to 5V).
  • Avoid excessive mechanical stress on the switch to prevent damage.
  • Use proper pull-up or pull-down resistors if the signal is unstable.
  • Secure the module using the mounting holes to prevent movement during operation.

Troubleshooting and FAQs

Common Issues and Solutions

  1. The onboard LED does not light up when the switch is pressed.

    • Check the power supply connections to ensure the module is receiving the correct voltage.
    • Verify that the switch is not physically damaged or stuck.
  2. The microcontroller does not detect the switch state.

    • Ensure the OUT pin is correctly connected to a digital input pin on the microcontroller.
    • Check for loose or faulty wiring.
    • Use a multimeter to verify the signal on the OUT pin.
  3. The output signal is unstable or noisy.

    • Add a pull-up resistor (e.g., 10kΩ) to stabilize the signal.
    • Ensure the module is securely mounted to avoid vibrations affecting the switch.

FAQs

Q: Can the YL-99 module be used with a 3.3V microcontroller like ESP32?
A: Yes, the module operates within a voltage range of 3.3V to 5V, making it compatible with 3.3V microcontrollers.

Q: Is the onboard LED necessary for the module to function?
A: No, the LED is only for visual indication. The module will still output the correct signal even if the LED is not used.

Q: Can the module handle high-speed switching?
A: The YL-99 is a mechanical switch, so it is not suitable for high-speed switching applications. For such cases, consider using an optical or solid-state switch.

Q: How durable is the mechanical switch?
A: The switch is designed for general-purpose use and can handle a reasonable number of actuations. However, avoid excessive force or rapid cycling to prolong its lifespan.