This shows you the differences between two versions of the page.
|
pm:prj2025:vstoica:mioara_raluca.nica [2025/05/29 03:38] mioara_raluca.nica [Software Design] |
pm:prj2025:vstoica:mioara_raluca.nica [2025/05/30 03:09] (current) mioara_raluca.nica [Rezultate Obţinute] |
||
|---|---|---|---|
| Line 29: | Line 29: | ||
| - Orange → almost full | - Orange → almost full | ||
| - Red → full | - Red → full | ||
| - | * **Push Button** (Override) Connected via interrupt, allows manual barrier control in emergency situations or system fallback. | ||
| === Software Flow & Interactions === | === Software Flow & Interactions === | ||
| Line 43: | Line 42: | ||
| * Red LED turns on. | * Red LED turns on. | ||
| * After car enters, sensor 2 updates spot count. | * After car enters, sensor 2 updates spot count. | ||
| - | * Push button can trigger barrier manually, handled via interrupt. | ||
| ===== Hardware Design ===== | ===== Hardware Design ===== | ||
| {{:pm:prj2025:vstoica:circuit_rn.jpeg?600|}} | {{:pm:prj2025:vstoica:circuit_rn.jpeg?600|}} | ||
| Line 57: | Line 55: | ||
| | **Red LED** | 1 | Anode→A1 (via 220 Ω), Cathode→GND | “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 | | | **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 | | | **Breadboard** | 1 | – | Prototyping / common power rails | | ||
| | **Jumper Wires** | ~20 | – | Signal and power connections | | | **Jumper Wires** | ~20 | – | Signal and power connections | | ||
| Line 64: | Line 61: | ||
| ===== Software Design ===== | ===== Software Design ===== | ||
| - | > **MCU țintă:** ATmega328P (Arduino Uno/Nano) | ||
| - | > **Fișier principal:** `parking_barrier.ino` | ||
| - | ## 1. Mediu de dezvoltare | + | === Development Environment === |
| - | - PlatformIO in VS Code | + | * **IDE:** PlatformIO in VS Code |
| - | - Compilator / uploader: `avr‑gcc` + `avrdude` (vin cu IDE‑ul) | + | * **Tool-chain:** avr-gcc + avrdude (bundled with the IDE) |
| - | - Frecventa ceas MCU: 16 MHz (default) | + | * **MCU clock:** 16 MHz |
| - | - Debug: Serial Monitor @ 9600 baud; | + | * **Debug:** Serial Monitor @ 9600 baud; optional logic-analyzer capture |
| - | ## 2. Librarii third‑party folosite | + | === Libraries & Sources === |
| - | - Wire – magistrala I2C (biblioteca Arduino core) | + | * Wire – I2C bus (Arduino core) |
| - | - LiquidCrystal_PCF8574 – control 16×2 LCD | + | * LiquidCrystal_PCF8574 – 16×2 LCD via PCF8574 backpack |
| - | - SPI – interfata hardware pentru MFRC522 | + | * SPI – hardware SPI for MFRC522 (Arduino core) |
| - | - MFRC522 – API cititor RFID 13.56 MHz (miguelbalboa/MFRC522) | + | * MFRC522 – 13.56 MHz RFID reader API (miguelbalboa/MFRC522) |
| - | - Servo – PWM pentru servomotorul barierei | + | * Servo – PWM control for the barrier arm |
| - | - avr/io.h – acces direct la registre (control LED‑uri) | + | * avr/io.h – direct register access for fast LED updates |
| - | ## 3. Arhitectura & algoritmi | + | === Architecture & Algorithms === |
| - | ### 3.1 Flux de stare (simplificat) | + | **State Flow** |
| - | 1. **Idle • Așteaptă card** – LED‑uri indică ocupare, LCD „Scan card…”. | + | 1. Idle / Scan Card – LEDs show occupancy, LCD “Scan card…”. |
| - | 2. **Intrare permisă** – carte UID valid + locuri libere. | + | 2. Entry Granted – valid UID and free spots. |
| - | 3. **Ridică bariera (intrare)** – numai dacă senzor #1 detectează mașină **și** au trecut ≥10 s de la ultima ridicare. | + | 3. Raise Barrier (Entry) – ultrasonic #1 detects a vehicle and ≥ 10 s since last raise. |
| - | 4. **Contorizează intrare** – când senzor #2 vede vehiculul, bariera coboară, `carsInside++`. | + | 4. Count Entry – ultrasonic #2 sees vehicle, barrier lowers, carsInside++. |
| - | 5. **Ridică bariera (ieșire)** – dacă există mașini înăuntru, senzor #2 detectează vehicul **și** cooldown 10 s îndeplinit. | + | 5. Raise Barrier (Exit) – carsInside > 0, ultrasonic #2 sees vehicle and cooldown met. |
| - | 6. **Contorizează ieșire** – după plecare, bariera coboară, `carsInside--`. | + | 6. Count Exit – vehicle clears sensor, barrier lowers, carsInside--. |
| - | ### 3.2 Structuri de date cheie | + | **Key Data** |
| - | ```cpp | + | ```cpp |
| - | const byte authorizedUID[][4]; // listă UIDs permise | + | const byte authorizedUID[][4]; // whitelist of UIDs |
| - | int carsInside; // vehicule în parcare | + | int carsInside; // vehicles inside |
| - | unsigned long lastRaiseMillis; // momentul ultimei ridicări | + | unsigned long lastRaiseMillis; // last time barrier was raised |
| - | ``` | + | ``` |
| - | ### 3.3 Timpi importanți | + | **Timing Constants** |
| - | - `minRaiseInterval` = **10 000 ms** – cooldown global barieră | + | * minRaiseInterval = 10 000 ms – global cooldown between raises |
| - | - `carClearTime` = **1 500 ms** – confirmă că senzorul nu mai vede mașina | + | * carClearTime = 1 500 ms – confirm sensor field is empty before lowering |
| - | ## 4. Fișiere & funcții | + | === Source Files & Functions === |
| - | - **`parking_barrier.ino`** | + | * **parking_barrier.ino** |
| - | • `setup()` – inițializări hardware și mesaj „Welcome” | + | * setup() – hardware init, “Welcome” splash |
| - | • `loop()` – FSM complet intrare/ieșire | + | * loop() – full FSM for entry/exit |
| - | • `readDistanceCm()` – rutină HC‑SR04 | + | * readDistanceCm() – HC-SR04 helper |
| - | • `isAuthorized()` – verifică UID‑ul | + | * isAuthorized() – UID whitelist check |
| - | • `updateLEDs()` – LED verde / galben / roșu | + | * updateLEDs() – green/orange/red status LEDs |
| - | • `showMessage()` – afișează text pe LCD | + | * showMessage() – text output on LCD |
| - | ## 5. Îmbunătățiri planificate | + | === Planned Enhancements === |
| - | - Fotocelulă de siguranță înainte de coborârea brațului | + | * Safety photocell to block lowering if an obstacle is detected |
| - | - Whitelist în EEPROM + card master pentru adăugare UID‑uri | + | * EEPROM-stored whitelist with master-card admin functions |
| - | - Dashboard web (ESP8266/ESP32) cu telemetrie și OTA | + | * Web dashboard (ESP8266/ESP32) for live telemetry and OTA updates |
| ===== Rezultate Obţinute ===== | ===== Rezultate Obţinute ===== | ||
| - | <note tip> | + | Code: |
| - | Care au fost rezultatele obţinute în urma realizării proiectului vostru. | + | https://github.com/Raluca1304/Automatic_parking_gate.git |
| - | </note> | + | |
| + | |||
| + | Demo: | ||
| + | https://youtube.com/shorts/BB8ATAf_ZLA?feature=share | ||
| + | |||
| + | {{:pm:prj2025:vstoica:imagine_13.jpeg?200|}} | ||
| + | |||
| + | |||
| + | ===== Conclusions ===== | ||
| + | |||
| + | The **Automatic Parking Gate** prototype successfully met its main goals: RFID-based access control, real-time spot counting with ultrasonic sensors, and safe barrier actuation via a servo—all accompanied by clear LCD messages and status LEDs. Bench-top and live tests showed: | ||
| + | |||
| + | * **Reliability** – The barrier opened only for authorised cards and never allowed occupancy to exceed capacity in all test scenarios. | ||
| + | |||
| + | * **Response time** – The arm rises in under 1 s after a valid scan and lowers about 800 ms after the vehicle clears the exit sensor. | ||
| + | |||
| + | * **User feedback** – LCD prompts and the green / yellow / red LED scheme gave immediate, intuitive information. | ||
| + | |||
| + | On the learning side, the project reinforced skills in: | ||
| + | |||
| + | * SPI and I2C communication on Arduino hardware; | ||
| + | |||
| + | * designing a clean finite-state machine; | ||
| + | |||
| + | * integrating multiple hardware modules into a cohesive system. | ||
| + | |||
| + | ** Observed limitations | ||
| + | ** | ||
| + | * Ultrasonic sensors can mis-trigger in heavy rain or on very angled surfaces. | ||
| + | |||
| + | * The whitelist of cards is hard-coded—any change requires reflashing. | ||
| + | |||
| + | * There is no dedicated safety sensor to halt the arm while it is lowering. | ||
| + | |||
| + | ** Future improvements** | ||
| + | |||
| + | 1. Add an IR **safety photocell** to stop the barrier if something crosses underneath. | ||
| + | |||
| + | 2. Store the whitelist in **EEPROM** and use a master card for live admin tasks. | ||
| + | |||
| + | 3. Attach a Wi-Fi module (ESP8266/ESP32) for a web dashboard, live telemetry and OTA firmware updates. | ||
| + | |||
| + | 4. Enclose the electronics in a 3-D-printed, weather-proof housing and provide rugged power filtering. | ||
| + | |||
| + | Implementing these upgrades would move the prototype closer to a deployable, real-world parking solution—enhancing safety, flexibility and ease of maintenance. | ||
| - | ===== Concluzii ===== | ||
| ===== Download ===== | ===== Download ===== | ||
| + | {{:pm:prj2025:vstoica:automatic_parking_gate-master.zip|}} | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== Bibliography / Resources ===== | ||
| + | |||
| + | === Software Resources === | ||
| + | * **Arduino Core Documentation** – “Language Reference” and “Core Libraries” (arduino.cc) | ||
| + | |||
| + | * **MFRC522 Library** – GitHub repository *miguelbalboa/MFRC522*, release v1.4.11 | ||
| + | README and example sketches for SPI RFID communication | ||
| + | | ||
| + | * **LiquidCrystal_PCF8574 Library** – GitHub repository *mathertel/LiquidCrystal_PCF8574*, release v1.3.x I2C backpack usage and custom character guide | ||
| + | | ||
| + | * **PlatformIO Documentation** – “Getting Started with AVR/Arduino” and “Library Dependency Finder” | ||
| + | |||
| + | * **AVR Libc Manual** – chapter on direct register access (`avr/io.h`) | ||
| + | |||
| + | * **Timer-1 Fast-PWM Tutorial** – Nick Gammon’s blog post on generating 50 Hz servo signals | ||
| + | |||
| + | * **Microchip ATmega328P Datasheet** – section on timers/counters and SPI/I²C peripherals | ||
| - | <note warning> | + | === Hardware Resources === |
| - | 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ă ;-). | + | * **MFRC522 RFID Reader Module Datasheet** – NXP PN532/RC522 reference, timing diagrams |
| - | 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**. | + | * **HC-SR04 Ultrasonic Sensor Datasheet** – voltage levels, echo timing relationship |
| - | </note> | + | |
| - | ===== Jurnal ===== | + | * **SG90 / TowerPro Micro Servo Datasheet** – pulse-width vs. angle chart, stall torque specs |
| - | <note tip> | + | * **16×2 Character LCD (HD44780) Datasheet** – command set, timing, busy-flag notes |
| - | Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului. | + | |
| - | </note> | + | |
| - | ===== Bibliografie/Resurse ===== | + | * **PCF8574 I/O Expander Datasheet** – I2C address map, drive current limits |
| - | <note> | + | * **ESP328P Module Datasheet** – pinout, flash modes, Wi-Fi radio parameters |
| - | 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> | <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | ||