Tuesday 1 August 2017

Reverse Car Parking using Arduino and Ultrasonic sensor.

The biggest challenge for a new car driving learner is driving the vehicle in reverse gear. It becomes difficult to view the objects behind the vehicle through the rare view mirror. This is also due to the bulky structure of the vehicle and the difficulty in looking behind when the back seats are fully occupied. In becomes difficult to judge minute movements required while passing through a tiny lane and also while removing your vehicle from parallel parking.

These challenges results in many vehicular accidents throughout the globe, many of these accidents are due to the problems that occur in detecting objects while taking a reverse.

Components Required for the project.
Arduino,Ultrasonic sensor,Lcd

1.Ultrasonic sensor- It is used to measure distance from the back for reverse parking.
2. LCD- It is used to display the distance to the driver.
3.Arduino- Microcontroller for the Project.


Interfacing arduino with Ultrasonic sensor HC-SR04 and LCD.
            

Code:

#include <LiquidCrystal.h>
int trig=2;
int echo=3;
int dist, time, ledon;
LiquidCrystal LCD(13, 12, 11, 10, 9, 8);

/* LCD RS pin to digital pin 13
 * LCD Enable pin to digital pin 12
 * LCD D4 pin to digital pin 11
 * LCD D5 pin to digital pin 10
 * LCD D6 pin to digital pin 9
 * LCD D7 pin to digital pin 8*/

void setup()
{LCD.clear(); 
  LCD.begin(16, 2);
  Serial.begin(9600);
  pinMode(trig,OUTPUT);
  pinMode(echo,INPUT);
}
void loop()
{
  lcd.clear();
  digitalWrite(trig,LOW);
  delayMicroseconds(5);
  digitalWrite(trig,HIGH);
  delayMicroseconds(10);
  digitalWrite(trig,LOW);
   time= pulseIn(echo,HIGH);
  dist= (time/58.2);
  LCD.setCursor(0,0);
  LCD.print(dist);
  LCD.setCursor(5,0);
  LCD.print("cm");
  Serial.println(dist);
  delay(500);
}

The driver will be able to park the car without looking back.
This project can be have additional features like generating bill depending upon the time the car has spent in the parking lot. Other can be adding a motor to open and close the garage door, entry and exit time in a parking lot, parking space reservations in malls, theatres etc.

No comments:

Post a Comment