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

Arduino UNO-Based Smart Parking System with RFID and IR Sensors

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

Circuit Documentation

Summary

This circuit is designed to manage a parking system using an Arduino UNO microcontroller. The system includes RFID readers for entry and exit, IR sensors to detect parking slot occupancy, servos to control entry and exit barriers, and an LCD to display the number of available and occupied parking slots. The circuit is powered by a combination of a solar cell, 18650 batteries, and a buck converter for voltage regulation.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. Rocker Switch (SPST)

    • Description: Single Pole Single Throw switch.
    • Pins: 1, 2
  3. 16x2 I2C LCD

    • Description: 16x2 character LCD with I2C interface.
    • Pins: GND, VCC, SDA, SCL
  4. RFID-RC522

    • Description: RFID reader module.
    • Pins: VCC (3.3V), RST, GND, IRQ, MISO, MOSI, SCK, SDA
  5. Servo

    • Description: Servo motor.
    • Pins: gnd, vcc, pulse
  6. 2x 18650

    • Description: Battery pack with two 18650 batteries.
    • Pins: vcc, gnd
  7. Solar cell

    • Description: Solar cell for power generation.
    • Pins: +, -
  8. Buck converter

    • Description: DC-DC buck converter for voltage regulation.
    • Pins: IN+, IN-, OUT+, OUT-
  9. TP4056

    • Description: Lithium battery charger module.
    • Pins: OUT-, B-, B+, OUT+, IN-, IN+
  10. IR Sensor

    • Description: Infrared sensor for object detection.
    • Pins: out, gnd, vcc

Wiring Details

Arduino UNO

Rocker Switch (SPST)

16x2 I2C LCD

RFID-RC522

Servo

2x 18650

Solar cell

Buck converter

TP4056

IR Sensor

Code Documentation

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

#define SS_PIN_1 10  // Pin SDA RFID pertama
#define RST_PIN_1 9  // Pin RST RFID pertama
#define SS_PIN_2 8   // Pin SDA RFID kedua
#define RST_PIN_2 7  // Pin RST RFID kedua

MFRC522 rfid1(SS_PIN_1, RST_PIN_1);
MFRC522 rfid2(SS_PIN_2, RST_PIN_2);

LiquidCrystal_I2C lcd(0x27, 16, 2);

Servo servoMasuk;
Servo servoKeluar;

#define SERVO_MASUK_PIN 3
#define SERVO_KELUAR_PIN 4
#define IR1 A0
#define IR2 A1
#define IR3 A2

int slotParkir = 3; // Total slot parkir
int parkirKosong = slotParkir;

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid1.PCD_Init();
  rfid2.PCD_Init();

  servoMasuk.attach(SERVO_MASUK_PIN);
  servoKeluar.attach(SERVO_KELUAR_PIN);
  servoMasuk.write(0);  // Palang awal tertutup
  servoKeluar.write(0); // Palang awal tertutup

  pinMode(IR1, INPUT);
  pinMode(IR2, INPUT);
  pinMode(IR3, INPUT);

  lcd.init();
  lcd.backlight();
  updateLCD();
}

void loop() {
  // RFID 1: Akses Masuk
  if (rfid1.PICC_IsNewCardPresent() && rfid1.PICC_ReadCardSerial()) {
    Serial.println("Kartu terdeteksi di pintu masuk!");
    bukaPalangMasuk();
    delay(5000);
    tutupPalangMasuk();
    rfid1.PICC_HaltA();
  }

  // RFID 2: Akses Keluar
  if (rfid2.PICC_IsNewCardPresent() && rfid2.PICC_ReadCardSerial()) {
    Serial.println("Kartu terdeteksi di pintu keluar!");
    bukaPalangKeluar();
    delay(5000);
    tutupPalangKeluar();
    rfid2.PICC_HaltA();
  }

  // Deteksi slot parkir
  int ir1 = digitalRead(IR1);
  int ir2 = digitalRead(IR2);
  int ir3 = digital