2.1. Smart Parking Assistant
| Description | This project uses an ultrasonic sensor, buzzer, and LCD display to assist drivers when parking. As an object gets closer, the system displays the distance and increases the buzzer frequency. |
|---|---|
| Use case | This project is connected to real-world uses such as parking sensors commonly used in modern vehicles. |
Components (Things You will need)
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|---|---|---|
Building the circuit
Things Needed:
- Arduino Uno = 1
- Arduino USB cable = 1
- Breadboard = 1
- Jumper Wires
- Ultrasonic Sensor
- LCD Display
- Buzzer
Mounting the component on the breadboard and wiring the circuit
Step 1: Place the I2C LCD Display on the breadboard.
-
Connect the I2C LCD display by connecting SDA to A4 on the Analog side of the arduino uno board.
-
Connect SCL to A5 on the Analog side of the arduino uno board.
-
Connect VCC to 5V on the Arduino Uno board.
-
Connect GND to GND on the Arduino Uno board using jumper wires.
Step 2: Place the ultrasonic sensor on the breadboard and with the help of jumper wires.
-
Connect the ultrasonic sensor by connecting VCC to 5V
-
Connect GND to GND
-
Connect Trig to Pin 9 on the Digital side of the arduino uno board.
-
Connect Echo to Pin 10 on the Digital side of the arduino uno board
Step 3: Place the buzzer on the breadboard and with the help of jumper wires.
-
Connect the positive (+) pin of the buzzer to Digital Pin 8
-
and the negative (-) pin to GND on the Arduino Uno board.

Make sure to connect the Arduino USB cable to the Arduino board.
PROGRAMMING
Step 1: Open your Arduino IDE. See how to set up here: Getting Started.
Step 2: Write the complete program implementing the system logic with appropriate pin definitions, setup configuration, and the main control loop.
//#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int trigPin = 9;
int echoPin = 10;
int buzzerPin = 8;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzerPin, OUTPUT);
lcd.init();
lcd.backlight();
}
void loop() {
// Generate ultrasonic pulse
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Measure echo time
long duration = pulseIn(echoPin, HIGH);
// Calculate distance
int distance = duration * 0.034 / 2;
// Display distance
lcd.setCursor(0,0);
lcd.print("Distance:");
lcd.print(distance);
lcd.print("cm ");
// Alert zones
if(distance < 10){
tone(buzzerPin,1000);
}
else if(distance < 20){
tone(buzzerPin,500);
}
else{
noTone(buzzerPin);
}
delay(100);
}
Step 3: Save your code. See the Getting Started section
Step 4: Select the arduino board and port See the Getting Started section:Selecting Arduino Board Type and Uploading your code.
Step 5: Upload your code. See the Getting Started section:Selecting Arduino Board Type and Uploading your code
CONCLUSION
Distance appears on the LCD. Buzzer beeps faster as objects move closer. No sound when objects are far away.






