Course Content
Hands-On ESP32 Robotics: Build Smart Robots Step by Step

🛑 Limit Switch

🎯 Lesson Objective

In this lesson, students will understand:

• What a limit switch is
• How a limit switch works
• The structure and components of a limit switch
• How limit switches detect physical contact
• How limit switches are used in robotics projects

This lesson introduces a simple but very useful sensor used for detecting physical contact or position.


1️⃣ What is a Limit Switch?

A limit switch is a mechanical sensor that detects physical contact or movement.

When an object presses the switch, it changes its electrical state and sends a signal to the microcontroller.

Limit switches are widely used in automation and robotics to detect:

🛑 Collision or physical contact
📍 Position of moving parts
🚪 Opening or closing of doors
⚙️ End position of mechanical systems

Because of their simple design and reliability, limit switches are commonly used in robotics systems for touch detection.


2️⃣ How a Limit Switch Works

A limit switch operates like a simple mechanical button.

The working process can be explained in simple steps:

1️⃣ The robot or mechanical system moves toward an object.
2️⃣ When the object touches the limit switch, the switch is pressed.
3️⃣ The switch changes its electrical state.
4️⃣ The signal is sent to the microcontroller.
5️⃣ The microcontroller performs an action based on the signal.

For example:

In a bumper robot, when the robot hits an obstacle, the limit switch is pressed and the robot immediately changes direction.


3️⃣ Structure of a Limit Switch

A typical limit switch contains several mechanical and electrical parts.

🔘 Lever or Button

This is the external part that gets pressed when an object touches the switch.

Some limit switches have a lever arm that helps detect contact easily.


⚙️ Internal Switch Mechanism

Inside the switch is a mechanical contact system that opens or closes an electrical circuit.

When the switch is pressed, the internal contact changes its state.


🔌 Electrical Terminals

Limit switches have metal terminals used for connecting wires to the circuit.

These terminals allow the microcontroller to detect the switch state.


4️⃣ Limit Switch Pin Configuration

A typical limit switch contains three terminals.

COM (Common)

This is the main terminal used for connection in most circuits.


NO (Normally Open)

In this state, the circuit remains open when the switch is not pressed.

When the switch is pressed, the circuit becomes closed.


NC (Normally Closed)

In this state, the circuit remains closed when the switch is not pressed.

When the switch is pressed, the circuit becomes open.

In robotics projects, the NO (Normally Open) configuration is commonly used.


5️⃣ Limit Switch as a Touch Sensor

In robotics systems, a limit switch often acts as a touch sensor.

When the robot physically touches an obstacle, the switch is activated.

This allows the robot to detect collisions.

For example:

🚧 Robot moves forward
🛑 Robot touches obstacle
🔘 Limit switch is pressed
⚙️ Microcontroller detects the signal
↩ Robot changes direction

This method is commonly used in bumper robots.


6️⃣ Applications of Limit Switches

Limit switches are used in many electronic and mechanical systems.

Common applications include:

🤖 Bumper robots
🏭 Industrial automation systems
🚪 Automatic door systems
📦 Conveyor belt systems
⚙️ Position detection in machines

They are useful whenever a system needs to detect physical contact or movement limits.


7️⃣ Limit Switch in This Course

In this course, the limit switch will be used in the Bumper Control Robot project.

In this project:

• The robot moves forward.
• When the robot hits an object, the limit switch is pressed.
• The ESP32 detects the signal.
• The robot changes its direction to avoid the obstacle.

This demonstrates how robots can respond to physical interactions with their environment.


🚀 What Happens Next

Now that you understand how limit switches detect physical contact, the next step is to learn about the mechanical structure that holds all robotic components together.

Scroll to Top