Automatic Gate and Car Parking System with Arduino

Are you tired of daily opening your home gate? when you come to back to home from office. No more, we will make Automatic Gate Unlock and Car Parking system. This system can be designed to automatically open a gate when a vehicle approaches the gate and also it will indicate and warn the car driver through led lights and buzzer when the car will approach the wall in garage.

This project focuses on designing an Automatic Gate Unlock and Car Parking System where a sliding gate is operated using a High Power DC Motor. An Arduino Uno is used as the brain to control the motor through a Relay Module. Limit switches are installed to detect the fully opened and fully closed positions of the sliding gate, ensuring safe operation. An Ultrasonic sensor is placed at the entrance to detect the presence of a vehicle. Additionally, LEDs and a Buzzer provide visual and audible feedback for different gate statuses. This system aims to automate entry, optimize parking processes, and enhance security.

Automatic Gate Unlock and Car Parking with Arduino

Benefits of Automatic Gate and Car Parking System with Arduino:

Hands-Free Operation: Automates the gate opening process, reducing the need for manual control, which is particularly convenient for drivers.

Enhanced User Experience: Provides a smoother and more satisfying experience for drivers, with reduced waiting times and easier parking.

Automated Gate Control: Reduces unnecessary energy consumption by ensuring that the gate is only open when needed and closes automatically after the vehicle has passed.

Components used in Automatic Gate and Car Parking System project with Arduino:

  • Arduino Uno (Microcontroller)
  • High Power DC Motor (to slide the gate)
  • 2-Channel Relay Module (to control motor direction: open/close)
  • Ultrasonic Sensor (HC-SR04) (to detect vehicle arrival)
  • Limit Switches (2 units) (for detecting the gate’s fully open and fully closed positions)
  • LEDs (Red and Green for gate status)
  • Buzzer (for warning sounds)
  • 12V/24V DC Power Supply (depending on motor rating)
  • Motor Driver/Relays with Flyback Diode Protection (for safe motor control)
  • Wires, Connectors, Enclosure

Working Principle Automatic Gate and Car Parking System:

1. Vehicle Detection:
  • An Ultrasonic Sensor constantly monitors the distance at the gate entrance.
  • When a vehicle approaches (distance drops below a preset threshold), the Arduino detects the car’s presence.
2. Gate Operation:
  • If a vehicle is detected:
    • Arduino energizes the relay connected to the DC motor to start moving the gate in the open direction.
    • The motor slides the gate open until it presses the open limit switch.
    • When the open limit switch is triggered, Arduino cuts power to the motor to stop it.
  • After a time delay (allowing the car to pass through), Arduino:
    • Reverses the motor direction using the second relay to close the gate.
    • The gate moves until it presses the close limit switch, stopping the motor again.
3. Safety Mechanism:
  • Limit switches prevent the gate from over-traveling.
  • Buzzer and LEDs provide feedback:
    • Green LED: Gate open
    • Red LED: Gate closed
    • Buzzer: Sound during gate movement

Circuit Diagram of Automatic Gate and Car Parking System with Arduino:

ComponentArduino PinNotes
Ultrasonic TriggerD8Output
Ultrasonic EchoD9Input
Relay 1 (Open Gate)D5Output
Relay 2 (Close Gate)D6Output
Limit Switch (Open)D2Input (Normally Open contact)
Limit Switch (Close)D3Input (Normally Open contact)
Green LEDD10Output
Red LEDD11Output
BuzzerD12Output

Arduino Code for Automatic Gate and Car Parking System with Arduino:

#include <NewPing.h>

#define TRIG_PIN 8
#define ECHO_PIN 9
#define MAX_DISTANCE 200

#define RELAY_OPEN 5
#define RELAY_CLOSE 6
#define LIMIT_OPEN 2
#define LIMIT_CLOSE 3

#define GREEN_LED 10
#define RED_LED 11
#define BUZZER 12

NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);

void setup() {
  pinMode(RELAY_OPEN, OUTPUT);
  pinMode(RELAY_CLOSE, OUTPUT);
  pinMode(LIMIT_OPEN, INPUT_PULLUP);
  pinMode(LIMIT_CLOSE, INPUT_PULLUP);
  
  pinMode(GREEN_LED, OUTPUT);
  pinMode(RED_LED, OUTPUT);
  pinMode(BUZZER, OUTPUT);

  digitalWrite(RELAY_OPEN, LOW);
  digitalWrite(RELAY_CLOSE, LOW);
}

void loop() {
  delay(50);
  int distance = sonar.ping_cm();
  
  if (distance > 0 && distance < 30) { // Vehicle detected
    openGate();
    delay(5000); // Allow vehicle to pass
    closeGate();
  }
}

void openGate() {
  digitalWrite(RELAY_CLOSE, LOW); // Ensure close relay is OFF
  digitalWrite(RELAY_OPEN, HIGH); // Start opening
  digitalWrite(BUZZER, HIGH);
  digitalWrite(GREEN_LED, HIGH);
  digitalWrite(RED_LED, LOW);

  while (digitalRead(LIMIT_OPEN) == HIGH) {
    // Wait until open limit switch is pressed
  }
  stopMotor();
}

void closeGate() {
  digitalWrite(RELAY_OPEN, LOW); // Ensure open relay is OFF
  digitalWrite(RELAY_CLOSE, HIGH); // Start closing
  digitalWrite(BUZZER, HIGH);
  digitalWrite(GREEN_LED, LOW);
  digitalWrite(RED_LED, HIGH);

  while (digitalRead(LIMIT_CLOSE) == HIGH) {
    // Wait until close limit switch is pressed
  }
  stopMotor();
}

void stopMotor() {
  digitalWrite(RELAY_OPEN, LOW);
  digitalWrite(RELAY_CLOSE, LOW);
  digitalWrite(BUZZER, LOW);
}

Important Notes for Components Usage:

Relay Board Handling:

  • Use relays with flyback diode protection for the motor’s inductive load.
  • Use a separate 12V/24V power supply for the motor if necessary, and connect relay contacts accordingly.

Limit Switch Positioning:

  • Install Open Limit Switch near the gate’s fully open position.
  • Install Close Limit Switch near the gate’s fully closed position.
  • Use Normally Open (NO) wiring configuration to sense activation.

Safety Considerations:

  • Add emergency manual override (physical switch) for manual gate control.
  • Ensure the system can stop if an obstacle is detected during gate movement (future enhancement).

Conclusion:

The Automatic Gate Unlock and Car Parking System using Arduino provides an efficient, secure, and cost-effective solution for residential and commercial premises.
By using a High Power DC Motor controlled via relays, limit switches for safety, ultrasonic sensors for vehicle detection, and LEDs and a buzzer for feedback, the system ensures smooth, reliable gate operation.
This automation not only enhances convenience and security but also optimizes parking space management.
The project demonstrates how simple components and Arduino programming can transform traditional gates into smart entry systems, offering great scalability for future upgrades like RFID, GSM notifications, or mobile app integration.

Need This Project?

If you need this Project with or without Modifications or Customization then you can contact us through WhatsApp. We can deliver you this Project in the Following Ways.

Project Code:
we can provide you Project Code along with Zoom Assistant, through Zoom meeting for Setup of this Project or any other Arduino Project of your need.

Fully Functional Project with Hardware/Components Shipment:
if you can not make this project yourself then you can use this option. We will assemble the Project and will ship it to your Doorstep with Safe Packaging.

Learn More about the services we offer.

Leave a Reply

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

Facebook
YouTube