This shows you the differences between two versions of the page.
|
pm:prj2026:bianca.popa1106:andreea.peiu [2026/05/09 15:43] andreea.peiu [Electrical Schematic] |
pm:prj2026:bianca.popa1106:andreea.peiu [2026/05/25 13:17] (current) andreea.peiu [Github Repository] |
||
|---|---|---|---|
| Line 124: | Line 124: | ||
| The electrical schematic was designed in KiCad and includes all hardware connections used in the project, such as the Arduino Nano, IR sensors, LCD module, keypad interface, LEDs, and power circuitry. | The electrical schematic was designed in KiCad and includes all hardware connections used in the project, such as the Arduino Nano, IR sensors, LCD module, keypad interface, LEDs, and power circuitry. | ||
| + | ==== PCB Design ==== | ||
| {{:pm:prj2026:bianca.popa1106:pcb_front_peiu.jpeg?500}} | {{:pm:prj2026:bianca.popa1106:pcb_front_peiu.jpeg?500}} | ||
| Line 129: | Line 130: | ||
| ==== Pin Configuration ==== | ==== Pin Configuration ==== | ||
| - | ^ Component ^ Arduino Uno Pin(s) ^ Type ^ Description ^ | + | ^ Component ^ Arduino Nano Pin(s) ^ Type ^ Description ^ |
| - | | Proximity Sensor 1 | D2 | Digital Input | Detects user before barrier | | + | | Proximity Sensor 1 | todo | Digital Input | Detects user before barrier | |
| - | | Proximity Sensor 2 | D3 | Digital Input | Detects user after barrier | | + | | Proximity Sensor 2 | todo | Digital Input | Detects user after barrier | |
| - | | Servo Motor SG90 | D9 | PWM Output | Controls barrier movement | | + | | Servo Motor SG90 | todo | PWM Output | Controls barrier movement | |
| - | | Keypad 4x4 | D4 – D11 | Digital I/O | Reads user PIN input | | + | | Keypad 4x4 | todo | Digital I/O | Reads user PIN input | |
| - | | LCD 16x2 I2C | A4 (SDA), A5 (SCL) | I2C Interface | Displays system messages | | + | | LCD 16x2 I2C | todo | I2C Interface | Displays system messages | |
| - | | Green LED | D12 | Digital Output | Access granted indicator | | + | | Green LED | todo | Digital Output | Access granted indicator | |
| - | | Red LED | D13 | Digital Output | Access denied/error indicator | | + | | Red LED | todo | Digital Output | Access denied/error indicator | |
| - | | Buzzer | D6 | PWM Output | Audio feedback | | + | |
| - | | Potentiometer | A0 | Analog Input | Timeout adjustment | | + | |
| ==== Additional Notes ==== | ==== Additional Notes ==== | ||
| Line 145: | Line 145: | ||
| * The servo motor uses PWM for smooth positioning control. | * The servo motor uses PWM for smooth positioning control. | ||
| * Hardware timers are used to manage authentication timeout intervals. | * Hardware timers are used to manage authentication timeout intervals. | ||
| - | * The potentiometer allows runtime adjustment of barrier timing parameters. | ||
| * Sensors are continuously monitored for event-driven transitions. | * Sensors are continuously monitored for event-driven transitions. | ||
| Line 151: | Line 150: | ||
| ^ Component ^ Description ^ Quantity ^ | ^ Component ^ Description ^ Quantity ^ | ||
| - | | Arduino Uno | Main microcontroller board | 1 | | + | | Arduino Nano | Main microcontroller board | 1 | |
| - | | SG90 Servo Motor | Barrier actuation | 1 | | + | | SG90 Servo Motor | Barrier actuation mechanism | 1 | |
| + | | DC Motor | Conveyor belt movement | 1 | | ||
| + | | L298N Motor Driver | H-Bridge motor controller | 1 | | ||
| | 4x4 Membrane Keypad | PIN authentication input | 1 | | | 4x4 Membrane Keypad | PIN authentication input | 1 | | ||
| - | | Proximity Sensors | User detection | 2 | | + | | IR Proximity Sensors | User detection | 2 | |
| | LCD 16x2 with I2C | User interface display | 1 | | | LCD 16x2 with I2C | User interface display | 1 | | ||
| - | | Buzzer | Audio signaling | 1 | | + | | LEDs | Visual feedback indicators | 2 | |
| - | | LEDs | Visual feedback | 2 | | + | | Custom PCB | Hardware integration board | 1 | |
| - | | Potentiometer | Adjustable timing input | 1 | | + | | Jumper Wires / Connectors | Electrical connections | ~20 | |
| - | | Breadboard | Prototyping platform | 1 | | + | | Resistors | Current limiting and pull-up resistors | Multiple | |
| - | | Jumper Wires | Electrical connections | ~30 | | + | |
| - | | Resistors | Current limiting | Multiple | | + | |
| + | ====== Software Design ====== | ||
| - | ===== Software Design ===== | + | ===== Development Environment ===== |
| - | ==== 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) |
| - | ==== External Libraries Used ==== | + | The software architecture is based on a finite state machine (FSM) implementation that manages all transitions between authentication, barrier control, and user detection states. |
| - | * Servo.h | + | ===== External Libraries Used ===== |
| - | * Keypad.h | + | |
| - | * LiquidCrystal_I2C.h | + | |
| - | * Wire.h | + | |
| - | ==== Code Components ==== | + | The following third-party libraries were integrated into the project firmware: |
| - | The software is divided into several logical modules: | + | ^ 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 | | ||
| - | === State Machine Logic === | + | These libraries simplify peripheral integration and allow modular firmware development. |
| - | Handles all transitions between system states: | + | ===== Software Architecture ===== |
| - | * IDLE | + | |
| - | * WAIT_FOR_CONFIRM | + | |
| - | * OPENING | + | |
| - | * WAIT_FOR_PASS | + | |
| - | * CLOSING | + | |
| - | * ERROR | + | |
| - | === Authentication Module === | + | The application firmware is divided into multiple logical modules responsible for different hardware subsystems and control mechanisms. |
| - | * Reads keypad input | + | ===== Finite State Machine (FSM) ===== |
| - | * Stores typed digits | + | |
| - | * Validates entered PIN | + | |
| - | * Handles timeout conditions | + | |
| - | === Barrier Control Module === | + | The entire system behavior is controlled using a finite state machine. |
| - | * Controls servo position using PWM | + | Implemented states: |
| - | * Opens and closes the barrier | + | |
| - | * Ensures smooth transitions | + | |
| - | === Sensor Monitoring Module === | + | ^ 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 | | ||
| - | * Continuously checks both proximity sensors | + | The FSM implementation provides: |
| - | * Detects user arrival and passage | + | * modular control flow; |
| - | * Triggers FSM state transitions | + | * predictable state transitions; |
| + | * easier debugging and testing; | ||
| + | * scalable architecture for future extensions. | ||
| - | === LCD Feedback System === | + | ===== Authentication Module ===== |
| - | Displays: | + | The authentication subsystem is responsible for: |
| - | * current state | + | * keypad scanning; |
| - | * authentication messages | + | * PIN storage; |
| - | * error messages | + | * PIN validation; |
| - | * timeout notifications | + | * timeout protection. |
| - | === Audio & Visual Feedback === | + | Main features: |
| + | * supports numeric PIN entry; | ||
| + | * supports character deletion using '*'; | ||
| + | * PIN confirmation using '#'; | ||
| + | * automatic timeout reset after inactivity. | ||
| - | * Green LED → access granted | + | The authentication logic compares the entered PIN with a predefined secret code stored in firmware. |
| - | * Red LED → access denied | + | |
| - | * Buzzer → acoustic notifications | + | |
| - | ==== Implementation Details ==== | + | ===== Sensor Monitoring Module ===== |
| - | The project integrates concepts from multiple laboratory sessions: | + | Two IR proximity sensors are continuously monitored: |
| - | === Lab 0 – GPIO === | + | ^ Sensor ^ Purpose ^ |
| + | | Front IR Sensor | Detects user arrival | | ||
| + | | Rear IR Sensor | Detects successful passage | | ||
| - | Used for: | + | The sensors are read using analog inputs and calibrated automatically during system startup. |
| - | * LEDs | + | |
| - | * buzzer | + | |
| - | * keypad communication | + | |
| - | * sensor reading | + | |
| - | === Lab 2 – Interrupts === | + | Calibration process: |
| + | * the firmware samples sensor values multiple times; | ||
| + | * computes average environmental baseline; | ||
| + | * dynamically generates detection thresholds. | ||
| - | Interrupts are used for: | + | This improves detection reliability and reduces false triggering. |
| - | * fast event detection | + | |
| - | * responsive system behavior | + | |
| - | === Lab 3 – Timers & PWM === | + | ===== Barrier Control Module ===== |
| - | Used for: | + | The physical barrier is controlled using an SG90 servo motor. |
| - | * servo motor PWM control | + | |
| - | * authentication timeout | + | |
| - | * automatic barrier closing | + | |
| - | === Lab 4 – ADC === | + | The firmware implements: |
| + | * smooth opening movement; | ||
| + | * smooth closing movement; | ||
| + | * gradual angle transitions using incremental PWM updates. | ||
| - | Used for: | + | Servo positions: |
| - | * reading potentiometer values | + | * 0° → barrier closed; |
| - | * dynamic timing adjustment | + | * 90° → barrier opened. |
| - | === Lab 6 – I2C === | + | Movement timing is controlled through software delays to obtain smooth mechanical motion. |
| - | Used for: | + | ===== Conveyor Belt Control Module ===== |
| - | * LCD communication | + | |
| - | * real-time status display | + | |
| - | ==== Optimizations ==== | + | The conveyor mechanism is controlled through an H-Bridge driver. |
| - | * Non-blocking timing using millis() | + | Implemented operations: |
| - | * Event-driven FSM implementation | + | * conveyor start; |
| - | * Reduced LCD refresh to minimize flicker | + | * conveyor stop; |
| - | * Stable sensor polling to avoid false triggers | + | * 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. | ||
| + | |||
| + | Displayed messages include: | ||
| + | * system initialization; | ||
| + | * PIN request; | ||
| + | * access granted; | ||
| + | * access denied; | ||
| + | * timeout warnings; | ||
| + | * error states; | ||
| + | * conveyor and barrier status. | ||
| + | |||
| + | The LCD interface improves usability and debugging visibility. | ||
| + | |||
| + | ===== LED Signaling System ===== | ||
| + | |||
| + | Two LEDs are used for visual feedback: | ||
| + | |||
| + | ^ LED ^ Meaning ^ | ||
| + | | Green LED | Access granted / active system | | ||
| + | | Red LED | Access denied / error state | | ||
| + | |||
| + | Implemented behavior: | ||
| + | * both LEDs active in standby mode; | ||
| + | * both LEDs off during authentication; | ||
| + | * green LED active after successful authentication; | ||
| + | * red LED active after invalid PIN; | ||
| + | * red LED blinking during error state. | ||
| + | |||
| + | ===== Timing and Timeout Management ===== | ||
| + | |||
| + | The firmware uses non-blocking timing based on the millis() function. | ||
| + | |||
| + | Implemented protections: | ||
| + | * PIN input timeout; | ||
| + | * passage timeout; | ||
| + | * automatic recovery after inactivity. | ||
| + | |||
| + | Advantages: | ||
| + | * responsive behavior; | ||
| + | * reduced blocking delays; | ||
| + | * stable event processing. | ||
| + | |||
| + | ===== Implemented Functions ===== | ||
| + | |||
| + | ==== State Management ==== | ||
| + | |||
| + | ^ Function ^ Purpose ^ | ||
| + | | tranzitie() | Handles FSM transitions | | ||
| + | |||
| + | ==== Sensor Functions ==== | ||
| + | |||
| + | ^ Function ^ Purpose ^ | ||
| + | | irFata() | Detects approaching user | | ||
| + | | irSpate() | Detects completed passage | | ||
| + | |||
| + | ==== Barrier Functions ==== | ||
| + | |||
| + | ^ Function ^ Purpose ^ | ||
| + | | servoMisca() | Smooth servo movement control | | ||
| + | |||
| + | ==== Conveyor Functions ==== | ||
| + | |||
| + | ^ Function ^ Purpose ^ | ||
| + | | bandaPorneste() | Starts conveyor motor | | ||
| + | | bandaOpreste() | Stops conveyor motor | | ||
| + | |||
| + | ==== LCD Functions ==== | ||
| + | |||
| + | ^ Function ^ Purpose ^ | ||
| + | | lcdAfis() | Updates LCD display messages | | ||
| + | |||
| + | ===== Implemented Embedded Concepts ===== | ||
| + | |||
| + | The project integrates concepts from multiple Embedded Systems laboratory sessions: | ||
| + | |||
| + | ^ Laboratory ^ Concepts Used ^ | ||
| + | | GPIO | LEDs, keypad, sensors | | ||
| + | | Timers & PWM | Servo motor control | | ||
| + | | ADC | IR sensor analog reading | | ||
| + | | I2C | LCD communication | | ||
| + | | FSM Design | System control logic | | ||
| + | |||
| + | ===== Software Optimizations ===== | ||
| + | |||
| + | Several optimizations were implemented: | ||
| + | |||
| + | * modular firmware structure; | ||
| + | * state-based architecture; | ||
| + | * automatic sensor calibration; | ||
| + | * non-blocking timeout management; | ||
| + | * smooth servo movement; | ||
| + | * reduced LCD refresh flickering; | ||
| + | * stable sensor polling. | ||
| + | |||
| + | ===== System Workflow ===== | ||
| + | |||
| + | - 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. | ||
| + | |||
| + | In case of: | ||
| + | * invalid PIN; | ||
| + | * timeout; | ||
| + | * missing passage confirmation; | ||
| + | |||
| + | the firmware transitions into an error handling state and safely resets the system. | ||
| ===== Results ===== | ===== Results ===== | ||
| Line 284: | Line 399: | ||
| ==== Github Repository ==== | ==== Github Repository ==== | ||
| - | [[https://github.com/USERNAME/andreea-project]] | + | [[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 ==== | ||
| - | {{:pm:prj2026:andreea:full_setup.jpg?600|}} | ||
| - | |||
| - | {{:pm:prj2026:andreea:lcd_interface.jpg?600|}} | ||
| - | |||
| - | {{:pm:prj2026:andreea:barrier_open.jpg?600|}} | ||
| ===== Conclusion ===== | ===== Conclusion ===== | ||
| Line 315: | Line 425: | ||
| * Arduino Uno Datasheet | * Arduino Uno Datasheet | ||
| * SG90 Servo Motor Datasheet | * SG90 Servo Motor Datasheet | ||
| - | * HC-SR04 Sensor Datasheet | ||
| * LCD 16x2 I2C Documentation | * LCD 16x2 I2C Documentation | ||
| ==== Software Resources ==== | ==== Software Resources ==== | ||
| - | * https://www.arduino.cc/ | + | |
| - | * https://docs.arduino.cc/ | + | |
| - | * https://github.com/arduino-libraries/Servo | + | |
| - | * https://github.com/Chris--A/Keypad | + | |
| - | * https://github.com/johnrickman/LiquidCrystal_I2C | + | |