This is an old revision of the document!


Automatic parking gate

Nica Mioara Raluca - 334CA

Introduction

Project Summary

The Automatic Parking Gate project simulates a real-world automated parking system with controlled access. It allows vehicles to enter only if they have valid authorization (via an RFID card) and only if parking spots are available. The system uses a servo motor to raise and lower a barrier, ultrasonic sensors to detect vehicle presence, an LCD to display the number of available spots, and colored LEDs to indicate the status of the parking lot.

The purpose of this project is to develop a smart access control system for parking areas, using multiple electronic modules and key concepts learned during laboratory sessions—such as RFID communication, PWM control, sensors, LCD interfacing, and interrupt handling. The goal is to build a functional and interactive prototype that simulates a secure and efficient real-life parking gate.

The idea for the project came from the observation that managing parking lots in crowded urban areas is increasingly difficult without automation. Many institutions and residential areas already use automated gates with card access and visual status indicators. This project aims to replicate such a system at a smaller scale, making use of accessible hardware and the skills acquired in class.

This project is useful as it demonstrates a practical implementation of several microcontroller-based technologies in a single integrated system. For us, it provided valuable experience in system design, hardware-software integration, and real-world problem solving. For others, it can serve as a learning resource or as a base for further development of smart parking or access control systems. It is educational, expandable, and applicable to real-life needs.

General Description

The Automatic Parking Gate project is a smart system that manages the entry of vehicles into a parking area based on access authorization (via RFID) and space availability (detected by ultrasonic sensors). The system integrates both hardware and software components that interact with each other in a coordinated manner, managed by the Arduino UNO microcontroller.

Below is the block diagram of the system, showing all modules involved:

Hardware Modules

  • Arduino UNO Acts as the central controller, processing data from sensors and sending commands to output devices.
  • RFID Module (RC522) Reads the UID of the scanned card via SPI. The Arduino compares this UID to a list of authorized IDs.
  • Ultrasonic Sensors (x2) Detect vehicle presence at the entrance (sensor 1) and exit (sensor 2). This helps update the count of available parking spots.
  • Servo Motor Controls the parking barrier, raising it if access is granted and lowering it after the car has passed.
  • LCD 16×2 with I2C Module Displays dynamic information such as the number of available spots or access denied messages.
  • LEDs (green, orange, red) Provide quick visual feedback:
    1. Green → available
    2. Orange → almost full
    3. Red → full
  • Push Button (Override) Connected via interrupt, allows manual barrier control in emergency situations or system fallback.

Software Flow & Interactions

  • The RFID module reads the card → Arduino checks if UID is authorized.
  • If valid, ultrasonic sensor 1 checks if a car is present.
  • If a vehicle is detected and parking space is available:
    • Servo motor raises the barrier.
    • LCD shows: “Access Granted | Free spots: X”.
    • Green LED turns on.
  • If the parking is full or card is unauthorized:
    • Barrier stays closed.
    • LCD displays appropriate message.
    • Red LED turns on.
  • After car enters, sensor 2 updates spot count.
  • Push button can trigger barrier manually, handled via interrupt.

Hardware Design

Component Quantity Arduino Pin Connections Description / Role
Arduino Uno 1 Microcontroller central unit
RFID-RC522 1 VCC→3.3 V, GND→GND, SDA(SS)→D10, SCK→D13, MOSI→D11, MISO→D12, RST→D8 Reads card UID via SPI
HC-SR04 Ultrasonic Sensor 2 Sensor 1: VCC→5 V, GND→GND, Trig→D2, Echo→D4<br>Sensor 2: VCC→5 V, GND→GND, Trig→D5, Echo→D6 Detects vehicle presence (entrance/exit)
SG90 Servo Motor 1 VCC→5 V, GND→GND, Signal→D9 Raises/lowers the parking barrier
16×2 LCD w/ I²C Backpack 1 VCC→5 V, GND→GND, SDA→A4, SCL→A5 Displays spot count and status messages
Green LED 1 Anode→D7 (via 220 Ω), Cathode→GND “Available spots” indicator
Orange LED 1 Anode→A0 (via 220 Ω), Cathode→GND “Almost full” indicator
Red LED 1 Anode→A1 (via 220 Ω), Cathode→GND “Full” indicator
220 Ω Resistors 3 In series with each LED Current limiting for LEDs
Push-Button (Override) 1 One side→D3 (INPUT_PULLUP), other side→GND Manual barrier control (interrupt on D3)
Breadboard 1 Prototyping / common power rails
Jumper Wires ~20 Signal and power connections

