This shows you the differences between two versions of the page.
|
pm:prj2026:bianca.popa1106:andreea.peiu [2026/05/09 20:41] andreea.peiu [Github Repository] |
pm:prj2026:bianca.popa1106:andreea.peiu [2026/05/25 13:17] (current) andreea.peiu [Github Repository] |
||
|---|---|---|---|
| Line 161: | Line 161: | ||
| | Jumper Wires / Connectors | Electrical connections | ~20 | | | Jumper Wires / Connectors | Electrical connections | ~20 | | ||
| | Resistors | Current limiting and pull-up resistors | Multiple | | | Resistors | Current limiting and pull-up resistors | Multiple | | ||
| - | ===== Software Design ===== | ||
| - | ==== Development Environment ==== | + | ====== Software Design ====== |
| + | |||
| + | ===== Development Environment ===== | ||
| + | |||
| + | The firmware was developed using: | ||
| * Arduino IDE | * Arduino IDE | ||
| - | * Language: C/C++ | + | * Programming Language: C/C++ |
| - | * Platform: Arduino Uno | + | * Target Platform: Arduino Nano (ATmega328P) |
| + | |||
| + | The software architecture is based on a finite state machine (FSM) implementation that manages all transitions between authentication, barrier control, and user detection states. | ||
| + | |||
| + | ===== External Libraries Used ===== | ||
| + | |||
| + | The following third-party libraries were integrated into the project firmware: | ||
| + | |||
| + | ^ Library ^ Purpose ^ | ||
| + | | Wire.h | I2C communication support | | ||
| + | | LiquidCrystal_I2C.h | LCD 16×2 display control | | ||
| + | | Keypad.h | 4×4 keypad scanning and input processing | | ||
| + | | Servo.h | Servo motor PWM control | | ||
| + | |||
| + | These libraries simplify peripheral integration and allow modular firmware development. | ||
| + | |||
| + | ===== Software Architecture ===== | ||
| + | |||
| + | The application firmware is divided into multiple logical modules responsible for different hardware subsystems and control mechanisms. | ||
| + | |||
| + | ===== Finite State Machine (FSM) ===== | ||
| + | |||
| + | The entire system behavior is controlled using a finite state machine. | ||
| + | |||
| + | Implemented states: | ||
| + | |||
| + | ^ State ^ Description ^ | ||
| + | | ST_IDLE | Waiting for user detection | | ||
| + | | WAIT_FOR_CONFIRM | User PIN input state | | ||
| + | | OPENING | Barrier opening and conveyor activation | | ||
| + | | WAIT_FOR_PASS | Waiting for user passage | | ||
| + | | CLOSING | Barrier closing and conveyor stop | | ||
| + | | EROARE | Error and timeout handling | | ||
| + | |||
| + | The FSM implementation provides: | ||
| + | * modular control flow; | ||
| + | * predictable state transitions; | ||
| + | * easier debugging and testing; | ||
| + | * scalable architecture for future extensions. | ||
| + | |||
| + | ===== Authentication Module ===== | ||
| + | |||
| + | The authentication subsystem is responsible for: | ||
| + | * keypad scanning; | ||
| + | * PIN storage; | ||
| + | * PIN validation; | ||
| + | * timeout protection. | ||
| + | |||
| + | Main features: | ||
| + | * supports numeric PIN entry; | ||
| + | * supports character deletion using '*'; | ||
| + | * PIN confirmation using '#'; | ||
| + | * automatic timeout reset after inactivity. | ||
| + | |||
| + | The authentication logic compares the entered PIN with a predefined secret code stored in firmware. | ||
| + | |||
| + | ===== Sensor Monitoring Module ===== | ||
| + | |||
| + | Two IR proximity sensors are continuously monitored: | ||
| + | |||
| + | ^ Sensor ^ Purpose ^ | ||
| + | | Front IR Sensor | Detects user arrival | | ||
| + | | Rear IR Sensor | Detects successful passage | | ||
| + | |||
| + | The sensors are read using analog inputs and calibrated automatically during system startup. | ||
| + | |||
| + | Calibration process: | ||
| + | * the firmware samples sensor values multiple times; | ||
| + | * computes average environmental baseline; | ||
| + | * dynamically generates detection thresholds. | ||
| + | |||
| + | This improves detection reliability and reduces false triggering. | ||
| + | |||
| + | ===== Barrier Control Module ===== | ||
| + | |||
| + | The physical barrier is controlled using an SG90 servo motor. | ||
| + | |||
| + | The firmware implements: | ||
| + | * smooth opening movement; | ||
| + | * smooth closing movement; | ||
| + | * gradual angle transitions using incremental PWM updates. | ||
| + | |||
| + | Servo positions: | ||
| + | * 0° → barrier closed; | ||
| + | * 90° → barrier opened. | ||
| + | |||
| + | Movement timing is controlled through software delays to obtain smooth mechanical motion. | ||
| + | |||
| + | ===== Conveyor Belt Control Module ===== | ||
| + | |||
| + | The conveyor mechanism is controlled through an H-Bridge driver. | ||
| + | |||
| + | Implemented operations: | ||
| + | * conveyor start; | ||
| + | * conveyor stop; | ||
| + | * motor direction control. | ||
| + | |||
| + | The conveyor starts only after successful authentication and stops automatically after user passage confirmation. | ||
| + | |||
| + | ===== LCD Feedback System ===== | ||
| + | |||
| + | A 16×2 I2C LCD module is used to provide real-time user feedback. | ||
| - | ==== External Libraries Used ==== | + | Displayed messages include: |
| + | * system initialization; | ||
| + | * PIN request; | ||
| + | * access granted; | ||
| + | * access denied; | ||
| + | * timeout warnings; | ||
| + | * error states; | ||
| + | * conveyor and barrier status. | ||
| - | * Servo.h | + | The LCD interface improves usability and debugging visibility. |
| - | * Keypad.h | + | |
| - | * LiquidCrystal_I2C.h | + | |
| - | * Wire.h | + | |
| - | ==== Code Components ==== | + | ===== LED Signaling System ===== |
| - | The software is divided into several logical modules: | + | Two LEDs are used for visual feedback: |
| - | === State Machine Logic === | + | ^ LED ^ Meaning ^ |
| + | | Green LED | Access granted / active system | | ||
| + | | Red LED | Access denied / error state | | ||
| - | Handles all transitions between system states: | + | Implemented behavior: |
| - | * IDLE | + | * both LEDs active in standby mode; |
| - | * WAIT_FOR_CONFIRM | + | * both LEDs off during authentication; |
| - | * OPENING | + | * green LED active after successful authentication; |
| - | * WAIT_FOR_PASS | + | * red LED active after invalid PIN; |
| - | * CLOSING | + | * red LED blinking during error state. |
| - | * ERROR | + | |
| - | === Authentication Module === | + | ===== Timing and Timeout Management ===== |
| - | * Reads keypad input | + | The firmware uses non-blocking timing based on the millis() function. |
| - | * Stores typed digits | + | |
| - | * Validates entered PIN | + | |
| - | * Handles timeout conditions | + | |
| - | === Barrier Control Module === | + | Implemented protections: |
| + | * PIN input timeout; | ||
| + | * passage timeout; | ||
| + | * automatic recovery after inactivity. | ||
| - | * Controls servo position using PWM | + | Advantages: |
| - | * Opens and closes the barrier | + | * responsive behavior; |
| - | * Ensures smooth transitions | + | * reduced blocking delays; |
| + | * stable event processing. | ||
| - | === Sensor Monitoring Module === | + | ===== Implemented Functions ===== |
| - | * Continuously checks both proximity sensors | + | ==== State Management ==== |
| - | * Detects user arrival and passage | + | |
| - | * Triggers FSM state transitions | + | |
| - | === LCD Feedback System === | + | ^ Function ^ Purpose ^ |
| + | | tranzitie() | Handles FSM transitions | | ||
| - | Displays: | + | ==== Sensor Functions ==== |
| - | * current state | + | |
| - | * authentication messages | + | |
| - | * error messages | + | |
| - | * timeout notifications | + | |
| - | === Audio & Visual Feedback === | + | ^ Function ^ Purpose ^ |
| + | | irFata() | Detects approaching user | | ||
| + | | irSpate() | Detects completed passage | | ||
| - | * Green LED → access granted | + | ==== Barrier Functions ==== |
| - | * Red LED → access denied | + | |
| - | * Buzzer → acoustic notifications | + | |
| - | ==== Implementation Details ==== | + | ^ Function ^ Purpose ^ |
| + | | servoMisca() | Smooth servo movement control | | ||
| - | The project integrates concepts from multiple laboratory sessions: | + | ==== Conveyor Functions ==== |
| - | === Lab 0 – GPIO === | + | ^ Function ^ Purpose ^ |
| + | | bandaPorneste() | Starts conveyor motor | | ||
| + | | bandaOpreste() | Stops conveyor motor | | ||
| - | Used for: | + | ==== LCD Functions ==== |
| - | * LEDs | + | |
| - | * buzzer | + | |
| - | * keypad communication | + | |
| - | * sensor reading | + | |
| - | === Lab 2 – Interrupts === | + | ^ Function ^ Purpose ^ |
| + | | lcdAfis() | Updates LCD display messages | | ||
| - | Interrupts are used for: | + | ===== Implemented Embedded Concepts ===== |
| - | * fast event detection | + | |
| - | * responsive system behavior | + | |
| - | === Lab 3 – Timers & PWM === | + | The project integrates concepts from multiple Embedded Systems laboratory sessions: |
| - | Used for: | + | ^ Laboratory ^ Concepts Used ^ |
| - | * servo motor PWM control | + | | GPIO | LEDs, keypad, sensors | |
| - | * authentication timeout | + | | Timers & PWM | Servo motor control | |
| - | * automatic barrier closing | + | | ADC | IR sensor analog reading | |
| + | | I2C | LCD communication | | ||
| + | | FSM Design | System control logic | | ||
| - | === Lab 4 – ADC === | + | ===== Software Optimizations ===== |
| - | Used for: | + | Several optimizations were implemented: |
| - | * reading potentiometer values | + | |
| - | * dynamic timing adjustment | + | |
| - | === Lab 6 – I2C === | + | * modular firmware structure; |
| + | * state-based architecture; | ||
| + | * automatic sensor calibration; | ||
| + | * non-blocking timeout management; | ||
| + | * smooth servo movement; | ||
| + | * reduced LCD refresh flickering; | ||
| + | * stable sensor polling. | ||
| - | Used for: | + | ===== System Workflow ===== |
| - | * LCD communication | + | |
| - | * real-time status display | + | |
| - | ==== Optimizations ==== | + | - System waits in ST_IDLE. |
| + | - Front sensor detects user presence. | ||
| + | - User enters authentication PIN. | ||
| + | - If PIN is correct: | ||
| + | * barrier opens; | ||
| + | * conveyor belt starts; | ||
| + | * green LED activates. | ||
| + | - Rear sensor confirms passage. | ||
| + | - Conveyor stops. | ||
| + | - Barrier closes. | ||
| + | - System returns to idle state. | ||
| - | * Non-blocking timing using millis() | + | In case of: |
| - | * Event-driven FSM implementation | + | * invalid PIN; |
| - | * Reduced LCD refresh to minimize flicker | + | * timeout; |
| - | * Stable sensor polling to avoid false triggers | + | * missing passage confirmation; |
| + | the firmware transitions into an error handling state and safely resets the system. | ||
| ===== Results ===== | ===== Results ===== | ||
| Line 281: | Line 399: | ||
| ==== Github Repository ==== | ==== Github Repository ==== | ||
| - | [[https://github.com/]] | + | [[https://github.com/andreeapeiu/Smart-Barrier-Access-System.git]] |
| ==== Demo Video ==== | ==== Demo Video ==== | ||
| - | [[https://youtube.com/]] | + | [[https://youtube.com/shorts/fw3LWh_MJx0?is=S9cDCzvet7fm1EIm]] |
| ==== Project Images ==== | ==== Project Images ==== | ||