Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ㆍ과 목 명: 메카트로닉스설계
ㆍ학 과: 미래형자동차공학
ㆍ학 번: 1803141
ㆍ이 름: 마운뚜 나디야 노파리츠카
ㆍ제 출 일: 2018.12.10
ㆍ담당교수: 유성구 교수님
ARDUINO PROJECT
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
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.
- 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 :
7. Buzzer Coding
Example :