Sunday , November 24 2024

Design of an Automated Vehicle Barrier System Using Arduino

Abstract

This project presents the design and implementation of an automated vehicle barrier system using an Arduino Nano, an ultrasonic sensor, and a servo motor. The sensor detects the proximity of a vehicle, automatically triggering the barrier to lift when the measured distance is less than 10 cm. After a 5-second delay, the barrier automatically closes. This system offers a practical and economical solution for automating access control barriers in infrastructure.

Introduction

Automating access control systems has become a necessity in many infrastructures, whether for parking lots, secure areas, or traffic lanes. The idea of automatically controlling vehicle access through automated barriers is a concept that has proven effective in reducing manual system costs while improving efficiency and safety.

In this project, an automated barrier system is designed using an Arduino Nano, which acts as the central controller for managing sensors and actuators. The ultrasonic sensor measures the distance between the barrier and the vehicle, and if the vehicle is within 10 cm, the barrier automatically lifts. The servo motor is used to perform the vertical movement of the barrier, lifting and closing it within a predefined time interval. This system was tested with a real car, manually moved to simulate vehicle approach.

Managing vehicle barriers is a key technology in modern infrastructure automation, especially in densely populated urban areas where controlling vehicle flow is crucial. Moreover, Arduino, with its affordability and flexibility, is an ideal solution for many automation projects. This project aims to provide a simple, efficient, and adaptable solution for various scenarios where rapid, human-free interaction is required.

Materials and Methods

For the realization of this project, the following components were used:

  • Arduino Nano: This microcontroller manages all system operations, from controlling the ultrasonic sensor to managing the servo motor. It is easy to program and compact enough to be used in embedded projects.
  • Ultrasonic Sensor (HC-SR04): This sensor measures the distance between the barrier and the vehicle. It sends a sound pulse and calculates the time it takes for the pulse to return after being reflected by an object (in this case, the vehicle).
  • Servo Motor: The servo motor is responsible for lifting and lowering the barrier. It is controlled by PWM pulses sent from the Arduino. The barrier lifts to a 90° angle when the vehicle is detected and automatically closes after 5 seconds.
  • Barrier System: The barrier used in this project is a simple model, connected to the servo motor to perform vertical movements.

The setup is simple: the ultrasonic sensor is mounted near the barrier to detect the vehicle’s approach. When the vehicle comes within 10 cm, the sensor sends information to the Arduino, which in turn activates the servo motor to raise the barrier. After a 5-second delay, the servo motor lowers the barrier. This system was tested with a manually moved car to simulate the approach of a real vehicle.

Circuit Diagram

The circuit consists of the following elements:

  • The Arduino Nano connected to the ultrasonic sensor via the trig and echo pins.
  • The servo motor is controlled via a PWM pin of the Arduino to carry out the vertical movement of the barrier.

Arduino Code

The developed code uses the distance measurement features of the ultrasonic sensor and the control of the servo motor. Here’s a key excerpt from the code:

#include <Servo.h>

const int trigPin = 7;
const int echoPin = 8;
const int servoPin = 9;
Servo barrierServo;

void setup() {
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  barrierServo.attach(servoPin);
  barrierServo.write(0);  // Barrier closed
}

void loop() {
  long duration, distance;

  // Send ultrasonic signal
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  // Read echo duration
  duration = pulseIn(echoPin, HIGH);
  distance = duration * 0.034 / 2; // Calculate distance in cm

  if (distance < 10) {
    // If the distance is less than 10 cm, lift the barrier
    barrierServo.write(90);  // Lift the barrier
    delay(5000);  // Wait 5 seconds
    barrierServo.write(0);   // Lower the barrier
  }

  delay(100);
}

This code detects the vehicle’s approach and actuates the barrier accordingly. The barrier lifts when the vehicle is within 10 cm and closes after a 5-second delay.

Results

During tests performed with a real car, the system reliably detected the presence of the vehicle near the barrier and activated the servo motor to raise the barrier. The barrier lifted to a 90° angle when the vehicle reached a distance of less than 10 cm, and after 5 seconds, it automatically closed.

The system was tested under different conditions and consistently demonstrated its effectiveness. No major issues were observed during these tests, and the ultrasonic sensor showed high precision in measuring the vehicle’s distance.

Discussion

This project successfully demonstrated the effectiveness of an automated vehicle barrier control system based on an Arduino Nano and an ultrasonic sensor. The use of a servo motor enabled smooth and precise lifting and lowering of the barrier. Moreover, the ultrasonic sensor proved reliable in detecting the vehicle’s distance, ensuring accurate automatic opening of the barrier.

This system can be used in parking lots, security installations, or access control areas where automated vehicle flow management is required. While simple to implement, possible improvements include adding a second sensor to continuously detect the vehicle’s presence or integrating communication systems for remote control.

Conclusion

This project demonstrated the feasibility of creating an automated vehicle barrier system using simple and affordable components such as the Arduino Nano, ultrasonic sensor, and servo motor. The system proved effective in tests and can easily be adapted for real-world applications, such as parking lots or access control systems. Future improvements could include the integration of additional sensors or safety mechanisms to enhance the system’s robustness.

Share

About Jilali LAKTATI

Master en multimédia et technologie de web. Développeur informatique.