Things used in this project

Custom parts and enclosures

Connect hardware
Connect hardware
Automatic door opening system aokbmorq5c

Schematics

Connect Hardware
Connect Hardware
F0ir7yhiyysyypv small vkb8adlsel

Code

Arduino codeArduino
Code for Automatic Door Opening Using Ultrasonic sensor HRSC04
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 8, 9, 1);

const int trigPin = 7; 
const int echoPin = 4;
const int mt_En_Pin1  = 2; 
const int mt_IN1_Pin2  = 3; 
const int mt_IN2_Pin3  = 6;
int buzz = 10;

long duration;
int distance;

void setup()
{
lcd.clear();
lcd.begin(16, 2);
lcd.print("WELCOME");

pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(mt_En_Pin1, OUTPUT);
pinMode(mt_IN1_Pin2, OUTPUT);
pinMode(mt_IN2_Pin3, OUTPUT);
Serial.begin(9600);
pinMode(buzz, OUTPUT);
}

void loop() 
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);

distance= duration*0.034/2;
if(distance <= 5)
{
    digitalWrite(13, HIGH);
    delay(1000);
    digitalWrite(mt_En_Pin1, HIGH);
    analogWrite(mt_IN1_Pin2,50);
    analogWrite(mt_IN2_Pin3, 0);
    delay(2000);
    analogWrite(mt_IN1_Pin2, 0);
    analogWrite(mt_IN2_Pin3, 0);
    delay(1000);
    
    tone(buzz, 1000);
    delay(1000);
    tone(buzz, 1000);
    delay(1000);
    noTone(buzz);
    delay(3000);
    
    lcd.clear();
    lcd.setCursor(0,1);
    lcd.print("Please Enter");
    delay(1000);
  
    analogWrite(mt_IN1_Pin2,0);
    analogWrite(mt_IN2_Pin3,50);
    delay(3000);
}

else
{
    digitalWrite(13, LOW);
    digitalWrite(mt_En_Pin1, LOW);
    analogWrite(mt_IN1_Pin2,50);
    analogWrite(mt_IN2_Pin3, 0);    
}

}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Crazy Engineer’s Drawing Robot / Arduino GRBL CoreXY Servo
Advanced
  • 9
  • 1

Full instructions

It is an Arduino, Customised GRBL, CoreXY, Servo and Stepper based CNC Drawbot that is Open Source and Open Hardware. It can draw or .......

Wildlife Detector
Advanced
  • 767
  • 13

Device detects motion, then takes a picture of triggering wildlife. Uses a neural net to identify the wildlife species and does something.

Make an Autonomous "Follow Me" Cooler
Advanced
  • 12,241
  • 92

Full instructions

We use an Arduino to build an autonomous "follow me" cooler that connects to a smartphone via Bluetooth and uses GPS to navigate.

MEGA BREAD - Hank the Hexabot - Updated 5-28-17
Advanced
  • 318
  • 5

Work in progress

A 6 legged, 18 servo, self guiding time wasting project. MEGA BREAD series #7, Delivery and retrieval from the air project.

Amazon Echo -  LED Strip
Advanced
  • 961
  • 13

Full instructions

This project allows you to use voice command to turn on/off, change color, effect of one, a range or all of an LED strip.

Kalam32 ESP32 Board as a Wireless WiFi/TCP ECG/Resp Monitor
Advanced
  • 638
  • 12

Protip

We interface one of our most popular Arduino shields, the ADS1292R ECG/Respiration shield, to ProtoCentral's new ESP32 platform.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback