Arduino-Powered Door Automation with Motion Sensor

Introduction

Hello enthusiasts, welcome back to Techatronic. Have you ever encountered an automatic door that seamlessly opens and closes on its own? In this guide, we’ll demonstrate how you can craft your very own automatic door opener using a sensor and Arduino UNO. Typically, these types of entrances are commonplace in hotels, metros, offices, etc., and often employ specialized motors for their operation. However, in our project, we’re utilizing a servo motor for this specific purpose. For more insights into IoT and fundamental electronics, explore our collection of articles. Additionally, we offer an Ebook focused on Arduino, featuring over 10 intriguing projects complemented by well-explained code and circuit diagrams. To get started, follow the provided circuit diagram and proceed to upload the code to your Arduino.

Arduino-Powered Door Automation with Motion Sensor

Description

Securely attach the servo motor’s rotating shaft to the cardboard gate, ensuring free rotation capability.

Upon entering the IR sensor’s range, the servo motor initiates rotation, automatically opening the door.

After a predefined two-second delay, the door will autonomously close. The code provided can be adjusted to modify the time delay according to your specific needs.

The red LED illuminates upon successful closure of the door, while the green LED signals the impending door opening.

For further exploration, you can examine our creation of a smart dustbin utilizing Arduino and IR sensors.

Components Required

  • Arduino UNO
  • Servo motor
  • IR sensor
  • Red and green LEDs
  • 220 ohm resistor
  • Jumper wires and a breadboard
  • USB cable for uploading the code

Circuit for Automatic Door Opener With Sensor

Take a servo motor and link its VCC wire to the Arduino’s 5-volt pin. Subsequently, connect its negative wire to the GND pin of the Arduino. Establish a connection between the signal wire of the servo motor and the Arduino’s digital-9 pin.

Connect the VCC pin of the IR sensor module to the Arduino’s 5-volt pin, and link the GND pin of the IR sensor module to the Arduino’s GND pin. Attach the OUT pin of the IR sensor to the digital-7 pin of the Arduino.

Now, acquire two LEDs and connect their negative legs to the GND pin of the Arduino using a 220-ohm resistor. Connect the positive leg of the red LED to the digital-11 pin of the Arduino. Similarly, link the positive pin of the green LED to the digital-10 pin of the Arduino.

Your circuit assembly is now completed, allowing you to proceed with the subsequent steps.

PCBWay PCB Prototyping Services

I’ve completed the circuit assembly on a breadboard. However, I acknowledge that a breadboard setup may not be the most efficient for this project type. That’s why PCBWay provides rapid PCB prototyping services tailored for research endeavors. Personally, I highly recommend PCBWay due to their ability to deliver accurately fabricated boards in just 24 hours on your first attempt!

The prototyping phase stands as a pivotal time for engineers, students, and enthusiasts. PCBWay not only expedites the production of your boards but also ensures accuracy and cost efficiency. This significantly minimizes expenses and accelerates the development timeline for your electronic projects.

PCBWay offers a spectrum of PCBs, ranging from 2 Layer boards to highly advanced HDI and flex boards. Despite the significant differences in functionality and application areas among the PCBs they manufacture, I’m thoroughly impressed with the board quality, delivery speed, and cost-effectiveness.

Code for Automatic Door Opener With Sensor

// Techatronic.com

#include
Servo s1;
int val = 0 ;
void setup()
{
Serial.begin(9600); // sensor buart rate
s1.attach(3);
pinMode(2,INPUT);
pinMode(5,OUTPUT); // led green pin
pinMode(6,OUTPUT); // led red pin
}
void loop()
{
val = digitalRead(2); // IR sensor output pin connected
Serial.println(val); // see the value in serial mpnitor in Arduino IDE
delay(1);

if(val == 1 )
{
digitalWrite(5,HIGH); // LED ON
digitalWrite(6,LOW); // LED OFF
s1.write(90);
delay(2000);

}
else
{
digitalWrite(5,LOW); // LED OFF
digitalWrite(6,HIGH); // LED ON
s1.write(0);

}
}

We trust you found the automatic door opener with a sensor interesting, and we encourage you to attempt building it yourself. Should you encounter any uncertainties regarding this project, please don’t hesitate to ask in the provided comment section. Additionally, explore more articles related to Arduino and Raspberry Pi authored by our team.


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top