0% found this document useful (0 votes)
14 views

Automatic Smart Car Barrier System Using Arduino - MArobotic

This document describes an automatic smart car barrier system using an Arduino. The system uses an ultrasonic sensor and servo motor to open and close a barrier in response to detecting a car. When a car is detected within 10cm, the barrier opens for 2 seconds, indicated by a green LED turning on, then closes, with the red LED turning on. The system was modeled in Proteus simulation software and the Arduino code controls the components to achieve this automated functionality.

Uploaded by

radityanoval2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Automatic Smart Car Barrier System Using Arduino - MArobotic

This document describes an automatic smart car barrier system using an Arduino. The system uses an ultrasonic sensor and servo motor to open and close a barrier in response to detecting a car. When a car is detected within 10cm, the barrier opens for 2 seconds, indicated by a green LED turning on, then closes, with the red LED turning on. The system was modeled in Proteus simulation software and the Arduino code controls the components to achieve this automated functionality.

Uploaded by

radityanoval2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Welcome to Marobotic Customer Care +92 337 8655465

0
Your Cart

₨0

Search for products

Automatic Smart Car Barrier System Using Arduino - jaweria zafar


0
Automatic
Categories Smart Car Barrier System Using Arduino

November 17, 2023

Introduction
The integration of smart technology into everyday operations is becoming increasingly comm
environment. Using Arduino to construct an Automatic Smart Car Barrier System is one such
project is to develop a barrier system that, in a variety of locations, including parking lots or
automatically opens and closes in response to the presence of a car, improving convenience
Ultrasonic Sensor and Mini Servo Motor SG90 are two parts that we may use with Arduino t
automated and responsive barrier system.

Components Required
VPC Cardboard 5mm
Solderless Breadboard
Arduino UNO
SG90 Servo Motor
Ultrasonic Sensor HC-SR04
100R Resistor x 2
Green LED
Red LED
Male to Male Jumper Wires
Hard Jumper Wire
Battery Clip
9V Battery

Proteus Simulation
Proteus 8 is used to model the Automatic Smart Car Barrier System project in the supplied si
link in the description will take you to the simulation file. The ‘ARDUINO UNO’ board, ‘SG90’
ultrasonic sensor, two LEDs (one red, one green), and a virtual terminal for tracking distanc
used in the simulation. The Arduino IDE is used to compile the Arduino code, which is in cha
After that, the code is uploaded to the Arduino UNO board, and a copy of the generated hex fi
Arduino component is setup in the Proteus simulation environment by pasting the address o
simulation starts. The virtual terminal shows the distance measurements in centimeters dur
motor moves the barrier from 0 to 90 degrees when the distance falls below 10 cm, signaling
of the ultrasonic sensor. Concurrently, the green LED illuminates, indicating that the barrier
and the red LED glows after a 2000 ms delay. The distance value varies, and this cycle is repe
Barrier System’s real-time functionality is aptly demonstrated by this simulation, which high
react autonomously to the presence or absence of automobiles.
DOWNLOAD CODE, SIMULATION AND CIRCUIT DIAGRA

Circuit Diagram
A 9-volt battery serves as the main power source for the system. The Arduino UNO serves as
unit, coordinating the actions of all the circuit’s components. The circuit incorporates two LE
green hues. The negative terminals of each LEDs are linked in series with 100-ohm resistors
to the ground. Control over the LEDs’ lighting is made possible by connecting the positive pin
the Arduino UNO. The HC-SR04 ultrasonic sensor is a crucial part of the system for identifyin
deciding when to raise and lower the barrier. The barrier is physically manipulated by use o
Arduino UNO uses the data from the ultrasonic sensor to control the movement of the servo
demonstrates the smooth integration of parts in the Automatic Smart Car Barrier System by
connection between the power supply, control unit, sensors, and actuators. When implemen
this circuit design guarantees that the system will respond to the presence or absence of veh
DOWNLOAD CODE, SIMULATION AND CIRCUIT DIAGRA

Arduino IDE Code


1 #include <Servo.h>
2 Servo myservo;
3
4 #define G_led 2 // choose the pin for the Green Led
5 #define R_led 3 // choose the pin for the Red Led
6
7 #define echopin 4 // echo pin
8 #define trigpin 5 // Trigger pin
9
10 int cm; // Duration used to calculate distance
11 int degree=0, flag=0;
12 int set_time=2000;
13 long rememTime;
14
15 void setup(){ // put your setup code here, to run once
16 Serial.begin(9600);// initialize serial communication at 9600 bits per se
17
18 myservo.attach(8); // declare Servo Motor as output
19 myservo.write(degree);
20
21 pinMode(R_led,OUTPUT); // declare Red LED as output
22 pinMode(G_led,OUTPUT); // declare Green LED as output
23
24 pinMode(trigpin, OUTPUT); // declare ultrasonic sensor Echo pin as input
25 pinMode(echopin, INPUT); // declare ultrasonic sensor Trigger pin as Out
26
27 delay(500);
28 }
29
30 void loop(){
31 // Write a pulse to the HC-SR04 Trigger Pin
32 digitalWrite(trigpin, LOW);
33 delayMicroseconds(2);
34 digitalWrite(trigpin, HIGH);
35 delayMicroseconds(10);
36
37 // Measure the response from the HC-SR04 Echo Pin
38 long ultra_time = pulseIn (echopin, HIGH);
39 // Determine distance from duration
40 // Use 343 metres per second as speed of sound
41 cm = ultra_time / 29 / 2;
42
43 Serial.print("cm:");Serial.println(cm);
44
45 if(cm<10)rememTime = millis(); // set start time
46
47 if((millis()- rememTime) > set_time){
48 digitalWrite(G_led, LOW); // LED Turn Off.
49 digitalWrite(R_led, HIGH); // LED Turn On
50 if(flag==1){ flag=0;
51 for(degree=90; degree>0; degree-=1){
52 myservo.write(degree);
53 delay(3);
54 }
55 }
56 }else{
57 digitalWrite(G_led, HIGH); // LED Turn On
58 digitalWrite(R_led, LOW); // LED Turn Off
59 if(flag==0){ flag=1;
60 for(degree=0; degree<90; degree+=1){
61 myservo.write(degree);
62 delay(3);
63 }
64 }
65 }
66
67 delay(100);
68 }

Explanation

To make controlling the servo motor easier, the Servo library is first included in the code. ‘m
value for the servo motor. In addition, the green and red LEDs’ respective pins 2 and 3 are in
sensor’s trigger and echo pins are configured as 4 and 5, respectively. We introduce variable
time, ‘flag’ for loop control, ‘degree’ for servo motor position, and ‘cm’ for distance. The code
communication at a baud rate of 9600 and establishes the starting circumstances, including
and the pin modes of the LEDs. The code continuously measures the distance from the ultras
the serial monitor during the main loop. After then, it measures the distance to ascertain wh
remaining time is set to the designated time for barrier opening and the flag is set to reset th
below 10 cm. Based on the amount of time that has passed, the code controls when the barri
barrier shuts when the remaining time approaches the designated open time, and vice versa
that some parts of the code run just once, until the system is triggered by the next car. When
closing, a for loop is used to smoothly move the servo motor between 0 and 90 degrees. With
runs continuously to guarantee real-time responsiveness. To put it briefly, the code uses the
sensor to intelligently coordinate the Automatic Smart Car Barrier System’s actions in respon
of a vehicle.

DOWNLOAD CODE, SIMULATION AND CIRCUIT DIAGRA

Hardware Testing
Use the 9V battery to power the system after the circuit has been completed and the code ha
Uno. Keep an eye on how the barrier system reacts to a vehicle’s presence or absence. Make
display the system’s state and that the servo motor moves the barrier in accordance with tha

Conclusion
The Automatic Smart Car Barrier System, in summary, is a useful and adaptable project that
Arduino technology. The HC-sr04 Ultrasonic Sensor and Mini Servo Motor SG90 are two part
effective and automated vehicle access control system. This project advances the use of sma
by providing access to a range of applications in smart parking systems and security solution
jaweria zafar

Leave a Reply
Your email address will not be published. Required fields are marked *

Comment *

Name * Website
Email *

Save my name, email, and website in this browser for the next time I comment.

Post Comment

IOT And Manual Switch Control Home Appliances Using Firebase Server
by jaweria zafar

RTC Automatic Home Appliances Control Using Arduino


by jaweria zafar

Real Time Clock With Alarm Using Arduino And RTC DS3231
by jaweria zafar

Real Time Clock Based Automatic Home Appliances Control


by jaweria zafar

TDS Meter – Water Quality Tester


by jaweria zafar

Arduino Smart Car Barrier System, Automatic Smart Car Barrier System Using Arduino

Like this post?


Facebook, Twitter, Pinterest

Fingerprint Door Lock Security System RFID based Autom

Leave a Reply

Your email address will not be published.


Comment

Your name *

Your email *

Save my name, email, and website in this browser for the next time I comment.

Add Comment

Products Customer Service Socials


Microcontroller Boards Shop Twitter
Displays About us YouTube
Sensors Contacts Facebook
Arduino UNO 3
MQ-3-Sensor

Marobotic © 2023/ All Rights Reserved

You might also like