Software Design

MCU țintă: ATmega328P (Arduino Uno/Nano)
Fișier principal: `parking_barrier.ino`

## 1. Mediu de dezvoltare - PlatformIO in VS Code - Compilator / uploader: `avr‑gcc` + `avrdude` (vin cu IDE‑ul) - Frecventa ceas MCU: 16 MHz (default) - Debug: Serial Monitor @ 9600 baud;

## 2. Librarii third‑party folosite - Wire – magistrala I2C (biblioteca Arduino core) - LiquidCrystal_PCF8574 – control 16×2 LCD - SPI – interfata hardware pentru MFRC522 - MFRC522 – API cititor RFID 13.56 MHz (miguelbalboa/MFRC522) - Servo – PWM pentru servomotorul barierei - avr/io.h – acces direct la registre (control LED‑uri)

## 3. Arhitectura & algoritmi ### 3.1 Flux de stare (simplificat) 1. Idle • Așteaptă card – LED‑uri indică ocupare, LCD „Scan card…”. 2. Intrare permisă – carte UID valid + locuri libere. 3. Ridică bariera (intrare) – numai dacă senzor #1 detectează mașină și au trecut ≥10 s de la ultima ridicare. 4. Contorizează intrare – când senzor #2 vede vehiculul, bariera coboară, `carsInside++`. 5. Ridică bariera (ieșire) – dacă există mașini înăuntru, senzor #2 detectează vehicul și cooldown 10 s îndeplinit. 6. Contorizează ieșire – după plecare, bariera coboară, `carsInside–`.

### 3.2 Structuri de date cheie ```cpp const byte authorizedUID[][4]; listă UIDs permise int carsInside; vehicule în parcare unsigned long lastRaiseMillis; momentul ultimei ridicări ``` ### 3.3 Timpi importanți - `minRaiseInterval` = 10 000 ms – cooldown global barieră - `carClearTime` = 1 500 ms – confirmă că senzorul nu mai vede mașina ## 4. Fișiere & funcții - `parking_barrier.ino` • `setup()` – inițializări hardware și mesaj „Welcome” • `loop()` – FSM complet intrare/ieșire • `readDistanceCm()` – rutină HC‑SR04 • `isAuthorized()` – verifică UID‑ul • `updateLEDs()` – LED verde / galben / roșu • `showMessage()` – afișează text pe LCD ## 5. Îmbunătățiri planificate - Fotocelulă de siguranță înainte de coborârea brațului - Whitelist în EEPROM + card master pentru adăugare UID‑uri - Dashboard web (ESP8266/ESP32) cu telemetrie și OTA ===== Rezultate Obţinute ===== <note tip> Care au fost rezultatele obţinute în urma realizării proiectului vostru. </note> ===== Concluzii ===== ===== Download ===== <note warning> O arhivă (sau mai multe dacă este cazul) cu fişierele obţinute în urma realizării proiectului: surse, scheme, etc. Un fişier README, un ChangeLog, un script de compilare şi copiere automată pe uC crează întotdeauna o impresie bună ;-). Fişierele se încarcă pe wiki folosind facilitatea Add Images or other files. Namespace-ul în care se încarcă fişierele este de tipul :pm:prj20??:c? sau :pm:prj20??:c?:nume_student (dacă este cazul). Exemplu: Dumitru Alin, 331CC → :pm:prj2009:cc:dumitru_alin. </note> ===== Jurnal ===== <note tip> Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului. </note> ===== Bibliografie/Resurse ===== <note> Listă cu documente, datasheet-uri, resurse Internet folosite, eventual grupate pe Resurse Software şi Resurse Hardware. </note> <html><a class=“media mediafile mf_pdf” href=”?do=export_pdf”>Export to PDF</a></html>

pm/prj2025/vstoica/mioara_raluca.nica.1748479092.txt.gz · Last modified: 2025/05/29 03:38 by mioara_raluca.nica
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0