How to make Arduino based Automatic Door Opening Using Ultrasonic sensor HRSC04

Automatic Door Wall

The project concerns about automatic door opening and closing system. An automatic door control system includes a sensor for sensing person or object approaching door. Systems and methods are very common in the art for opening and closing doors to enter and exit buildings, facilities etc. Automatic doors are commonly found in retail stores, supermarkets, and the like.

The project relates to an automatic opening and closing of door which will sense person or object approaching door and open automatically. This system is controlled by Arduino micro controller. The system includes DC motor which makes door to slides during opening or closing by rack and pinion gearing, a LCD to display information state of door, an audio buzzer to make sound through the duration of opened door and a controller for controlling the opening and closing of the door as a person or object detected by sensor.

The whole system is mechatronic system which is designed using seven steps of mechatronic system design.

To starts making such mechatronic system following elements and tools are required…

Step 1:- Gather all hardware (Materials and Tools)

Gather all hardware required to assemble system. LCD and Piezo Buzzer is not a mandatory requirement of this system. These are added just only for Visual and Audio identification to user for status of door whether it is open or closed.

To starts making such mechatronic system following elements and
tools are required…

Materials –

1) A computer to program instruction, must installed arduino IDE.

2) Arduino controller ( Any of UNO, MEGA etc.) but i took low cost UNO R3 for learning purpose and making this project for my academic partial fulfillment. ATMEL : ATmega328-PU

3) HRSC04 Ultrasonic sensor (Used as            proximity sensor to sens person or            object arrived at door).

Ultrasonic ranging module HC – SR04 provides 2cm-400cm non-contact measurement function, the ranging accuracy can reach to 3mm. The modules includes ultrasonic transmitters, receiver and control circuit. The basic principle of work:

Using IO trigger for at least 10us high level signal

The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back

IF the signal back, through high level , time of high output IO duration is the time from sending ultrasonic to returning

Test distance = (high level time X                velocity of sound (340M/S) / 2

4) DC Motor

Load current: 70mA (250mA MAX)             (3V pm)

Operating voltage: 3V ~ 12V DC

Torque: 1.9 Kgf.cm

Speed without load: 170RMP (3V)

Reduction ratio: 1:48

Weight : 30gm

No-load current = 60 mA,

Stall current = 700 mA

5) LCD : 16 X 2 DOT MATRIX.

6) Piezo Buzzer

7) Motor Shield : L293D

The L293 and L293D devices are quadruple high current half-H drivers.

Reason to use Motor shield :

You can run motor directly connect to 9-12 V DC supply. The motor will draw current as much it requites from 12V DC supply. But In this project we have to control motor with program instruction so we have to connect motor through the arduino controller which output voltage and current is limited. So when you connect motor to arduino controller it it will draw more current at 5V. So there will be chances to burn controller.

To prevent micro-controller to burn, i used motor shield. which is simply acts as amplifier.

8) Mechanical elements : To make a prototype i used plastic acrylic sheet and cut them into peaces to make a house type model having sliding door.

9) Jumper Wires

10) Power Supply

Tools-

  1. Multi-meter
  2. Soldering Iron

The tools are not required, but if you have then you will be good.

Step 2: Arduino Program:-

You can also down load attached .ino file and directly complie and upload.

#include

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);

}

}

 

Step 3:- Hardware connections

Connects all hardware to arduino controller. The attached schematics are just for the reference only. You may use pins as per available at controller board.

The best way you can use my program for pin information. Also you raise me request to share.

Step 4:- Flaysh Arduino Program and Power Supply

Upload arduino sketch provided in this tutorial to controller.

Watch video to view working system.

How to make Arduino based collision detection warning system

picture1

 

This is arduino based collision detection warning system. This kind of system is fastest growing safety feature in automotive industries. Such system enables vehicles to identify the chances of collision and give visual and audio warning to driver. So that driver can take necessary action to avoid collision. This project idea is based on arduino controller and the whole system will give you very good understanding that how this system works. The step by step method is explained so that you can make this system. The hardware connection, pin information and arduino program is explained clearly.

 

 

