nithishmurugavenkateshmaker
Published

Automatic door opener

Tired of opening and closing the door when having a bunch of things in your hands? I've got just the thing!

IntermediateFull instructions provided5,503
Automatic door opener

Things used in this project

Hardware components

IR sensor
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Buzzer
Buzzer
×1

Software apps and online services

Arduino IDE
Arduino IDE
Autodesk TinkerLabs

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Code

Code schematics

C/C++
Here you will find the code to power the project:
//This the code for THE AUTOMATIC DOOR OPENER
// Author : Nithish Murugavenkatesh

#include <Servo.h> // imports servo library
Servo servo; // renames Servo as servo
int buzzer = 12; //connects buzzer to digital pin 12
int ir = 2; // connect ir sensor to digital pin 2

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600); //begins serial
  servo.attach(9); // attaches the servo to digital pin 9
  pinMode(ir, INPUT); // defines ir sensor as a input device
  pinMode(buzzer, OUTPUT);// define buzzer(piezo) as a output device
  

}

void loop() {
  // put your main code here, to run repeatedly:
  if (digitalRead(ir) == 0){ // if the ir sensor detects something
    servo.write(180);// move servo in 180 degree angle
    tone(buzzer,2637,500);// play note C7 at half
    delay(500);// wait 500 milliseconds
  }

}

Credits

nithishmurugavenkateshmaker
4 projects • 2 followers

Comments