Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO-Based Smart Parking System with IR Sensors and LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Smart Parking System with IR Sensors and LCD Display

Circuit Documentation

Summary

This circuit is designed to create a parking system using an Arduino UNO, IR sensors, a micro servo, and a 16x2 I2C LCD display. The system detects the presence of a vehicle using IR sensors and displays the number of available slots on the LCD. The micro servo is used to control a barrier that opens and closes based on the availability of parking slots.

Component List

Arduino UNO

IR Sensor

Micro Servo 9G

16x2 I2C LCD

Comment

Wiring Details

Arduino UNO

IR Sensor (Instance 1)

IR Sensor (Instance 2)

Micro Servo 9G

16x2 I2C LCD

Code Documentation

#include <LiquidCrystal_I2C.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);   
#include <Servo.h> 
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);
  }
}

This code initializes the LCD and servo, sets up the IR sensors as inputs, and controls the servo based on the sensor readings. The LCD displays messages and the number of available slots.