Automatic Door with PIR Sensor | Amazing STEM Project (2026)
Motion to Magic: Build Your Own Automatic Door with a PIR Sensor
Imagine walking toward a door and watching it open automatically—without touching a handle! This isn’t magic; it’s the power of STEM (Science, Technology, Engineering, and Mathematics) in action.
Automatic doors are widely used in shopping malls, hospitals, airports, offices, and smart homes. They make entry more convenient, improve accessibility, and reduce the spread of germs by minimizing physical contact. In this hands-on STEM activity, you’ll build a simple automatic door model using a PIR (Passive Infrared) sensor, an Arduino, and a servo motor.
Learning Objectives
By completing this project:
- Understand how a PIR sensor detects motion.
- Learn the basics of embedded systems.
- Explore the interaction between sensors, controllers, and actuators.
- Develop logical thinking and problem-solving skills.
- Gain hands-on experience with Arduino programming.
Materials Required for Automatic Door
- Arduino Uno
- PIR Motion Sensor (HC-SR501)
- Servo Motor (SG90)
- Breadboard
- Jumper Wires
- USB Cable
- Laptop with Arduino IDE installed
- Cardboard or foam board (for the door model)
- Glue or tape
- Scissors/Craft knife (adult supervision required)
Step-by-Step Instructions
Step 1: Build the Door Model
Create a small door using cardboard or foam board. Attach the door to a hinge or use tape so it can swing open freely. Fix the servo motor near the hinge and connect its arm to the door.
Step 2: Connect the Components
Connect the PIR sensor:
- VCC → 5V
- GND → GND
- OUT → Digital Pin 4
Connect the Servo Motor:
- Red → 5V
- Brown/Black → GND
- Orange → Digital Pin 9
Double-check all wiring before powering the Arduino.
Step 3: Upload the Program
Open the Arduino IDE and upload the program that reads the PIR sensor and controls the servo motor.
The logic is simple:
- Wait for motion.
- If motion is detected, rotate the servo to open the door.
- Wait for a few seconds.
- Rotate the servo back to close the door.
Arduino program
| #include <Servo.h>
Servo doorServo; // Pin definitions const int pirPin = 4; const int servoPin = 9; // Variables int motionState = LOW; void setup() { pinMode(pirPin, INPUT); doorServo.attach(servoPin); doorServo.write(0); // Door closed position Serial.begin(9600); Serial.println(“Automatic Door System Ready”); // Allow PIR sensor to stabilize delay(30000); } void loop() { motionState = digitalRead(pirPin); if (motionState == HIGH) { Serial.println(“Motion Detected!”); doorServo.write(90); // Open door delay(5000); // Keep door open for 5 seconds doorServo.write(0); // Close door Serial.println(“Door Closed”); delay(1000); } } |
Step 4: Test Your Project
Stand a short distance away from the model.
Walk toward the PIR sensor.
If everything is connected correctly, the door should open automatically and close after a few seconds.
Try walking at different speeds and distances to observe how the sensor responds.
Step 5: Improve Your Design
Can you make your project even smarter?
Try decorating the entrance, making a stronger cardboard frame, or improving the movement of the door.
Experiment with different opening times and servo angles.
How Does It Work?
The PIR (Passive Infrared) sensor detects infrared energy naturally emitted by warm objects such as people. When someone walks into its detection range, the sensor notices the change in infrared radiation and sends a HIGH signal to the Arduino.
The Arduino reads this signal and instructs the servo motor to rotate. As the servo turns, it pulls or pushes the attached door, causing it to open. After a short delay, the Arduino rotates the servo back to its original position, closing the door.
This project demonstrates how sensors collect information, microcontrollers make decisions, and actuators perform actions—the same sequence used in many real-world automation systems.
Why Is This Project Special?
This project combines programming, electronics, engineering, and creativity in one activity.
Students don’t just learn theory—they build a working prototype that demonstrates a real-world application of automation.
The project also introduces concepts used in:
- Smart homes
- Shopping malls
- Hospitals
- Offices
- Industrial automation
- Contactless access systems
It encourages students to think like engineers by designing, testing, troubleshooting, and improving their models.
Safety Tips
- Always double-check circuit connections before powering the Arduino.
- Keep liquids away from electronic components.
- Ask an adult for help when cutting cardboard or using sharp tools.
- Do not force the servo motor by hand while it is powered.
- Disconnect the USB cable before making wiring changes.
- Keep your workspace clean and organized.
Variations to Try
Once your automatic door is working, challenge yourself with these upgrades:
Level 1
- Add an LED that lights up when the door opens.
Level 2
- Add a buzzer to play a welcome sound.
Level 3
- Display “Welcome!” on a 16×2 LCD screen.
Level 4
- Replace the Arduino with an ESP32 and control the door through Wi-Fi.
Level 5
- Count how many people enter using a display or serial monitor.
Level 6
- Add RFID or a keypad for secure access instead of simple motion detection.
Real-World Applications
Automatic doors are commonly found in:
- Shopping malls
- Hospitals
- Airports
- Hotels
- Banks
- Office buildings
- Smart homes
- Warehouses
- Laboratories
These systems improve convenience, accessibility, hygiene, and energy efficiency.
Conclusion
Building an automatic door using a PIR sensor is an exciting way to explore STEM through hands-on learning. This project helps students understand how sensors, microcontrollers, and motors work together to create smart, automated systems.
Beyond learning electronics and programming, students also develop creativity, problem-solving, and engineering design skills. With a few simple upgrades, this basic project can evolve into an even more advanced smart automation system.
Frequently Asked Questions (FAQ)
1. What is a PIR sensor?
A PIR (Passive Infrared) sensor detects changes in infrared radiation emitted by warm objects, such as people and animals. It is commonly used for motion detection.
2. Why do we use a servo motor instead of a DC motor?
A servo motor can move to a precise angle, making it ideal for opening and closing a door accurately. A standard DC motor rotates continuously and requires additional control to stop at specific positions.
3. Can I build this project without an Arduino?
Yes. You can also use microcontrollers such as the ESP32 or Raspberry Pi Pico, but the programming and wiring will be slightly different.
4. Where are PIR sensors used in real life?
PIR sensors are widely used in motion-activated lights, automatic doors, security alarms, smart homes, and energy-saving lighting systems.
5. What can I do if my automatic door doesn’t work?
Check that:
- All wires are connected correctly.
- The PIR sensor has enough time (30–60 seconds) to initialize after power-up.
- The servo motor is connected to the correct pin.
- The Arduino code has been uploaded successfully.
- The servo motor has adequate power and isn’t being obstructed mechanically






