Smart Parking System
Smart Parking System
CHAPTER-1
INTRODUCTION
1.1 Background of study and motivation:
Parking is a major problem in our country. Drivers in our country cannot properly park
their vehicle in the parking slot because of improper parking system. Sometimes when
they do not find any parking space, they park their vehicle in the roadside and as a result
roads become so narrow and occurs traffic jam. Also, sometimes it seems that people
start fighting for parking slot in the parking lot. Because from outside people cannot
understand weather there is any parking slot is available or not. It also wastes our lot of
time. Till now no smart technology exists to solve this problem. This project will change
and standardize the parking system for a parking lot.
An automated car parking system is a process through which car parking can be done more
efficiently and easily than manual method. The system will provide the user better services.
The system counts the number of cars in the garage and checks if there’s any vacancy.
There’s an entry and exit path. When vehicle enters, the display shows the number of cars
inside. When any vehicle leaves, the count decreases and shown on display. If the garage is
full. The display will show a message regarding that. This whole process includes the use of
Arduino, Display and sensor. The sensor detects whether the vehicle is entering or leaving.
The report then showed on display.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 1
Smart Parking System
1.2 Project Objectives:
The objectives to be achieved are:
➢ Providing safe and secure parking spots within a limited space.
➢ Developing a sophisticated automated parking system that lowers workforce, and
traffic congestion and save time.
➢ Automatically keeping count and monitoring total entered and exited vehicle and
calculate free available slots.
➢ Implementing a digital payment method for parking system.
1.3 Report outlines:
In this report, the background of study and motivation of Smart parking system were described. under
introduction section 1. The project objectives were briefly discussed.
To complete this report, 7 different literatures were reviewed to gather the knowledge of the ongoing
development of Smart parking system.
In the methodology and modeling section 3, the working principle of the proposed report of Smart
parking system was described. The process of work was explained. The important components of the
model were described. Then the implementation of the theory and components were explained. After
that, the test/experimental setup was performed and noted. The total estimated cost of the project was
explained including the individual component’s costs.
In section 4 results and discussion, the simulation / numerical analysis was described. Measured
responses and experimental results were analyzed and discussed. The comparison between numerical
and experimental data was not discussed as Due to the pandemic, the current mode of education is
completely online based.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 2
Smart Parking System
CHAPTER-2
LITERATURE REVIEW
In 2012, M. M. Rashid and colleagues introduced an Automatic Parking Management
System based on Number Plate Recognition (NPR). The system employed image
processing techniques to detect car number plates, allowing for automatic parking fee
collection. Their approach involved extracting license plates from images, followed by
character segmentation and rearrangement for accurate identification.
In 2016, Ter-Feng Wu and team explored a smart parking system using ultrasonic sensors.
The system utilized these sensors to detect parking space availability and guide a smart
wheeled mobile robot (SWMR) to park autonomously. The robot could control the
servomotors to maneuver, park, and reverse, offering a practical solution for roadside and
reverse parking.
A similar system was developed in 2020 by a group of Indonesian researchers, who
implemented a Radio Frequency Identification (RFID)-based parking system. Using an
AT89C51 microcontroller, the system enabled automatic parking lot management and
parking space reservation. RFID tags allowed users to enter and exit parking areas with ease.
In the same year, Mohapatra and colleagues researched ultrasonic sensor-based parking
systems, emphasizing collision avoidance and efficient parking slot management by
calculating slot fill levels through distance measurements.
In Saudi Arabia, Mohammed Omar Ba Sabean and colleagues in 2015 designed a smart
parking system integrating a mobile app to control vehicle access and payment in parking
lots. This system aimed to reduce human intervention, offering an efficient and secure
parking solution. It also included an SMS-based confirmation feature for parking
reservations. In India, D.J. Bonde and team (2018) developed a similar automated parking
system, using Android applications to control parking space management and automate
vehicle parking and retrieval. Another Indian study by D. Yashwant (2019) also proposed an
automated car parking system based on sensors and Android control.
In 2015, Basavaraj S. R. introduced a Smart Parking System using the Internet of
Things (IoT), enabling users to locate available parking spaces and reduce the time spent
searching for parking. The system aimed to reduce fuel consumption and carbon emissions
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 3
Smart Parking System
by guiding drivers to the nearest available spots. By integrating IoT, it allowed users to
access parking information remotely. Deepthi S. and Anil A. R. (2016) explored the use of
Parking Guidance Information (PGI) systems, which provided real-time data through
Variable Message Signs (VMS). They highlighted the benefits of e-parking, allowing users
to reserve parking spaces ahead of time.
An IoT-based cloud-integrated smart parking system was proposed by Abhirup Khanna
in 2016, which utilized IoT modules to monitor parking space availability in real time. This
system aimed to improve urban infrastructure reliability by minimizing traffic congestion
and maximizing parking space utilization
In the field of image processing, R. Yusnita and colleagues (2016) proposed an intelligent
parking system that detected available parking spaces using camera images processed in real
time. The system displayed the available spots on a seven-segment display for user
convenience. In 2007, D.B.L. Bong and team developed the Car-Park Occupancy
Information System (COINS), using surveillance cameras and image processing algorithms
to detect parking space availability. This system aimed to reduce the time drivers spent
searching for parking spots in large parking areas like shopping malls and stadiums.
A cloud-based intelligent parking system was introduced in 2016 by Ivan Guanche and
Mairtin O’ Dorma to manage parking spaces efficiently in smart cities. This system
integrated IoT subsystems including sensors, communication layers, and cloud-based
services. It aimed to optimize parking space allocation and reduce waiting times by
providing real-time data on parking availability and location. Similarly, a 2015 study
presented an enhanced cloud-based smart parking system using IoT technologies to help
users find free parking spaces with minimal cost. The system sent parking data, including
vehicle location and free space availability, to a cloud server for real-time updates.
In 2015, Faiz Shaikh reviewed various smart parking techniques, highlighting solutions
using wireless sensor networks for real-time data analysis. The paper emphasized the
importance of resource allocation and reservation systems to improve parking efficiency and
address urban traffic congestion.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 4
Smart Parking System
CHAPTER-3
Methodology and Modeling
3.1 Introduction:
This chapter will cover the details explanation of methodology that is being used to make this
project complete and working well. Manymethodologiesor findings from this field mainly
generated into journal for others to take advantages and improve as upcoming research on
projects. The methodology refers to the overall approach that our project requires. We need to
explain our project briefly, demonstrating that we comprehend the meaning of our
approaches. The methods are the tools of data collection, the procedure of our project. The
procedures or strategies used to find, select, process, and analyze information about a topic
are referred to as methodology.
Shrewd Car Parking System Using Arduino UNO Designing, creating and delivering a main
edge stopping innovation is called as Smart stopping. It is a vehicle stopping framework that
helps drivers locate an empty spot. Utilizing the Ultrasonic sensors in each stopping space, it
identifies the nearness or nonattendance of a vehicle. Brilliant Parking framework is
demonstrated as a correct, strong and cost-effective approach to guarantee that street clients
know precisely where empty car parking spots are.
A particular procedure or set of procedures demonstrating the issue is massive revision of
teaching methodology. In a report or article, the methodology section allows the reader to
critically evaluate a study's overall validity and reliability. So, this methodology chapter
explains what we did and how we did it.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 5
Smart Parking System
3.2 Block Diagram of the proposed project:
Block Diagram of our proposed system is given below:
Figure-1:Circuit diagram of car parking system
The circuit shown in Fig. 1 an Arduino microcontroller (MCU) requires only 5V. As Arduino
Uno has an inbuilt 5V voltage regulator, a common 5V supply can be used for the whole
system.
The brain of the circuit is Arduino Uno MCU board (BOARD1). It is based on Arduino UNO
R3 V1.0and has 14 digital input/output (I/O) pins, six analogue inputs, servo motor, a USB
connection, IR sensor with 12 C module among others. It can be programmed using Arduino
IDE software IR sensor are connected to Arduino digital pins 2 and 3 and servo motor are
connected to Arduino pins 13, which are used for serial communication.
The LCD display (LCD1) is used to display messages during action. Here, a 16×2 display is
used; each character is made of 5×7 dot-matrix. Pins 3, 4, 5 and 6 of the LCD are the control
lines connected to preset (PR1) output, pin 12 (Arduino), GND and pin 11 (Arduino). Pins 11,
12, 13 and 14 are data pins of the LCD that are connected to pins 7, 6, 5 and 4 of Arduino,
respectively. Preset PR1 is used to adjust the contrast of the LCD display.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 6
Smart Parking System
3.3 Construction and working principle:
The construction and working of the project are divided into two parts:-
1)Entry Part:
The project is a sensor based automatic [Link] Entry Part of the project consists of
Arduino Mega microcontroller to which a servo motor, IR sensor, LCD are interfaced. The
servo motor acts as a gate at the entrance and it opens and closes when the IR sensor detects
presence of car. The input IR sensors reads presence of any car and sends to the controller
Arduino UNO board. While entry IR sensor detect car, it opens the door in condition of
having available slot. After entering the car, the gate gets closed with the help of servo motor.
The motor gets instruction from the board. The LCD displays the parking slots which are
empty for the car drivers. While A car gets into a slot, the corresponding slot status in the
LCD display shows "Have space". At the time of exiting a slot, the status of the slot changed
to "Vacant". When all the slots are booked, the system doesn't allow the sixcar to enter, and
shows "Sorry parking full". The IR sensors detect the presence and absence of car in each
parking slot.
Figure-2:Entry part of car parking system
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 7
Smart Parking System
2)Exit Part
The Exit Part of the project consists of Arduino Uno to which a servo motor, IR sensor
and the object counter are interfaced. The servo motor acts as a gate at the entrance and
it opens and closes when the IR sensor detects presence of car. When a car exits from a
slot, the exit IR sensor detects the car and opens the gate with the servo motor. Then
total available free slot count increase by 1 in the screen.
Figure-3:Exit part of car parking system
The system will be very reliable and understandable to the users.
3.4 Hardware Design
Hardware equipment that we need in order to build the project are given below:
1. Arduino UNO
2. IR Sensors
3. LCD Screen
4. Power Supply
5. Connecting Wires
6. I2 C module
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 8
Smart Parking System
3.5 Description of the important component:
First of all, we use Ardiuno IDE software to complete the simulation. in this simulation,
we've used some important components to build the whole parking system, which are
Arduino UNO R3 V1.0, , LM044L 20x4 Alphanumeric Display, MOTOR-PWMSERVO, IR
sensor with module.
3.5.1Arduino Board:
Arduino is a project made by the largest technical community of engineers, developers and
hobbyists whose goal is to develop ideas and interactive control projects around the world,
based on different types of electronic panels but programmed in a language Single
programming and free.
Figure 6: Arduino UNO Board.
Sure, Arduino is not the only electronic controller in the market, but there are many micro-
controllers available in the market such as Parallax, Basic Stamp and the most powerful
competitor, Raspberry Pi, all with powerful capabilities and the ability to work. Full projects,
of course depending on the needs of your project, but what distinguishes the following
Arduino Open-source platform Open-Source Hardware and Software.
Arduino is made primarily of ATMEGA8 and ATMEGA168 controllers, and all its designs
are licensed under the Creative Commons license. This is the most important feature for
electronic circuit designers because it makes it easier for them to design anything they want.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 9
Smart Parking System
The software is written in C ++, and is available to everyone to download and programmers
can modify it according to their needs.
Advantages of Arduino:
Simplicity
The price
Self-Assembly
Multi-platform
Easy and simple software environment
3.5.2 20x4 Alphanumeric Display
16x2 Alphanumeric Display means it can display 16 characters per line and there are 2 such
lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two
registers, namely, Command and Data.
Figure 8: 20x4 Alphanumeric Display
The term LCD stands for liquid crystal display. It is one kind of electronic display module
used in an extensive range of applications like various circuits & devices like mobile
phones, calculators, computers, TV sets, etc. These displays are mainly preferred for multi-
segment light-emitting diodes and seven segments. The main benefits of using this module
are inexpensive; simply programmable, animations, and there are no limitations for
displaying customcharacters,special and even animationsetc.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 10
Smart Parking System
3.5.3 SERVO MOTOR:
A Servo Motor is a small device that has an output shaft. This shaft can be positioned to
specific angular positions by sending the servo a coded signal. As long as the coded signal
exists on the input line, the servo will maintain the angular position of the shaft.
Figure 9: SERVO MOTOR
The servo engine is a motor that comes with a Gear gearbox and a Shaft transmission that gives
motion greater torque and greater precision. This engine can rotate 180 degrees and in some types
360 degrees. The servomotor is internally made up of a "mostly microcontroller" control circuit.
When the engine gives pulses at a certain time constant, the engine rotates to the angle according
to that time constant. Edited with the trial version of To remove this notice, visit [Link]
14 In each type, the time constant varies from one engine to another according to the
manufacturer and the technical bullet in that comes with the servo engine. In the Arduino,
programming environment there is a library called Servo Library installed in the program. This
library gives us the ability to control most of the 180-degree Cervo drives. At the end of this post,
you will have the ability to use the library's commands through practical examples.
3.5.4 IR Sensor:
An infrared (IR) sensor is a type of electrical gadget that detects and measures infrared
radiation in its surroundings. In the year 1800, an astronomer named William Herchel made
an unintentional discovery of infrared radiation. He found that the temperature just beyond
the red light was the highest when measuring the temperature of each hue of light
(separated by a prism). Because the wavelength of IR is longer than that of visible light, it
is invisible to the human eye (though it is still on the same electromagnetic spectrum).
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 11
Smart Parking System
Infrared radiation is emitted by everything that emits heat (anything with a temperature
over roughly five degrees Kelvin).
Figure 11: Obstacle Infrared Sensor module MOD56
The IR sensor module includes five essential parts like IR Tx, Rx, Operational amplifier,
trimmer pot (variable resistor) & output LED. The pin configuration of the IR sensor module
is discussed below.
• VCC Pin is power supply input
• GND Pin is power supply ground
• OUT is an active-high o/p
3.5.5 I2C Module
Figure-12:I2C Module
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 12
Smart Parking System
An I2C module for an LCD display simplifies the process of connecting and controlling an
LCD screen using the I2C communication protocol. Here are some key points:
•Communication: Uses only two wires (SDA for data and SCL for clock) to communicate
with the microcontroller.
•Pin Efficiency: Reduces the number of pins needed on the microcontroller, making it easier
to connect multiple devices.
•Addressing: Each I2C device has a unique address, allowing multiple devices to be
connected on the same bus.
•Compatibility: Works with various LCD sizes, commonly 16x2 or 20x4 displays.
•Power Supply: Typically operates at 5V.
•Contrast Adjustment: Often includes a built-in potentiometer for adjusting the display
contrast.
•Backlight Control: Can include options for controlling the backlight.
3.5.6 other components
Figure -12: Other Components.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 13
Smart Parking System
3.6Flow Chart
The flow chart includes how the system works. The program flow chart is given below:
Figure-13: Flow chart of Smart Parking System
➢ Working
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 14
Smart Parking System
Car Parking System implemented using an Arduino, servo motor, and an LCD with IR
sensors to detect the presence of cars in parking slots. Here is the step-by-step working
process of the code:
Code Breakdown and Working Process:
1. Initialization (setup() Function):
Initializes serial communication, pins, and components.
Servo motor is set to a neutral position (90°).
LCD is initialized to display a welcome message ("Car Parking System").
Reads the current state of parking slots using the Read_Sensor() function and calculates the
number of available slots.
2. Reading Sensor Status (Read_Sensor() Function):
Each IR sensor (connected to pins 5-10) checks whether a car is present in the respective slot.
If a sensor detects a car (returns LOW), the corresponding slot is marked as occupied (S1 to
S6).
3. Main Logic (loop() Function):
Display Slot Status:
Continuously updates the LCD to show the number of available slots (slot) and the status
(Empty/Fill) of each slot (S1-S6).
Car Entry (ir_enter):
When the entry IR sensor (pin 2) detects a car (sensor returns LOW) and there are available
slots:
The servo motor rotates to 180° to open the gate.
Decrements the slot count by 1 to reflect the new car parked.
If no slots are available, it displays "Sorry Parking Full" on the LCD for 1.5
seconds.
Car Exit (ir_back):
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 15
Smart Parking System
When the exit IR sensor (pin 4) detects a car (sensor returns LOW):
The servo motor rotates to 180° to open the gate.
Increments the slot count by 1 to reflect the car leaving the parking lot.
Reset Gate:
Once both entry and exit conditions (flag1 and flag2) are processed, the servo motor resets to
90° (closed position).
1. Initial Setup:
The system initializes and displays the number of available parking slots based on IR sensor
readings.
2. Car Entry:
When a car approaches the entry IR sensor:
If slots are available, the gate opens, and the slot count decreases.
If slots are full, the system displays "Sorry Parking Full".
[Link] Exit:
When a car approaches the exit IR sensor, the gate opens, and the slot count increases.
4. Slot Monitoring:
The status of each parking slot is constantly monitored and updated on the LCD display.
Key Features:
Dynamic Slot Management: Automatically adjusts the slot count based on car entry and exit.
Real-Time Display: Updates the parking status and availability in real time on
the LCD.
Servo-Controlled Gate: Automates the barrier for entry and exit.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 16
Smart Parking System
3.7 Problem Statement:
Parking Lot Problems
Difficulty in Finding Vacant Spaces Quickly finding a vacant space in a multilevel parking lot
is difficult if not impossible, especially on weekends or public holidays. Finding spaces
during weekends or public holidays can take more than 10 minutes for about 66% of visitors.
Stadiums or shopping malls are crowded at peak periods, and difficulty in finding vacant
slots at these places is a major problem for customers. Insufficient car park spaces \ lead to
traffic congestion and driver frustration.
Improper Parking
If a car is parked in such a way that it occupies two parking slots rather than one, this is
called improper parking. Improper parking can happen when a driver is not careful about
another driver’s rights. This is tackled by the development of automated smart car parking
system.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 17
Smart Parking System
CHAPTER-4
RESULTS AND DISCUSSION
1. It guarantees snappy and computerized parking and simple recovery of vehicles.
2. Up to 3 cars can be effectively and securely parked in the outlined model.
3. The surface space required is identical to the parking spot of two cars as it were.
4. Most reasonable for parking in workplaces, shopping centers and comparable spots.
5. Low support levels are required by the framework.
6. Sensors utilized have high affectability and are anything but difficult to deal with.
7. Minimal effort framework, giving most extreme computerization.
8. It doesn't require observable pathway operation.
9. Cordial reorientation of cars for driving in and out.
10. Security of vehicle.
4.1Hardware Connections:
Figure 21: Working model of Smart Car Parking System
• Connect the Vcc stick to the positive rail on your breadboard.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 18
Smart Parking System
• Connect the Gnd stick to the negative rail on your breadboard.
• Connect the Trig stick to any advanced stick on the Arduino.
• Connect the Echo stick to any computerized stick on the Arduino.
• Finally, interface the positive rail of the breadboard to 5V stick on the Arduino and the
negative rail of the breadboard to the Gnd stick on the Arduino.
Figure-22: Actual Working Model
4.2 Advantage of smart car parking system
1. Reduced traffic
2. Reduced pollution
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 19
Smart Parking System
3. Enhanced User Experience
4. Integrated Payments and POS
5. Increased Safety
6. Real-Time Data and Trend Insight
7. Decreased Management Costs
8. Increased Service and Brand Image
[Link] from theft and car damages
10. Simple structure, simple operation
4.3 Disadvantage of smart car parking system
1. It achieves wireless technology with limited options of connecting to particular device only
2. It does not know who the driver in the car is, checks only the key placed
3. Node-to-node implementation requires more time.
4.4 Benefit analysis of smart car parking system
1. Reduced traffic
[Link] pollution
3. Enhanced User Experience
4. Integrated Payments and POS
[Link] Safety
6. Real-Time Data and Trend Insight
7. Decreased Management Costs
8. Increased Service and Brand Image
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 20
Smart Parking System
CHAPTER-5
CONCLUSIONS AND FUTURE WORK
5.1 Conclusion
Our project detects the empty slots and helps the drivers to find parking space in unfamiliar
city. The average waiting time of users for parking their vehicles is effectively reduced in this
system. The optimal solution is provided by the proposed system, where most of the vehicles
find a free parking space successfully. Our preliminary test results show that the performance
of the Arduino UNO based system can effectively satisfy the needs and requirements of
existing car parking hassles thereby minimizing the time consumed to find vacant parking lot
and real time information rendering. It also eliminates unnecessary travelling of vehicles
across the filled parking slots in a [Link] Parking solutions are designed to provide
drivers an ultimate solution on their journey from the beginning to end without searching for
parking, cost, travel time etc. This advantage comes by paying marginal fees to the smart
parking service providers. To change a culture which has been existing for several centuries is
a humongous task. Parking has always been an at the moment affair with direct cash
exchange. The inclusion of technology in this method is a change in culture which will take
the time to establish. Smart Parking is one of the most adopted and fastest growing smart city
solutions across the world. Airports, universities, shopping centers and city garages are just a
few entities that have begun to realize the significant benefits of automated parking
technology.
In this study, the various types of smart parking system and has been presented. From the
various examples of the implementation of the smart parking system being presented, its
efficiency in alleviating the traffic problem that arises especially in the city area where traffic
congestion and the insufficient parking spaces are undeniable. It does so by directing patrons
and optimizing the use of parking spaces. With the study on all the sensor technologies used
in detecting vehicles, which are one of the most crucial parts of the smart parking system, the
pros and cons of each sensor technologies can be analyzed. Although, there are certain
disadvantages in the implementation of visual based system in vehicle detection as described
earlier, the advantages far outweigh its disadvantages.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 21
Smart Parking System
5.2 Future Work
In some of the parking areas are lacking such facilities and hence fail all the security norms
necessary to park a vehicle. By looking such a huge concern, it is highly required that each
and every parking area should be well equipped with high tech parking control systems,
that nevertheless lasts the best. These innovative parking control systems not only make a
bright choice but also allow you to pay the right price without getting any worry. Parking
control system has been generated in such a way that it is filled with many secure devices
such as barricades, swing gates, slide gates, parking control gates, toll gates, time and
attendance machine, car counting system etc. These features are hereby very necessary
nowadays to secure your car and also to evaluate the fee structure for every vehicle’s entry
and exit. Nowadays parking is very important and hence it is necessary for every vehicle
owner to park his or her car in a secure designated parking slot available. To escalate this
particular system various parking owners have integrated themselves with sophisticated
parking control systems, which are high tech and offers full-fledged parking services.
REFERENCES
[1] Thanh Nam Pham1, Ming-Fong Tsai1, Duc Bing Nguyen1, Chyi-Ren Dow1 and Der-
Jiunn Deng2. “A Cloud- Based Smart-Parking System Based on Internetof-Things
Technologies”. IEEE Access, volume 3, pp. 1581 – 1591, September 2015.
Youtube link ->[Link]
[3] Yanfeng Geng and Christos G. Cassandras. “A New Smart Parking System Based on
Optimal Resource Allocation and Reservations”. IEEE Transaction on Intelligent
Transportation Systems, volume 14, pp. 1129 -1139, April 2013.
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 22
Smart Parking System
Working code :
#include <Servo.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
Servo myservo;
#define ir_enter 2
#define ir_back 4
#define ir_car1 5
#define ir_car2 6
#define ir_car3 7
#define ir_car4 8
#define ir_car5 9
#define ir_car6 10
int S1 = 0, S2 = 0, S3 = 0, S4 = 0, S5 = 0, S6 = 0;
int flag1 = 0, flag2 = 0;
int slot = 6;
void setup() {
[Link](9600);
pinMode(ir_car1, INPUT);
pinMode(ir_car2, INPUT);
pinMode(ir_car3, INPUT);
pinMode(ir_car4, INPUT);
pinMode(ir_car5, INPUT);
pinMode(ir_car6, INPUT);
pinMode(ir_enter, INPUT);
pinMode(ir_back, INPUT);
[Link](3);
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 23
Smart Parking System
[Link](90); // Initial position: closed
[Link]();
[Link]();
[Link](0, 1);
[Link](" Hi Welcome To ");
[Link](0, 2);
[Link](" Digital Parking ");
delay(5000);
[Link]();
[Link](0, 0);
[Link]("System Initializing");
[Link](0, 1);
[Link]("Please Wait...");
delay(3000);
[Link]();
[Link](0, 0);
[Link]("Initializing Slots");
[Link](0, 1);
[Link]("Checking Sensors...");
delay(3000);
[Link]();
Read_Sensor();
slot = 6 - (S1 + S2 + S3 + S4 + S5 + S6); // Calculate available slots
}
void loop() {
Read_Sensor();
slot = 6 - (S1 + S2 + S3 + S4 + S5 + S6); // Recalculate available slots
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 24
Smart Parking System
// Display available slots
[Link](0, 0);
[Link](" Available Slot: ");
[Link](slot);
[Link](" "); // Clear trailing characters
// Display slot status
[Link](0, 1);
[Link](S1 ? "S1:Full " : "S1:Empty");
[Link](11, 1);
[Link](S2 ? "S2:Full " : "S2:Empty");
[Link](0, 2);
[Link](S3 ? "S3:Full " : "S3:Empty");
[Link](11, 2);
[Link](S4 ? "S4:Full " : "S4:Empty");
[Link](0, 3);
[Link](S5 ? "S5:Full " : "S5:Empty");
[Link](11, 3);
[Link](S6 ? "S6:Full " : "S6:Empty");
// Entry logic
if (digitalRead(ir_enter) == 0 && flag1 == 0) {
if (slot > 0) { // Allow entry if slots are available
flag1 = 1;
[Link](180); // Open gate
delay(1000); // Wait for car to pass
} else {
// Display "Parking Full" message
[Link]();
[Link](0, 1);
[Link](" Sorry Parking ");
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 25
Smart Parking System
[Link](0, 2);
[Link](" is Full ");
delay(2000); // Show message for 2 seconds
[Link]();
}
}
// Exit logic
if (digitalRead(ir_back) == 0 && flag2 == 0) {
flag2 = 1;
[Link](180); // Open gate for exit
delay(2000); // Wait for car to pass
}
// Close gate after entry or exit
if (flag1 == 1 || flag2 == 1) {
delay(1000); // Short delay
[Link](90); // Close gate
flag1 = 0;
flag2 = 0;
}
delay(100); // Small delay for stability
}
void Read_Sensor() {
// Read the status of all 6 IR sensors
S1 = digitalRead(ir_car1) == 0 ? 1 : 0;
S2 = digitalRead(ir_car2) == 0 ? 1 : 0;
S3 = digitalRead(ir_car3) == 0 ? 1 : 0;
S4 = digitalRead(ir_car4) == 0 ? 1 : 0;
S5 = digitalRead(ir_car5) == 0 ? 1 : 0;
S6 = digitalRead(ir_car6) == 0 ? 1 : 0;
}
Dept of ECE ,BKIT Bhalki 2024 – 2025 page 26