This is an old revision of the document!
Smart Barrier Access System is an embedded system project that simulates an intelligent access control barrier, similar to those used in parking systems, restricted access areas, or automated gates. The project is built around an Arduino microcontroller and integrates multiple hardware and software modules to provide a secure and interactive access experience.
The system uses two proximity sensors to detect the presence and movement of a user around the barrier. When a person approaches the entrance area, the first sensor triggers the authentication sequence. The user must then enter a valid PIN code using a 4×4 membrane keypad within a limited time interval.
If the authentication is successful, the barrier is lifted using a servo motor. After the user passes through the access point, the second sensor confirms the passage and the barrier automatically closes. If the user fails to authenticate or no movement is detected after opening the barrier, the system safely returns to its initial state.
The main purpose of the project is to demonstrate the implementation of a real-time embedded access control system by combining sensors, motors, and authentication mechanisms, and state-based software control. The project integrates multiple concepts studied during Embedded Systems laboratories, such as GPIO, interrupts, PWM, timers, ADC, and I2C communication.
I believe the project is useful both from an educational and practical perspective. It offers a clear example of how hardware and software modules can interact in order to create an automated and secure control system. At the same time, it provides hands-on experience with designing PCBs, integrating multiple peripherals, implementing finite state machines, and developing modular embedded applications.
The project combines security, automation, and user interaction that can later be extended with RFID, IoT connectivity, or wireless communication features.
• Arduino Nano - Main control unit. It coordinates all hardware modules, processes sensor inputs, validates the PIN code, and controls the barrier state.
• Proximity Sensor 1 - Detects the presence of a user in front of the barrier and initiates the authentication sequence.
• 4×4 Membrane Keypad - Allows the user to enter the authentication PIN code.
• Servo Motor (SG90) - Controls the physical position of the miniature barrier (open/closed).
• Proximity Sensor 2 - Detects whether the user has successfully passed through the access point.
• LCD 16×2 with I2C Interface - Displays system states and user messages such as:
• LEDs - Provide visual and audio feedback depending on system state and authentication result.
1. User approaches the barrier
-> Proximity Sensor 1 detects movement -> System transitions from IDLE to WAIT_FOR_CONFIRM -> LCD prompts user to enter PIN
2. User enters authentication code
-> Keypad input is processed -> Hardware timer starts countdown for timeout protection -> PIN is validated
3. If PIN is correct
-> Barrier opens using servo motor -> Green LED indicates successful access -> System enters WAIT_FOR_PASS state
4. User passes through the barrier
-> Proximity Sensor 2 confirms passage -> Barrier closes automatically -> System returns to IDLE
5. Error handling
-> Invalid PIN or timeout triggers error state -> Red LED indicates failure -> Barrier remains closed -> System resets safely
The software is implemented using a finite state machine (FSM) with the following states:
Legend:
The hardware architecture of the project is centered around an Arduino Nano microcontroller integrated on a custom PCB designed in KiCad. The system combines multiple peripherals used for user detection, authentication, visual feedback, and motion control.
The access control mechanism is based on two IR proximity sensors positioned before and after the barrier. The first sensor detects the presence of a user near the access point and triggers the authentication process, while the second sensor confirms that the user successfully passed through the barrier.
User authentication is performed through a 4×4 membrane keypad connected to multiple digital GPIO pins of the microcontroller. The entered PIN is processed by the firmware and validated before allowing access.
The physical barrier is controlled using an SG90 servo motor driven through a PWM signal generated by the Arduino Nano. In addition, the project includes a DC motor controlled through an L298N H-Bridge motor driver, allowing bidirectional movement of the conveyor belt mechanism.
A 16×2 LCD display connected through the I2C interface is used to display system states, authentication messages, and user instructions in real time.
Two LEDs are used as visual status indicators:
The project also includes a custom-designed PCB containing routing, connectors, protection components, and dedicated headers for all external modules.
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.
| Component | Arduino Nano Pin(s) | Type | Description |
|---|---|---|---|
| Proximity Sensor 1 | todo | Digital Input | Detects user before barrier |
| Proximity Sensor 2 | todo | Digital Input | Detects user after barrier |
| Servo Motor SG90 | todo | PWM Output | Controls barrier movement |
| Keypad 4×4 | todo | Digital I/O | Reads user PIN input |
| LCD 16×2 I2C | todo | I2C Interface | Displays system messages |
| Green LED | todo | Digital Output | Access granted indicator |
| Red LED | todo | Digital Output | Access denied/error indicator |
| Component | Description | Quantity |
|---|---|---|
| Arduino Nano | Main microcontroller board | 1 |
| SG90 Servo Motor | Barrier actuation mechanism | 1 |
| DC Motor | Conveyor belt movement | 1 |
| L298N Motor Driver | H-Bridge motor controller | 1 |
| 4×4 Membrane Keypad | PIN authentication input | 1 |
| IR Proximity Sensors | User detection | 2 |
| LCD 16×2 with I2C | User interface display | 1 |
| LEDs | Visual feedback indicators | 2 |
| Custom PCB | Hardware integration board | 1 |
| Jumper Wires / Connectors | Electrical connections | ~20 |
| Resistors | Current limiting and pull-up resistors | Multiple |
The firmware was developed using:
The software architecture is based on a finite state machine (FSM) implementation that manages all transitions between authentication, barrier control, and user detection states.
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.
The application firmware is divided into multiple logical modules responsible for different hardware subsystems and control mechanisms.
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:
The authentication subsystem is responsible for:
Main features:
The authentication logic compares the entered PIN with a predefined secret code stored in firmware.
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:
This improves detection reliability and reduces false triggering.
The physical barrier is controlled using an SG90 servo motor.
The firmware implements:
Servo positions:
Movement timing is controlled through software delays to obtain smooth mechanical motion.
The conveyor mechanism is controlled through an H-Bridge driver.
Implemented operations:
The conveyor starts only after successful authentication and stops automatically after user passage confirmation.
A 16×2 I2C LCD module is used to provide real-time user feedback.
Displayed messages include:
The LCD interface improves usability and debugging visibility.
Two LEDs are used for visual feedback:
| LED | Meaning |
|---|---|
| Green LED | Access granted / active system |
| Red LED | Access denied / error state |
Implemented behavior:
The firmware uses non-blocking timing based on the millis() function.
Implemented protections:
Advantages:
| Function | Purpose |
|---|---|
| tranzitie() | Handles FSM transitions |
| Function | Purpose |
|---|---|
| irFata() | Detects approaching user |
| irSpate() | Detects completed passage |
| Function | Purpose |
|---|---|
| servoMisca() | Smooth servo movement control |
| Function | Purpose |
|---|---|
| bandaPorneste() | Starts conveyor motor |
| bandaOpreste() | Stops conveyor motor |
| Function | Purpose |
|---|---|
| lcdAfis() | Updates LCD display messages |
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 |
Several optimizations were implemented:
In case of:
the firmware transitions into an error handling state and safely resets the system.
The final system successfully demonstrates:
The barrier responds reliably to user interaction and correctly manages all implemented states.
The project successfully combines multiple embedded systems concepts into a practical and interactive application. It demonstrates how sensors, actuators, timers, communication protocols, and state machines can work together to create a functional access control system.
The implementation achieved all proposed objectives while also providing opportunities for future improvements such as: