Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO Based Automated Parking System with IR Sensors and Servo Controlled Gate

Image of Arduino UNO Based Automated Parking System with IR Sensors and Servo Controlled Gate

Circuit Documentation

Summary

The circuit in question is designed to create an Arduino-based parking system. It utilizes an Arduino UNO as the central processing unit, two IR sensors to detect the presence of a vehicle, a micro servo motor to control a barrier or gate, and a 16x2 I2C LCD display to provide user feedback regarding parking availability. The system operates by detecting vehicles with the IR sensors and then updating the available parking slots count displayed on the LCD. The servo motor is used to control access based on the parking availability.

Component List

Arduino UNO

  • Description: A microcontroller board based on the ATmega328P.
  • Purpose: Acts as the central processing unit for the parking system, reading sensor inputs, controlling the servo motor, and updating the display.

IR Sensor (2x)

  • Description: Infrared sensors used for object detection.
  • Purpose: To detect the presence of a vehicle at the parking entrance and exit.

Micro Servo 9G

  • Description: A small and lightweight servo motor.
  • Purpose: To actuate a barrier or gate that controls access to the parking area.

16x2 I2C LCD

  • Description: A liquid crystal display with an I2C interface.
  • Purpose: To display the number of available parking slots and other messages to the user.

Wiring Details

Arduino UNO

  • 5V: Powers the 16x2 I2C LCD, both IR sensors, and the Micro servo 9G.
  • GND: Common ground for the 16x2 I2C LCD, both IR sensors, and the Micro servo 9G.
  • D3: Connected to the output of one IR sensor.
  • D2: Connected to the output of the other IR sensor.
  • A4 (SDA): Connected to the SDA pin of the 16x2 I2C LCD for data communication.
  • A5 (SCL): Connected to the SCL pin of the 16x2 I2C LCD for clock signal.
  • D4: Connected to the PWM input of the Micro servo 9G for control signals.

IR Sensor

  • VCC: Connected to the 5V output from the Arduino UNO.
  • GND: Connected to the ground on the Arduino UNO.
  • OUT: One sensor's output is connected to D3 on the Arduino UNO, and the other sensor's output is connected to D2.

Micro Servo 9G

  • +5V: Connected to the 5V output from the Arduino UNO.
  • GND: Connected to the ground on the Arduino UNO.
  • PWM: Connected to D4 on the Arduino UNO for control signals.

16x2 I2C LCD

  • VCC: Connected to the 5V output from the Arduino UNO.
  • GND: Connected to the ground on the Arduino UNO.
  • SDA: Connected to A4 on the Arduino UNO for data communication.
  • SCL: Connected to A5 on the Arduino UNO for clock signal.

Documented Code

#include <LiquidCrystal_I2C.h>
#include <Wire.h> 
#include <Servo.h> 

LiquidCrystal_I2C lcd(0x27,16,2);   
Servo myservo;

int IR1 = 2;
int IR2 = 3;
int Slot = 4;           
int flag1 = 0;
int flag2 = 0;

void setup() {
  Serial.begin(9600); 
  lcd.init(); 
  lcd.backlight(); 
  pinMode(IR1, INPUT); 
  pinMode(IR2, INPUT);
  myservo.attach(4);
  myservo.write(100);
  lcd.setCursor (0,0);
  lcd.print("     ARDUINO    ");
  lcd.setCursor (0,1);
  lcd.print(" PARKING SYSTEM ");
  delay (2000);
  lcd.clear();  
}

void loop(){ 
  if(digitalRead (IR1) == LOW && flag1==0){
    if(Slot>0){
      flag1=1;
      if(flag2==0){
        myservo.write(0); 
        Slot = Slot-1;
      }
    }
    else{
      lcd.setCursor (0,0);
      lcd.print("    SORRY :(    ");  
      lcd.setCursor (0,1);
      lcd.print("  Parking Full  "); 
      delay (3000);
      lcd.clear(); 
    }
    if(digitalRead (IR2) == LOW && flag2==0){
      flag2=1;
      if(flag1==0){
        myservo.write(0); 
        Slot = Slot+1;
      }
    }
    if(flag1==1 && flag2==1){
      delay (1000);
      myservo.write(100);
      flag1=0, flag2=0;
    }

    lcd.setCursor (0,0);
    lcd.print("    WELCOME!    ");
    lcd.setCursor (0,1);
    lcd.print("Slot Left: ");
    lcd.print(Slot);
  }
}

Filename: sketch.ino

Description: This code is designed to run on an Arduino UNO and manages the parking system's logic. It initializes the LCD and servo, reads the IR sensors to detect vehicle presence, updates the available slots, and controls the servo to allow or deny access to the parking area. The LCD displays a welcome message and the number of slots left, or a message indicating that the parking is full.