Automatic Door Open using Arduino using Servo DIY Kit

SuperKitz.com ​Project Manual

Automatic Door Open using Arduino using Servo!

Using Arduino and IR Sensor 

This project will show how to build an automatic door lock. The door will automatically open nor close if any person comes in front of the Door. The application can be implementable anywhere like a house, storefronts, offices, and theatres, etc…

An infrared sensor is an electronic device, that emits  IR beams in order to sense some obstruction of the surroundings.  A Single Channel Relay The module is activated when it detects an object in front which can be used to control the micro servo which activates the door lock. 

Requirements :
● Computer with an internet connection
● Download and install Arduino IDE

Components

Arduino UNO

Jumper wires

IR Proximity sensor FC 51

Micro Servo Motor SG90

9v battery

9v battery and clip

Hardware

Getting
Started with
Arduino UNO

Arduino Uno

Although there are many different types of Arduino boards available, this manual focuses on the Arduino Uno model. This is the most popular Arduino board around. So what makes this thing tick? Here are the specifications:

Arduino Uno is a microcontroller board based on the ATmega328P (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz .a USB connection, a power jack, an ICSP header, and a reset button.

  • Input Voltage: 7-12V

  • Number of analog inputs:

     

Another wonderful feature of the Arduino is the ability to use what are called “shields”, or add-on boards. Although shields will not be covered in this manual, they are a really neat way to extend the features and functionality of your Arduino.

Pin out diagram
Arduino UNO

IR sensor/Proximity Sensor

An infrared sensor is an electronic device, that emits IR  in order to sense some aspects of the surroundings. 

An infrared light emitting diode (IR LED) emits light of Infrared range 700 nanometers (nm) to 1 mm. This light is not visible by naked eyes but can be seen by a camera (that is why these are also used in night vision cameras).

A photo diode gives response in term of change in resistance when light falls on it. That change is measured in terms of voltage.

An IR LED and a Photo diode are used in a combination for proximity and color detection. An IR LED (transmitter) emits IR light, that light gets reflected by the object, the reflected light is received by an IR receiver (Photo Diode). Amount of reflection and reception varies with the distance. . This difference causes to change in input voltage through IR input. This variation in input voltage is used for proximity detection.

 

 

By connecting a couple of IR sensors to an Arduino, we can make a simple automatic door opening mechanism. We will connect the sensors to a door jamb, and by properly aligning the sensors, we can detect when someone passes through the door. When this happens, the output of the IR sensor will change, and we will detect this change by continually reading the output of the IR sensors with an Arduino. In this example, we know that an object is passing through the door when the IR sensor’s output becomes high. When this occurs, the Arduino will set the relay to ON. 

For color detection application: The amount of reflected light depends upon the color of the surface from which it is reflected. The reflection is different for different colored surfaces. This makes it a color detector.

Micro Servo Motor

They’re useful in many robotics projects, such as for turning the front wheels on an RC model for steering or pivoting a sensor to look around on a robotic vehicle.

Servo is a general term for a closed loop control system. A closed loop system uses the feedback signal to adjust the speed and direction of the motor to achieve the desired result.

RC servo motor works on the same principal. It contains a small DC motor connected to the output shaft through the gears.

The output shaft drives a servo arm and is also connected to a potentiometer (pot).The potentiometer provides position feedback to the servo control unit where the current position of the motor is compared to the target position.

 

According to the error, the control unit corrects the actual position of the motor so that it matches the target position.

 

 

How Servo Motors Work?

You can control the servo motor by sending a series of pulses to the signal line. A conventional analog servo motor expects to receive a pulse roughly every 20 milliseconds (i.e. signal should be 50Hz).

The length of the pulse determines the position of the servo motor.

If the pulse is high for 1ms, then the servo angle will be zero.

If the pulse is high for 1.5ms, then the servo will be at its center position.

If the pulse is high for 2ms, then the servo will at 180 degrees.

Pulses ranging between 1ms and 2ms will move the servo shaft through the full 180 degrees of its travel.

Circuit Diagram

Wire up the IR Module and Micro Servo Motor
With Arduino

 

 

STEP1:

CONNECTING IR Proximity Sensor To ARDUINO 

Wire up the data lines and power lines of the Ultrasonic sensor.  

  • IR Sensor VCC -> Arduino 5V
  • IR Sensor DATA -> Arduino A 5
  • IR Sensor GND -> Arduino GND

STEP2: Wire up the Micro Servo Motor

  • Servo red wire 5V pin Arduino         
  • Servo brown wireGround pin Arduino         
  • Servo yellow wire PWM(9) pin Arduino

Note: Servos draw considerable power, so if you need to drive a biger servo, you’ll probably need to power it from a separate supply (not from 5V pin of Arduino). Be sure to connect the grounds of the Arduino and external power supply together!

 

Use your imagination and intuition to build the door opening mechanism. There is practically no limit to achieve it.

Note:  Here Is how we build it.

 

Step 1
Step 2
Step 3
Step 4

Getting started with Arduino

Before starting any project, you need to get your Arduino talking to your computer. This allows you to write and compile code for the Arduino to execute, as well as providing a way for your Arduino to work alongside your computer.

Installing The Arduino Software Package On Windows

Head over to the Arduino website superkitzs.com and download a version of the Arduino software suitable for your version of Windows. Once downloaded, follow the instructions to install the Arduino Integrated Development Environment (IDE).

Download Arduino IDE

 

Connect your Uno board with an A B USB cable; sometimes this cable is called a USB printer cable

 

If you used the Installer, as soon as you connect your board the Windows – from XP up to 10 – will install drivers automatically

If the board is not properly recognized when the zip package is downloaded and expanded, please follow the procedure below.

  • START menu> CONTROL PANEL MENU
  • From the control panel, check for System and Security
  • Select system
  • Select Device Manager from the System window
  • Select open port named “Arduino UNO (COMxx)”, under Ports (COM & LPT). If there is no COM & LPT section, check “Other Devices” for “Unknown Device”.
  • Choose the “Update Driver Software” option by right-clicking on the “Arduino UNO (COmxx)” port
  • Navigate to the “Browse my computer for Driver software” option.
  • Choose the driver file named “arduino. inf”, located in the “Drivers” folder of the Arduino Software download (not the “FTDI USB Drivers” sub-directory). If you are using an old version of the IDE (1.0.3 or older), Choose the Uno driver file named “Arduino UNO.inf”, If an old version of the IDE (1.0.3 or older) is used
  • Thus the windows driver installation is completed

Select your board type : Arduino UNO and select the port

Select the serial device of the board from the Tools | Serial Port menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port.

Press CNTRL + A & press DELETE to clear the Arduino IDE page

Upload the program

Copy the Sketch Code given below And try to understand 

Now, simply click the “Upload” button in the environment. Wait a few seconds – you should see the RX and TX leds on the board flashing. If the upload is successful, the message “Done uploading.” will appear in the status bar.

Sketch Code

#include <Servo.h>
const int sensorPin = 10;     // connect sensor out to arduino pin D10
const int timeIntervel = 1000; // lock open 3sec
int sensorState = 0;
Servo myservo; 
void setup() {
 pinMode(sensorPin, INPUT);// initialize the sensor pin as an input:
 myservo.attach(9,600,2300);  // (pin, min, max) servo
}
void loop() {
 sensorState = digitalRead(sensorPin); // read the state of the sensor value:
 if (sensorState == HIGH) { // lock open
    myservo.write(90);  // tell servo to go to a particular angle
  delay(2000);
   delay(timeIntervel);
 } else {  // lock close after a small delay
   myservo.write(0); 
   delay(2000);// tell servo to go to a particular angle 
 }
} 

Output

When the proximity sensor detects an obstruction it will activate servo and open the door.

Leave a Reply