This shows you the differences between two versions of the page.
|
pm:prj2025:vstoica:mioara_raluca.nica [2025/05/29 03:41] mioara_raluca.nica old revision restored (2025/05/29 03:30) |
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 65: | Line 62: | ||
| ===== Software Design ===== | ===== Software Design ===== | ||
| - | 1. Development Environment | + | === Development Environment === |
| - | * **IDE**: PlatformIO in VS Code | + | * **IDE:** PlatformIO in VS Code |
| - | * **Compiler / Uploader**: `avr‑gcc` + `avrdude` (bundled with the IDE) | + | * **Tool-chain:** avr-gcc + avrdude (bundled with the IDE) |
| - | * **MCU clock**: 16 MHz (default) | + | * **MCU clock:** 16 MHz |
| - | * **Debugging**: Serial Monitor @ 9600 baud; optional logic analyzer | + | * **Debug:** Serial Monitor @ 9600 baud; optional logic-analyzer capture |
| - | ## 2. Third‑Party Libraries | + | === Libraries & Sources === |
| - | * `Wire` – I2C bus (Arduino core) | + | * Wire – I2C bus (Arduino core) |
| - | * `LiquidCrystal_PCF8574` – drives a 16×2 LCD via PCF8574 backpack | + | * LiquidCrystal_PCF8574 – 16×2 LCD via PCF8574 backpack |
| - | * `SPI` – hardware SPI for MFRC522 (Arduino core) | + | * SPI – hardware SPI for MFRC522 (Arduino core) |
| - | * `MFRC522` – high‑level API for the 13.56 MHz RFID reader *(miguelbalboa/MFRC522)* | + | * MFRC522 – 13.56 MHz RFID reader API (miguelbalboa/MFRC522) |
| - | * `Servo` – PWM control for the barrier servo motor | + | * Servo – PWM control for the barrier arm |
| - | * `avr/io.h` – direct register access (fast LED control) | + | * avr/io.h – direct register access for fast LED updates |
| - | ## 3. Architecture & Algorithms | + | === Architecture & Algorithms === |
| - | ### 3.1 Simplified State Flow | + | **State Flow** |
| - | 1. **Idle – waiting for card** LEDs show occupancy, LCD says “Scan card…”. | + | 1. Idle / Scan Card – LEDs show occupancy, LCD “Scan card…”. |
| - | 2. **Entry granted** valid UID + free spots. | + | 2. Entry Granted – valid UID and free spots. |
| - | 3. **Raise barrier (entry)** only if ultrasonic #1 sees a vehicle **and** at least 10 s have passed since the last raise. | + | 3. Raise Barrier (Entry) – ultrasonic #1 detects a vehicle and ≥ 10 s since last raise. |
| - | 4. **Count entry** after ultrasonic #2 detects the vehicle, the barrier lowers and `carsInside++`. | + | 4. Count Entry – ultrasonic #2 sees vehicle, barrier lowers, carsInside++. |
| - | 5. **Raise barrier (exit)** if there are cars inside and ultrasonic #2 sees a vehicle **and** the 10 s cooldown has expired. | + | 5. Raise Barrier (Exit) – carsInside > 0, ultrasonic #2 sees vehicle and cooldown met. |
| - | 6. **Count exit** once the vehicle clears, the barrier lowers and `carsInside--`. | + | 6. Count Exit – vehicle clears sensor, barrier lowers, carsInside--. |
| - | ### 3.2 Key Data Structures | + | **Key Data** |
| - | ```cpp | + | ```cpp |
| - | const byte authorizedUID[][4]; // whitelist of allowed UIDs | + | const byte authorizedUID[][4]; // whitelist of UIDs |
| - | int carsInside; // current occupancy counter | + | int carsInside; // vehicles inside |
| - | unsigned long lastRaiseMillis; // timestamp of the most recent raise | + | unsigned long lastRaiseMillis; // last time barrier was raised |
| - | ``` | + | ``` |
| - | ### 3.3 Timing Constants | + | **Timing Constants** |
| - | * `minRaiseInterval` = **10 000 ms** – global cooldown between raises | + | * minRaiseInterval = 10 000 ms – global cooldown between raises |
| - | * `carClearTime` = **1 500 ms** – ensure sensor field is empty before closing | + | * carClearTime = 1 500 ms – confirm sensor field is empty before lowering |
| - | ## 4. Source File & Functions | + | === Source Files & Functions === |
| - | * **`parking_barrier.ino`** | + | * **parking_barrier.ino** |
| - | • `setup()` – hardware init and “Welcome” message | + | * setup() – hardware init, “Welcome” splash |
| - | • `loop()` – full finite‑state machine for entry/exit | + | * loop() – full FSM for entry/exit |
| - | • `readDistanceCm()` – HC‑SR04 helper | + | * readDistanceCm() – HC-SR04 helper |
| - | • `isAuthorized()` – UID whitelist check | + | * isAuthorized() – UID whitelist check |
| - | • `updateLEDs()` – sets green / yellow / red LED | + | * updateLEDs() – green/orange/red status LEDs |
| - | • `showMessage()` – prints text on the LCD | + | * showMessage() – text output on LCD |
| - | ## 5. Planned Enhancements | + | === Planned Enhancements === |
| - | * Safety photocell to prevent lowering onto obstacles | + | * Safety photocell to block lowering if an obstacle is detected |
| - | * EEPROM whitelist with master card for runtime UID management | + | * EEPROM-stored whitelist with master-card admin functions |
| - | * Web dashboard (ESP8266/ESP32) with live telemetry and OTA updates | + | * Web dashboard (ESP8266/ESP32) for live telemetry and OTA updates |
| - | + | ||
| - | <note tip> | + | |
| - | Descrierea codului aplicaţiei (firmware): | + | |
| - | * mediu de dezvoltare (if any) (e.g. AVR Studio, CodeVisionAVR) | + | |
| - | * librării şi surse 3rd-party (e.g. Procyon AVRlib) | + | |
| - | * algoritmi şi structuri pe care plănuiţi să le implementaţi | + | |
| - | * (etapa 3) surse şi funcţii implementate | + | |
| - | </note> | + | |
| ===== 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> | ||