Automatic Door Opener using Arduino, Ultrasonic Sensor, and Servo Motor Techexperiment

preview_player
Показать описание
Automatic Door Opener using Arduino, Ultrasonic Sensor, and Servo Motor

Description: Welcome to our YouTube channel! In this exciting tutorial, we'll show you how to create an Automatic Door Opener using an Arduino, an Ultrasonic Sensor, and a Servo Motor.

Have you ever wished for a hands-free entry into your home or office? With this DIY project, you can make your dreams come true! We'll guide you through the step-by-step process of building an automated door opening system that senses your presence and opens the door for you.

First, we'll introduce you to the main components of this project. The Arduino, a versatile microcontroller, acts as the brain of our system. The Ultrasonic Sensor, with its ability to measure distance, will be used to detect your presence. Finally, the Servo Motor will be responsible for physically opening the door.

We'll guide you through the necessary connections and programming code, ensuring you have a clear understanding of each step. You'll learn how to wire the Ultrasonic Sensor to the Arduino and how to control the Servo Motor using PWM (Pulse Width Modulation) signals.

Once everything is set up, we'll demonstrate the functionality of our Automatic Door Opener. As you approach the door, the Ultrasonic Sensor will detect your presence and send the signal to the Arduino. The Arduino will then process the information and command the Servo Motor to rotate, opening the door for you.

Throughout the video, we'll provide detailed explanations and troubleshooting tips to help you overcome any challenges you may encounter. Additionally, we'll discuss potential modifications and expansions to enhance the functionality of your Automatic Door Opener.

Join us on this exciting journey as we combine technology, engineering, and creativity to create a practical and impressive project. Make sure to subscribe to our channel, hit the notification bell, and leave your questions and feedback in the comments section. Let's get started on building your own Automatic Door Opener using Arduino, Ultrasonic Sensor, and Servo Motor!

@techexperiment923
Рекомендации по теме
Комментарии
Автор

#include <Servo.h>

const int triggerPin = 2; // Ultrasonic sensor trigger pin
const int echoPin = 3; // Ultrasonic sensor echo pin
const int servoPin = 9; // Servo motor signal pin
const int distanceThreshold = 10; // Distance threshold in centimeters

Servo doorServo;

void setup() {
pinMode(triggerPin, OUTPUT);
pinMode(echoPin, INPUT);
doorServo.attach(servoPin);
doorServo.write(0); // Set the initial position of the servo
delay(1000); // Wait for the servo to move to the initial position
Serial.begin(9600);
}

void loop() {
// Send ultrasonic pulse
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);

// Measure the time for the ultrasonic pulse to return
long duration = pulseIn(echoPin, HIGH);

// Calculate the distance in centimeters
int distance = duration * 0.034 / 2;

// Check if the distance is below the threshold
if (distance < distanceThreshold) {
openDoor();
} else {
closeDoor();
}
}

void openDoor() {
doorServo.write(90); // Open the door (adjust the angle as needed)
Serial.println("Door opened");
delay(2000); // Keep the door open for 2 seconds (adjust as needed)
}

void closeDoor() {
doorServo.write(0); // Close the door (adjust the angle as needed)
Serial.println("Door closed");
delay(2000); // Pause for 2 seconds before checking again (adjust as needed)
}

techexperiment