Sei sulla pagina 1di 7

ㆍ주 제: 아두이노 프로젝트

ㆍ과 목 명: 메카트로닉스설계
ㆍ학 과: 미래형자동차공학
ㆍ학 번: 1803141
ㆍ이 름: 마운뚜 나디야 노파리츠카
ㆍ제 출 일: 2018.12.10
ㆍ담당교수: 유성구 교수님
ARDUINO PROJECT
PARKING SENSOR
WITH ARDUINO

1803141 (마운뚜 노파리츠카 나디야)


PARKING SENSOR WITH ARDUINO

Overview
Almost all modern cars are equipped with reverse parking sensors that are
activated when the car is put in reverse gear and beep at variable rate depending on
the distance between the car and the closest obstacle. The Reverse Parking Sensors
that are equipped in the car are basically Ultrasonic Proximity Sensors i.e. they use
Ultrasonic Sensors to measure the distance between the car and the object and warn
the driver if the car is too close.
The principle of the project is as follows: The Ultrasonic Sensor sends acoustic
pulses and the Arduino measures the interval of each reflected signal. Based on this
time interval, Arduino then calculates the distance of the object.

Arduino then activates the Buzzer if the distance between the sensor and
object is less that a certain range. The 16x2 LCD Display displays the measured
distance.

Block Diagram

A
R
Ultrasonic D 16x2 LCD
Sensor U Display
HC – SR04 I
N
O

Buzzer
1. 16x2 LCD Display

 Displaying the measured distance.

2. Arduino

 Arduino is the brain of the project.It will be controlling and coordinating all the
other blocks.

3. Buzzer

 It is used to make the project more user friendly. This will produce buzzing
sound according to the distance measured.

4. Ultrasonic sensor

 This is mainly responsible for measuring the distance. The working principle of
the ultrasonic sensor is it emits an ultrasound at 40 kilohertz which travels through
the air and if there is an object or obstacle on its path it will bounce back to the
module. Considering the travel timing and the speed of sound, we can calculate
the distance.

Fig. 1. Main Principle of Ultrasonic sensor


Construction

Components and Supplies

- Arduino NANO - Breadboard

- Connecting wires - 16x2 LCD Display

- Buzzer - Ultrasonic Sensor – HC-SR04

- Arduino IDE software


Step

- There 4 pins in Ultrasonic sensor HC-SR204, The VCC and GND are connected to +5V and
GND of the power supply while the Trig and Echo pins are connected to Digital I/O PWM
(Pulse-width modulation) pins of the Arduino.
- There are two pins coming out the bottom of the buzzer, the longer of the two is the positive
and the shorter the negative. Place it in the breadboard and connect the negative pin to the
ground line, and the positive pin to digital pin on the Arduino.
- Connect the I2C 16x2 LCD GND pin to GND and VCC pin to 5V of the Arduino. The SDA and
SCL pins are connected to A4 and A5 respectively.

Program

1. #include
 We must require to include two libraries, in order to work the code. We must include
< LiquidCrystal.h> for LCD Display and <Ultrasonic.h> for the Ultrasonic sensor.
 Example:
#include < LiquidCrystal.h>
#include < Ultrasonic.h

2. cons int
 We must define the constant pin number for the buzzer (cons int buzzPin) and also the
constant pin number for Ultrasonic sensor (cons int trigPin and cons int echoPin).
 Example:
const int buzzPin = 7;
const int trigPin = 5;
const int echoPin = 6;

3. Serial.begin
 Starts the serial communication
 Example :
Serial.begin(9600);

4. pinMode
 Set the Pin number as Output or Input.
 Example :
PinMode(trigPin, OUTOUT); // set the trigger pin as Output
PinMode(echoPin, INPUT); // set the echo pin as Input
PinMode(buzzPin, OUTPUT); // set the buzzer pin as Output
5. LCD Coding
 Example :

LCD.begin(16,2); //Tell Arduino to start your 16 column 2 row LCD


LCD.setCursor(0,0);//Set LCD cursor to upper left corner, column 0 row 0
LCD.print("Target Distance:"); //Print Message on First Row
LCD.setCursor(0,1); //Set cursor to first column of second row
LCD.print(Distance); //Print measured distance

6. Ultrasonic Sensor Coding


 Example :

digitalWrite(trigPin, LOW); //Set trigger pin low


delayMicroseconds(2000); //Let signal settle
digitalWrite(trigPin, HIGH); //Set trigPin high
delayMicroseconds(15); //Delay in high state
digitalWrite(trigPin, LOW); //ping has now been sent
delayMicroseconds(10); //Delay in high state
duration = pulseIn(echoPin, HIGH);
distance = 0.034*(duration/2); // Calculate the distance

7. Buzzer Coding
 Example :

if (dist < 100)


{
digitalWrite(buzzPin, HIGH); // If the distance is less than 100,
buzzer wil ring
}
Else
{
digitalWrite(buzzPin, LOW); // buzzer will be turned off
}
Delay(300); // delay for 300 miliseconds
}

Potrebbero piacerti anche