Smart Parking System Using Arduino
Abstract
Finding a place to park a vehicle in the parking lot is a difficult task. The existing system uses the method of manual search, which is time-consuming. With the help of modern technology, we can easily overcome this problem. With a simple setup, we can detect whether the parking area is full or empty, which will reduce the time the individual can find a slot and can reduce the carbon emission of the vehicle. From this smart parking system project, manpower can also be reduced. We use an IR sensor to count the number of cars in a particular slot, and the count will be displayed on the 16X2 LCD. If the parking slot is full, then the servo motor is not activated and hence the driver should check for another parking lot.
Introduction
The main aim of this smart parking system project is to build a simple and efficient parking system. The increasing population had led to private vehicles, which increased the necessity for parking lots. There might be traffic jams, overcharging, very little accommodation(because of which street parking is increased), improper parking, etc. So as to avoid these issues, the concept of smart cities can be implemented. In recent years, smart cities are evolving. There are vast applications of smart cities in which smart parking systems are one of their applications. Using a smart parking system and modifying its features can make an excellent parking system. Here we built a small but effective management system for parking. Real-time car parking information can be checked, such as the number of vehicles and slots in the parking lot; whether slots are available or not; easy payment methods; a pay-and-park system; and other benefits. This parking system can also be integrated with mobile applications so that one can check each and every detail from a phone, which enables reserved parking. In this project, we use two IR sensors—one for entry and another one for exit.
Components Required
Hardware Requirements
- Arduino Uno : Arduino Uno is a microcontroller from the Arduino Family. It was developed by Arduino. cc and is based on the Microchip ATmega328P microcontroller. Uno has 20 I/O pins, 6 are analog pins and 14 are digital pins.
For more details, pinout and datasheet, you can visit : https://docs.arduino.cc/hardware/uno-rev3
- I2C LCD 16X2: LCD (Liquid Crystal Display) is a type of flat panel display used to print values.
- IR sensor: it is an electronic device that measures and detects infrared radiation in its surrounding environment.
- Servo motor:- sg90: it is a tiny and lightweight servo motor with high output power.
Software Requirements
- Arduino Ide : Arduino IDE (Integrated development environment) is software that is used to dump the program into boards. Arduino- IDE’s major use is to build electronics-related projects. Arduino is an open-source platform simple and easy-to-understand platform for coding.
HOW TO INSTALL ARDUINO IDE CLICK ON THE LINK :
http://techieyantechnologies.com/2022/10/installation-of-arduino-ide/
Block diagram
In the following block diagram, two IR sensors are used as input. Based on the input given by the IR sensor controller(Arduino UNO) will operate the output devices. Here output devices are LCD and a servo motor.
Flow Chart
A flowchart is a diagram that shows a process’ individual steps in their proper order, similarly, the following flowchart tells about the steps involved in the project and the sequential flow of the code also. So as it starts, first, it reads the sensor’s value of IR1 if it is equal to 1. then the servo will rotate 0-180. If the IR value is 2 then the servo will rotate 180-0. And it displays slots on the LCD screen.
*website used to make Flow Chart and Block Diagram : https://www.lucidchart.com/pages/
Pin Connections
I2c LCD
The SCL pin of the I2c LCD is connected to the A5 pin of the Arduino. The SDA pin of the I2c LCD is connected to the A4 pin of the Arduino. The VCC pin of the I2c LCD is connected to the Vin pin of the Arduino. The GND pin of the I2c LCD is connected to the GND pin of the Arduino.
Servo SG90
servo SG90 has three wires. connect the orange/yellow wire of the servo to the D8 of the Arduino. connect the red wire of the servo to the 5v of the Arduino. connect the brown wire of the servo to the GND pin of the Arduino.
IR Sensor 1
IR sensor 1 has three pins Vcc, gnd, and out. Vcc is connected to the D2 of the Arduino. Gnd is connected to the D3 of the Arduino. Out is connected to the D4 of the Arduino.
IR Sensor 2
IR sensor 2 has three pins Vcc, gnd, and out. Vcc is connected to the D5 of the Arduino. Gnd is connected to the D6 of the Arduino. Out is connected to the D7 of the Arduino.
Circuit diagram
Follow the below circuit diagram to understand the connection made to different devices.
Note: Make sure to take proper precautions while connecting the components.
Working
Here, In this smart parking system, use an IR sensor to count the number of cars in a particular slot, and the count will be displayed on the 16X2 LCD. If the parking slot is full, then the servo motor is not activated. we can detect whether the parking area is full or empty, which will reduce the time the individual can find a slot and can reduce the carbon emission of the vehicle
Conclusion
We developed a system that is very useful in the management of parking systems in the malls, hospitals, colleges, and offices, etc.
Working Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
#include <Servo.h> //includes the servo library
Servo myservo1;
Servo myservo2;
int ir_s1 = 2;
int ir_s2 = 5;
int Total = 4;
int Space;
int maxcars = 4;
int flag1 = 0;
int flag2 = 0;
void setup()
{
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(ir_s1, INPUT);
pinMode(ir_s2, INPUT);
myservo1.attach(8);
myservo1.write(100);
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.setCursor (0,0);
lcd.print(" Car Parking ");
lcd.setCursor (0,1);
lcd.print(" System ");
delay(2000);
lcd.clear();
Space = Total;
}
void loop()
{
digitalWrite(3,LOW);
digitalWrite(4,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
lcd.clear();
lcd.setCursor (0,0);
lcd.print("Total Space: ");
lcd.print(Total);
lcd.setCursor (0,1);
lcd.print("Have Space: ");
lcd.print(Space);
delay(1000);
if(digitalRead (ir_s1) == LOW && flag1==0)
{
if(Space>0){flag1=1;
if(flag2==0)
{
myservo1.write(0);
myservo2.write(0);
Space = Space-1;
}
}
else
{
lcd.setCursor (0,0);
lcd.print(" Sorry not Space ");
lcd.setCursor (0,1);
lcd.print(" Available ");
delay (1000);
}
}
if(digitalRead (ir_s2) == LOW && flag2==0)
{
flag2=1;
if(flag1==0)
{
myservo1.write(0);
myservo2.write(0);
Space = Space+1;
}
}
if(flag1==1 && flag2==1)
{
delay (1000);
myservo1.write(100);
myservo2.write(100);
flag1=0, flag2=0;
}
if (Space > 4){
maxcars;
Space = Total;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Total empty");
delay(2000);
}
}
If You Face Any Issue Feel Free To Contact us Any Time.