Smart Parking System

Introduction

Finding an available parking space can be difficult in crowded areas such as shopping malls, offices, colleges, hospitals and residential buildings. A Smart Parking System can solve this problem by automatically detecting whether parking spaces are occupied or available.

In this project, we use an Arduino, ultrasonic sensors, an LCD display, and a servo motor to create a simple automated parking system.

The ultrasonic sensors detect vehicles entering or occupying parking spaces. The Arduino processes the sensor information and displays the parking status. A servo motor can be used as an automatic entrance barrier.

How Does an Arduino Smart Parking System Work?

The basic working process is:

Vehicle → Ultrasonic Sensor → Arduino → Parking Status → LCD Display

When a vehicle approaches a parking slot, the ultrasonic sensor measures the distance between the sensor and the vehicle.

If the measured distance is below a predefined value, the Arduino considers that parking slot occupied.

If no vehicle is detected, the slot is considered available.

For example:

  • Slot 1 → Occupied
  • Slot 2 → Available
  • Slot 3 → Occupied
  • Slot 4 → Available

The LCD can display the current status.

Block Diagram

                 ┌─────────────────────┐
                 │      Vehicle                                      │
                 └──────────┬──────────┘
                                              │
                                             ▼
                  ┌──────────────────┐
                  │ Ultrasonic                              │
                  │ Sensors                                  │
                  └────────┬─────────┘
                                         │
                                        ▼
                  ┌──────────────────┐
                  │     Arduino                             │
                  │      UNO                                 │
                  └───────┬──────────┘
                                       │
              ┌───────────┴───────────┐
              │                                                            │
              ▼                                                          ▼
      ┌────────────────┐      ┌────────────────┐
      │ LCD Display                      │      │ Servo Motor                     │
      │ Parking Status                  │      │ Gate Control                     │
      └────────────────┘      └────────────────┘

Components Required

Component Quantity Purpose
Arduino UNO 1 Main controller
HC-SR04 Ultrasonic Sensor 2–4 Detect vehicles
16×2 LCD Display 1 Display parking status
Servo Motor 1 Automatic gate
Breadboard 1 Circuit assembly
Jumper Wires As required Connections
5V Power Supply 1 Power source


Circuit Diagram

                                        Arduino UNO
                                              ┌───────────────┐
                                              │                                        │
            HC-SR04 #1 ────►│ D2 / D3                          │
                                              │                                        │
            HC-SR04 #2 ────►│ D4 / D5                           │
                                              │                                        │
              Servo Motor ───►│ D9                                  │
                                              │                                        │
           LCD I2C ───────►│ SDA / SCL                       │
                                              │                                         │
                                              │ 5V       GND                     │
                                              └─┬─────────┬───┘
                                                    │                       │
                                                   ▼                       ▼
                                                +5V                  GND  

Arduino Code       

#include <Servo.h>

#define TRIG1 2
#define ECHO1 3

#define TRIG2 4
#define ECHO2 5

#define SERVO_PIN 9

Servo gateServo;

long getDistance(int trigPin, int echoPin)
{
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);

  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);

  digitalWrite(trigPin, LOW);

  long duration = pulseIn(echoPin, HIGH);

  long distance = duration * 0.034 / 2;

  return distance;
}

void setup()
{
  Serial.begin(9600);

  pinMode(TRIG1, OUTPUT);
  pinMode(ECHO1, INPUT);

  pinMode(TRIG2, OUTPUT);
  pinMode(ECHO2, INPUT);

  gateServo.attach(SERVO_PIN);

  gateServo.write(0);
}

void loop()
{
  long distance1 = getDistance(TRIG1, ECHO1);
  long distance2 = getDistance(TRIG2, ECHO2);

  bool slot1Occupied = distance1 < 10;
  bool slot2Occupied = distance2 < 10;

  Serial.print("Slot 1: ");

  if (slot1Occupied)
    Serial.println("Occupied");
  else
    Serial.println("Available");

  Serial.print("Slot 2: ");

  if (slot2Occupied)
    Serial.println("Occupied");
  else
    Serial.println("Available");

  if (!slot1Occupied || !slot2Occupied)
  {
    gateServo.write(90);
    delay(2000);
    gateServo.write(0);
  }

  delay(1000);
}

Advantages

  • Simple to build
  • Low-cost components
  • Easy to program
  • Real-time parking detection
  • Can be expanded to multiple parking spaces
  • Suitable for educational projects
  • Can be upgraded with IoT connectivity

Troubleshooting

Ultrasonic sensor always shows zero

Check:

  • TRIG connection
  • ECHO connection
  • Sensor power
  • Common ground
  • Arduino pin configuration

Servo is not moving

Check:

  • Servo signal pin
  • Power supply
  • Ground connection
  • Correct servo library

Parking status changes randomly

Try:

  • Increasing the detection distance
  • Improving sensor positioning
  • Avoiding interference between multiple ultrasonic sensors
  • Taking multiple readings and averaging them

LCD does not display anything

Check:

  • VCC
  • GND
  • SDA/SCL connections
  • I2C address
  • LCD contrast

Conclusion

The Arduino-Based Smart Parking System is a practical electronics project that demonstrates how sensors, microcontrollers and automation can work together to solve a real-world problem.

By combining Arduino UNO, ultrasonic sensors, an LCD display and a servo motor, you can build a working parking-management prototype.

The same concept can later be expanded using IoT, mobile applications, RFID, cameras and cloud services, making it a useful foundation for advanced smart-city and automation projects.

Want to build this project? Get the required electronics components from Electro Robo Store and start building your own Smart Parking System.