Course Content
IoT Engineering Course using ESP32 with 12 Real-World Projects

🚗 IoT Based Smart Parking System Using ESP32


1️⃣ Project Introduction

The IoT-Based Smart Parking System is an intelligent parking management solution designed to monitor parking slot availability in real time and automate vehicle entry using sensor-based detection.

In modern cities, drivers waste time and fuel searching for parking spaces. This increases traffic congestion and pollution. The smart parking system solves this problem by:

  • Detecting available parking slots automatically

  • Controlling entry gate based on availability

  • Providing real-time monitoring capability

  • Reducing manual supervision

This system is built using ESP32, IR sensors, Ultrasonic sensor, and Servo motor, and can be expanded to cloud-based IoT monitoring.


2️⃣ Objective of the Project

The main objectives of this project are:

  • To detect vehicle presence in parking slots

  • To count available parking spaces

  • To automate gate opening and closing

  • To prevent entry when parking is full

  • To implement an IoT-based smart city solution


3️⃣ System Overview

This parking system consists of:

  • 5 Parking Slots

  • 5 IR Sensors (One for each slot)

  • 1 Ultrasonic Sensor (At entrance)

  • 1 Servo Motor (For gate control)

  • 1 ESP32 Microcontroller (Main controller)

The ESP32 continuously monitors all sensors and controls the gate based on parking availability.


4️⃣ Working Principle of the System

Step 1: Slot Detection

Each parking slot has an IR sensor installed.

  • If a vehicle is present in the slot → IR sensor detects obstacle → Slot marked as Occupied.

  • If no vehicle is present → IR sensor detects no obstacle → Slot marked as Available.

The ESP32 counts how many slots are available.


Step 2: Vehicle Detection at Entrance

An ultrasonic sensor is placed near the entrance gate.

  • When a vehicle comes near the entrance (within a fixed distance),

  • The ultrasonic sensor measures the distance.

  • If a car is detected, ESP32 checks slot availability.


Step 3: Gate Control

  • If available slots > 0 → Servo motor opens the gate.

  • If all slots are full → Gate remains closed.

  • After a few seconds, the gate closes automatically.

This prevents unnecessary vehicle entry when parking is full.

 


5️⃣ Components Used


🔹 1. ESP32 Microcontroller

Purpose:

The ESP32 is the main controller of the system.

Work:

  • Reads IR sensors

  • Reads ultrasonic sensor

  • Counts available slots

  • Controls servo motor

  • Can send data to IoT cloud

Why ESP32?

  • Built-in WiFi and Bluetooth

  • Fast processing

  • More GPIO pins

  • Suitable for IoT applications


🔹 2. IR Sensors (5 Units)

Purpose:

To detect vehicle presence in each parking slot.

Working:

IR sensor has:

  • IR transmitter

  • IR receiver

When a car blocks the IR beam:

  • Sensor output changes state.

  • ESP32 detects slot as Occupied.

If no obstacle:

  • Slot marked as Available.

Each slot has one IR sensor.


🔹 3. Ultrasonic Sensor (HC-SR04)

Purpose:

To detect vehicle at the entrance gate.

Working:

  • Sends ultrasonic sound wave.

  • Sound reflects from object.

  • Measures time taken to return.

  • Calculates distance.

If distance is less than preset value:
→ Car detected at gate.


🔹 4. Servo Motor (SG90)

Purpose:

To control the parking gate.

Working:

  • Rotates to specific angles.

  • 0° → Gate closed.

  • 90° → Gate open.

Controlled by PWM signal from ESP32.


🔹 5. Power Supply

Purpose:

To provide stable voltage to ESP32 and sensors.

ESP32 operates at 3.3V logic level.
Servo requires 5V supply.


6️⃣ Connection Description (Without Code)


🔹 IR Sensors Connection

Each IR sensor has:

  • VCC → 3.3V or 5V (depending on module)

  • GND → GND

  • OUT → Connected to ESP32 digital GPIO pin

Each slot IR sensor connected to separate GPIO pin.

Example:

  • IR1 → GPIO 14

  • IR2 → GPIO 27

  • IR3 → GPIO 26

  • IR4 → GPIO 25

  • IR5 → GPIO 33


🔹 Ultrasonic Sensor Connection

Ultrasonic has 4 pins:

  • VCC → 5V

  • GND → GND

  • TRIG → ESP32 GPIO (Output pin)

  • ECHO → ESP32 GPIO (Input pin)

Example:

  • TRIG → GPIO 4

  • ECHO → GPIO 5


🔹 Servo Motor Connection

Servo has 3 wires:

  • Red → 5V

  • Brown/Black → GND

  • Yellow/Orange → GPIO (PWM pin)

Example:

  • Servo signal → GPIO 18

Important:
Servo should use external 5V supply if possible.


7️⃣ Advantages of This System

  • Reduces traffic congestion

  • Saves fuel

  • Automated gate control

  • Real-time slot monitoring

  • Expandable to IoT cloud

  • Scalable to large parking areas


8️⃣ Applications

  • Shopping malls

  • Hospitals

  • Airports

  • Railway stations

  • Smart cities

  • Corporate offices


9️⃣ Future Enhancements

  • Add LCD display for slot count

  • Add Blynk IoT cloud monitoring

  • Add mobile notification

  • Add RFID access control

  • Add automatic billing system

  • Add number plate recognition


🔟 Conclusion

The IoT-based Smart Parking System using ESP32 is an efficient, automated solution for managing parking spaces. It detects slot availability using IR sensors and controls vehicle entry using an ultrasonic sensor and servo motor.

This project demonstrates the practical implementation of IoT in smart city infrastructure.

Scroll to Top