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

Arduino UNO Based Smart Parking System with RFID Access and GSM Notifications

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Smart Parking System with RFID Access and GSM Notifications

Circuit Documentation

Summary

This circuit is designed to manage a parking system with an RFID access control, SMS notifications, and visual indicators for parking availability. It includes an Arduino UNO microcontroller interfaced with various sensors and modules, such as IR sensors for parking spot detection, an RFID-RC522 module for access control, a GSM module for SMS communication, an LCD screen for displaying parking availability, a buzzer for audible alerts, a relay for gate control, and LEDs to indicate parking status.

Component List

Wiring Details

Buzzer Module

LED (Red)

LED (Green)

5V Adapter

Sim800l

LCD screen 16x2 I2C

Arduino UNO

RFID-RC522

1-Channel Relay (5V 10A)

IR Sensors

Documented Code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SPI.h>
#include <MFRC522.h>
#include <SoftwareSerial.h>

#define SS_PIN 10
#define RST_PIN 9
MFRC522 rfid(SS_PIN, RST_PIN);  // Create RFID instance

SoftwareSerial GSM(2, 3); // GSM TX -> D2, GSM RX -> D3

LiquidCrystal_I2C lcd(0x27, 16, 2);  // LCD instance (I2C address is 0x27)

int relayPin = 7;  // Relay control pin
int greenLED = 4;  // Green LED for available parking
int redLED = 5;    // Red LED for parking full
int buzzerPin = 6; // Buzzer for alert

int irSensor1 = A0; // IR Sensor 1 for parking spot 1
int irSensor2 = A1; // IR Sensor 2 for parking spot 2
int irSensor3 = A2; // IR Sensor 3 for parking spot 3
int irSensor4 = A3; // IR Sensor 4 for parking spot 4

int slotAvailable = 4;  // Initial number of available slots
int threshold = 200;  // Threshold value to determine IR sensor detection

void setup() {
  pinMode(relayPin, OUTPUT);
  pinMode(greenLED, OUTPUT);
  pinMode(redLED, OUTPUT);
  pinMode(buzzerPin, OUTPUT);

  // Set IR sensors as input
  pinMode(irSensor1, INPUT);
  pinMode(irSensor2, INPUT);
  pinMode(irSensor3, INPUT);
  pinMode(irSensor4, INPUT);

  digitalWrite(relayPin, LOW);  // Keep relay off initially (parking gate closed)
  digitalWrite(greenLED, HIGH); // Parking is available initially
  digitalWrite(redLED, LOW);    // Red LED off (parking not full)

  lcd.init();  // Initialize LCD
  lcd.backlight();  // Turn on LCD backlight
  lcd.setCursor(0, 0);
  lcd.print("Slot Available:");
  lcd.setCursor(0, 1);
  lcd.print(slotAvailable);

  SPI.begin();  // Initialize SPI bus for RFID reader
  rfid.PCD_Init();

  GSM.begin(9600);  // Start GSM communication
  Serial.begin(9600);  // Start Serial for debugging
}

void loop() {
  // Check if any parking spot is occupied
  checkIRSensors();

  // Check for RFID card presence
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) {
    return;
  }

  // Assuming every scanned RFID is valid for this example
  if (slotAvailable > 0) {
    slotAvailable--;  // Decrease available slot count

    // If there are available slots, open the gate and alert
    digitalWrite(relayPin, HIGH);  // Open the parking gate
    digitalWrite(buzzerPin, HIGH); // Sound buzzer
    delay(1000);
    digitalWrite(buzzerPin, LOW);  // Turn off buzzer after 1 second
    delay(5000);  // Keep gate open for 5 seconds
    digitalWrite(relayPin, LOW);  // Close the gate

    // Update LCD with available slots
    lcd.setCursor(0, 0);
    lcd.print("Slot Available: ");
    lcd.setCursor(0, 1);
    lcd.print(slotAvailable);

    // Send SMS notification when parking slot is occupied
    sendSMS(slotAvailable);
  }

  rfid.PICC_HaltA();  // Stop reading RFID card
}

// Function to check the IR sensors for occupied parking spots
void checkIRSensors() {
  int ir1 = analogRead(irSensor1);
  int ir2 = analogRead(irSensor2);
  int ir3 = analogRead(irSensor3);
  int ir4 = analogRead(irSensor4);

  if (ir1 < threshold || ir2 < threshold || ir3 < threshold || ir4 < threshold) {
    digitalWrite(greenLED, HIGH);  // If any slot is available, turn on green LED
    digitalWrite(redLED, LOW);     // Parking is not full, turn off red LED
  } else {
    digitalWrite(greenLED, LOW);   // If no slots available, turn off green LED
    digitalWrite(redLED, HIGH);    // Parking full, turn on red LED
    lcd.setCursor(0, 0);
    lcd.print("Parking Full!   ");
    lcd.setCursor(0, 1);
    lcd.print("No Slots        ");
  }
}

// Function to send SMS using GSM module
void sendSMS(int availableSlots) {
  GSM.print("AT+CMGF=1\r");  // Set SMS mode to text
  delay(1000);
  GSM.print("AT+CMGS=\"+1234567890\"\r");  // Replace with your phone number
  delay(1000);
  GSM.print