0% found this document useful (0 votes)
18 views1 page

Automatic Parking System Arduino

Uploaded by

nandkishor0544
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)
18 views1 page

Automatic Parking System Arduino

Uploaded by

nandkishor0544
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

Automatic Car Parking System using Arduino UNO

1. Required Components:
- Arduino UNO
- Ultrasonic Sensor (HC-SR04)
- DC Motor + Motor Driver (L293D or L298N)
- Breadboard
- Jumper Wires
- USB Cable
- Power Source (6V–12V for motor)

2. Working Principle:
1. Ultrasonic sensor detects the distance of the incoming car.
2. If distance ≤ 20 cm, motor turns ON to open the gate.
3. After a short delay, motor reverses to close the gate.

3. Circuit Connections:
Ultrasonic Sensor (HC-SR04)
- VCC → 5V (Arduino)
- GND → GND
- TRIG → Pin 9
- ECHO → Pin 10

Motor Driver (L293D)


- IN1 → Pin 4
- IN2 → Pin 5
- Motor terminals → OUT1 & OUT2
- VCC (Motor Power) → 6V–12V Battery
- GND → Arduino GND

4. Arduino Code:
#define trigPin 9 #define echoPin 10 #define motorIn1 4 #define motorIn2 5 long
duration; int distance; void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin,
INPUT); pinMode(motorIn1, OUTPUT); pinMode(motorIn2, OUTPUT); Serial.begin(9600); }
void loop() { digitalWrite(trigPin, LOW); delayMicroseconds(2);
digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH); distance = duration * 0.034 / 2;
Serial.print("Distance: "); Serial.print(distance); Serial.println(" cm"); if
(distance <= 20) { digitalWrite(motorIn1, HIGH); digitalWrite(motorIn2, LOW);
delay(2000); digitalWrite(motorIn1, LOW); digitalWrite(motorIn2, HIGH); delay(2000);
digitalWrite(motorIn1, LOW); digitalWrite(motorIn2, LOW); } else {
digitalWrite(motorIn1, LOW); digitalWrite(motorIn2, LOW); } delay(500); }

5. Tips:
- Use separate power for the motor to avoid Arduino reset.
- Keep GND common between Arduino and motor power.
- Use a servo or stepper motor for precise gate movement.

You might also like