Overview
This project is about parking system whenever we park our vehicle we face a problem that our vehicle should not get damaged by collapsing with another vehicle or wall or any other thing this common problem can be solved by a smart parking system.
In this smart parking system whenever your vehicle comes closer to 100cm to any obstacle it will give you an sound to tell to stop not only this but the LCD will display the distance from the obstacle.
Hardware required
- Arduino Uno R3
- Resistor
- Jumper Wires
- Potentiometer
- Buzzer
- Ultrasonic Sensor
- LCD
Schematic Diagram
![](https://makersmuse.in/wp-content/uploads/2024/06/image-13.png)
Fig 1. Circuit Diagram
Arduino Code :
#include <LiquidCrystal.h>
LiquidCrystal lcd(7 , 6, 5, 4, 3, 2);
const int trigPin = 11;
const int echoPin = 10;
int const buzzPin = 12;
long duration;
int distanceCm, distanceInch;
void setup() {
lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzPin, OUTPUT);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distanceCm= duration*0.034/2;
distanceInch = duration*0.0133/2;
lcd.setCursor(0,0); // Sets the location at which subsequent text written to the LCD will be displayed
lcd.print("Distance: "); // Prints string "Distance" on the LCD
lcd.print(distanceCm); // Prints the distance value from the sensor
lcd.print(" cm");
delay(10);
lcd.setCursor(0,1);
lcd.print("Distance: ");
lcd.print(distanceInch);
lcd.print("inch");
delay(10);
if (distanceCm <= 100 && distanceCm >= 0) {
// Buzz
digitalWrite(buzzPin, HIGH);
} else {
// Don't buzz
digitalWrite(buzzPin, LOW);
}
// Waiting 60 ms won't hurt any one
delay(60);
}
Precautions
- Connections should be done properly.
- Arduino is case Sensitive so code accordingly.
- Give different and appropriate colors to the wires.
- Use resistors for sensors and LCDs.