This is an old revision of the document!


Smart Barrier Access System

Introduction

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.

General Description

Hardware Modules

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:

  • “Enter PIN”
  • “Access Granted”
  • “Access Denied”
  • “Timeout”

LEDs - Provide visual and audio feedback depending on system state and authentication result.

System Workflow

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

State Machine Architecture

The software is implemented using a finite state machine (FSM) with the following states:

  • IDLE
  • WAIT_FOR_CONFIRM
  • OPENING
  • WAIT_FOR_PASS
  • CLOSING
  • ERROR

Block Diagram

Legend:

  • Sensors → Blue
  • User Inputs → Purple
  • Arduino / Control Unit → Orange
  • Actuators / Motors → Green
  • Display Module → Yellow
  • LED Indicators → Red

Hardware Design

Components Scheme

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:

  • Green LED → access granted
  • Red LED → invalid PIN or system error

The project also includes a custom-designed PCB containing routing, connectors, protection components, and dedicated headers for all external modules.

Electrical Schematic

schema_electrica_peiu.jpeg

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

pcb_front_peiu.jpeg pcb_back_peiu.jpeg

Pin Configuration

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

Additional Notes

  • Pins A4 and A5 are reserved for I2C communication with the LCD module.
  • The servo motor uses PWM for smooth positioning control.
  • Hardware timers are used to manage authentication timeout intervals.
  • Sensors are continuously monitored for event-driven transitions.

Bill of Materials (BOM)

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

Software Design

Development Environment

  • Arduino IDE
  • Language: C/C++
  • Platform: Arduino Uno

External Libraries Used

  • Servo.h
  • Keypad.h
  • LiquidCrystal_I2C.h
  • Wire.h

Code Components

The software is divided into several logical modules:

State Machine Logic

Handles all transitions between system states:

  • IDLE
  • WAIT_FOR_CONFIRM
  • OPENING
  • WAIT_FOR_PASS
  • CLOSING
  • ERROR

Authentication Module

  • Reads keypad input
  • Stores typed digits
  • Validates entered PIN
  • Handles timeout conditions

Barrier Control Module

  • Controls servo position using PWM
  • Opens and closes the barrier
  • Ensures smooth transitions

Sensor Monitoring Module

  • Continuously checks both proximity sensors
  • Detects user arrival and passage
  • Triggers FSM state transitions

LCD Feedback System

Displays:

  • current state
  • authentication messages
  • error messages
  • timeout notifications

Audio & Visual Feedback

  • Green LED → access granted
  • Red LED → access denied
  • Buzzer → acoustic notifications

Implementation Details

The project integrates concepts from multiple laboratory sessions:

Lab 0 – GPIO

Used for:

  • LEDs
  • buzzer
  • keypad communication
  • sensor reading

Lab 2 – Interrupts

Interrupts are used for:

  • fast event detection
  • responsive system behavior

Lab 3 – Timers & PWM

Used for:

  • servo motor PWM control
  • authentication timeout
  • automatic barrier closing

Lab 4 – ADC

Used for:

  • reading potentiometer values
  • dynamic timing adjustment

Lab 6 – I2C

Used for:

  • LCD communication
  • real-time status display

Optimizations

  • Non-blocking timing using millis()
  • Event-driven FSM implementation
  • Reduced LCD refresh to minimize flicker
  • Stable sensor polling to avoid false triggers

Results

The final system successfully demonstrates:

  • automatic user detection;
  • secure PIN-based authentication;
  • automated barrier control;
  • real-time LCD feedback;
  • audio and visual signaling;
  • timeout and error handling.

The barrier responds reliably to user interaction and correctly manages all implemented states.

Github Repository

Demo Video

Project Images

Conclusion

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:

  • RFID authentication;
  • Bluetooth/WiFi connectivity;
  • mobile application integration;
  • cloud logging system;
  • IoT monitoring.

Bibliography

Hardware Resources

  • Arduino Uno Datasheet
  • SG90 Servo Motor Datasheet
  • HC-SR04 Sensor Datasheet
  • LCD 16×2 I2C Documentation

Software Resources

pm/prj2026/bianca.popa1106/andreea.peiu.1778348441.txt.gz · Last modified: 2026/05/09 20:40 by andreea.peiu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0