This system works when it will park the car, so there is an "early warning" when the distance (rear) is already close to the wall for example, will appear warning. Warning is a "tit ..." sound generated by the buzzer.
Hardware Requirement
- Ultrasonic Sensor HC-SR04
- 16 x 2 LCD Module
- A Buzzer
- Power supply +5 Volt
- Jumper
Block Diagram
Schematic
Arduino - LCD Wiring
Arduino - Ultrasonic Sensor Wiring
Arduino - Buzzer Wiring
Source Code/Sketch
#define TRIGPIN 8
#define ECHOPIN 9
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5,6,7);
int jarak,timer;
void setup(){
lcd.begin(16, 2);
lcd.print(" ALARM PARKIR");
lcd.setCursor(0, 1);
lcd.print(" MOBIL ");
delay(2000);
lcd.clear();
lcd.print("Status=");
pinMode(ECHOPIN, INPUT);
pinMode(TRIGPIN, OUTPUT);
pinMode(11,OUTPUT);
}
void loop(){
digitalWrite(TRIGPIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIGPIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIGPIN, LOW);
timer = pulseIn(ECHOPIN, HIGH);
jarak= timer/58;
if (jarak>25){
lcd.setCursor(7,0);
lcd.print("Aman ");
}
else if(jarak>20){
lcd.setCursor(7,0);
lcd.print("Awas ");
digitalWrite(11,1);
delay(500);
digitalWrite(11,0);
delay(500);
}
else if(jarak>10){
lcd.setCursor(7,0);
lcd.print("Waspada");
digitalWrite(11,1);
delay(300);
digitalWrite(11,0);
delay(300);
}
else {
lcd.setCursor(7,0);
lcd.print("Bahaya ");
digitalWrite(11,1);
delay(100);
digitalWrite(11,0);
delay(100);
}
}
#define ECHOPIN 9
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5,6,7);
int jarak,timer;
void setup(){
lcd.begin(16, 2);
lcd.print(" ALARM PARKIR");
lcd.setCursor(0, 1);
lcd.print(" MOBIL ");
delay(2000);
lcd.clear();
lcd.print("Status=");
pinMode(ECHOPIN, INPUT);
pinMode(TRIGPIN, OUTPUT);
pinMode(11,OUTPUT);
}
void loop(){
digitalWrite(TRIGPIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIGPIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIGPIN, LOW);
timer = pulseIn(ECHOPIN, HIGH);
jarak= timer/58;
if (jarak>25){
lcd.setCursor(7,0);
lcd.print("Aman ");
}
else if(jarak>20){
lcd.setCursor(7,0);
lcd.print("Awas ");
digitalWrite(11,1);
delay(500);
digitalWrite(11,0);
delay(500);
}
else if(jarak>10){
lcd.setCursor(7,0);
lcd.print("Waspada");
digitalWrite(11,1);
delay(300);
digitalWrite(11,0);
delay(300);
}
else {
lcd.setCursor(7,0);
lcd.print("Bahaya ");
digitalWrite(11,1);
delay(100);
digitalWrite(11,0);
delay(100);
}
}
How it Works
1. Connect the Arduino with Peripherals needed
2. Plug in the Power Source on the device
3. Compile and upload the script program above to your arduino
4. First initial LCD display
5. After 2 seconds the ultrasonic sensor reads the distance immediately and displays the distance of
the car with the object behind it. If the distance between the object with the sensor is greater than
25 cm (distance <25cm) then the buzzer does not ring and the LCD shows "status = Secure".
6. If the distance between the object with the sensor is less than 25 cm (distance <25cm) and the
sensor distance is greater than 20 cm (distance> 20cm) then the buzzer sounds low frequency and
LCD displays "status = "Watch Out".
7. If the distance between the object and the sensor is smaller than 20cm (distance <20cm) and the
sensor distance is greater than 10cm (distance> 10cm) the buzzer sounds medium frequency and
the LCD displays "status = Alert".
8. If the distance between the object with the sensor is smaller than 10 cm (distance <20cm) then
buzzer sounds with high frequency and LCD displays "status = danger".
Video for Project V - 4. Car Parking System (Arduino Based)
Required file
No comments:
Post a Comment