Free Tutorial

Automatic Car Gate Control

Beginner Difficulty
1 Est. Time
3 items Components Needed

About This Project

The RFID Automatic Car Gate Controller is an intelligent vehicle access control system that uses RFID technology to identify authorized vehicles and automatically open a gate. Each authorized vehicle is assigned a unique RFID card or key tag. When the RFID tag is brought near the RFID reader, the Arduino reads the card's unique ID (UID). If the UID matches a stored authorized ID, the system opens the gate using a servo motor, allowing the vehicle to pass. After a preset delay, the gate automatically closes. Unauthorized cards are denied access, improving security and reducing the need for manual gate operation.

 

Components Required

Component Quantity
Arduino Uno 1
MFRC522 RFID Reader 1
RFID Cards/Tags 2 or more
Servo Motor (SG90/MG996R) 1

 

Working Principle

  1. The system waits for an RFID card.
  2. The driver presents the RFID card near the RC522 reader.
  3. The Arduino reads the UID.
  4. If the UID is valid:
    • Servo opens the gate.
    • Vehicle enters.
    • Gate closes automatically after a delay.
  5. If the UID is invalid:
    • Gate stays locked.

Components Required

  • Arduino Nano / Uno
  • Servo 9g
  • RC522 RFID reader and Tag

Circuit Diagram

Circuit diagram for Automatic Car Gate Control

Step-by-Step Instructions

  1. Step 1: System Initialization
  2. Step 2: RFID Card Detection
  3. Step 3: Authentication
  4. Step 4: Gate Opening
  5. Step 5: Unauthorized Access

Source Code

Arduino / ESP32 Sketch
/*
 * This Arduino Sketch interfaces with an RC522 RFID module and a servo motor.
 * When an RFID card is scanned, the servo rotates to 90 degrees. After a 5 
 * second delay, the servo returns to its initial position of 0 degrees.
 */

#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>

#define SS_PIN 10
#define RST_PIN 9
#define SERVO_PIN 3

MFRC522 rfid(SS_PIN, RST_PIN);
Servo myServo;

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();
  myServo.attach(SERVO_PIN);
  myServo.write(90); // Initialize servo to 0 degrees
}

void loop() {
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) {
    return;
  }

  Serial.println("Card detected!");
  myServo.write(0); // Rotate servo to 90 degrees
  delay(5000);       // Wait for 5 seconds
  myServo.write(90);  // Return servo to 0 degrees

  rfid.PICC_HaltA(); // Halt PICC
  rfid.PCD_StopCrypto1(); // Stop encryption on PCD
}

Completed this project?

Get an official Project Completion Certificate with a unique ID & QR verification — perfect for internships, resumes, and college submissions.

Get Certificate →
WhatsApp