steps

Step 1: Items and Material Required

items-required

Please gather the following items

  1. Computer :- This is required to write program and flash program to controller. Also you need to install arduino IDE which is available free at arduino website download section.
  2. Controller :- I used arduino micro-controller. This you can get at online seller like amazon etc.
  3. Sensor :- I used HR SC-04 ultrasonic sensor.
  4. Piezo Buzzer :- I used piezo buzzer to make audio warning.
  5. LED :- There is two type of LED i used to which is red LED and blue LED.
  6. Wires :- There were jumper wires required to make hardware connections. You need to take all type of jumper wires like both end male, both end female and one end male another end female type.

Step 2: Connect all hardwares

pin-info

schematic

The hardware you gather in first step, now connect all them to controller through wires.

Sensor to controller pin information :-

Sensor has four pins VCC, Trig, Echo and GND. Connect…

VCC pin to 5V on controller

GND pin to GND on controller

Trig pin to pin-7 on controller

Echo pin to pin-4 on controller

Piezo Buzzer to controller pin information :-

Piezo buzzer has two pin.

Connect one pin to pin-10 on controller

Connect another pin to GND on controller

Red LED to controller pin information :-

Red LED has two pin.
Connect one pin to pin-2 on controller

Connect another pin to GND on controller

Red LED to controller pin information :-
Red LED has two pin.

Connect one pin to pin-13 on controller

Connect another pin to GND on controller

Controller to Computer connection information :-
You have USB data cable that you got while buying arduino. By this data cable you connect computer to arduino board.Now launch the arduino IDE. After connecting to computer you must have to select board and port from menu.

please see the attached screen shot for the help.

 

Step 3: Write Arduino Program

program

In the previous step we defined pin information for the hardware. No that info we’ll use to write program instructions.

Launch Arduino IDE and try to write program by yourself. Otherwise you can directly use my program or download the .ino format file attached.

While copying this code you have to be careful because some character used in program cannot be paste while writing this on instructable. Better to download .ino format file.

////Collision Warning System////

//// Year 2017 ////

//// Vijendra Kumar////

const int trigPin = 7;

const int echoPin = 4;

int buzz = 10;

long duration;

int distance;

// the setup function runs once when you press reset or power the board

void setup() {

// initialize digital pin 13 as an output.

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

pinMode(13, OUTPUT);

pinMode(2, OUTPUT);

Serial.begin(9600);

}

// the loop function runs over and over again forever

void loop()

{

// Clears the trigPin

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

// Sets the trigPin on HIGH state for 10 micro seconds

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds

duration = pulseIn(echoPin, HIGH);

// Calculating the distance

distance= duration*0.034/2;

// Prints the distance on the Serial Monitor

if(distance <= 50 && distance >= 20)

{

digitalWrite(13, HIGH);

// digitalWrite(13, LOW);

// turn the LED on (HIGH is the voltage level)

}

else

{

digitalWrite(13, LOW); // turn the LED off by making the voltage LOW

// wait for a second

}

if(distance <= 20)

{

digitalWrite(2, HIGH);

tone(buzz, 2000);

delay(100);

noTone(buzz);

delay(100);

tone(buzz, 2000);

delay(100);

noTone(buzz);

delay(100);

tone(buzz, 2000);

delay(100);

noTone(buzz);

tone(buzz, 2000);

delay(100);

noTone(buzz);

delay(100);

}

else

{

digitalWrite(2, LOW); // turn the LED off by making the voltage LOW

// wait for a second

}

}

Step 4: Flash Arduino Board

After making all connection we are ready to upload the program to arduino board. Please see the attached image for reference.

Step 5: How This System Works

Let me explain you that how this system works.

I defined three different zones.

Zone 1 :- No warning

Zone 2 :- Only visual warning (In this zone driver has to pay attention)

Zone 3 :- Both visual and audio warning ( Driver has to take necessary action to avoid collision)

Step 6: Test you Setup

Now whole system is ready to test. Please see the Both video to see the how to check the system is working.

 

Blog at WordPress.com.

Up ↑

%d bloggers like this: