Skip to content

4.3.3. RFID Automated Garage Barrier System

| Description In Project 123, learners will build an expert wireless and automation system titled 'RFID Automated Garage Barrier System'. This manual details the synthesis of RFID RC522 + Servo Motor SG90 + IIC 1602 LCD + Traffic Light Module into an industrial IoT automation solution.|------------------|----------------------------------------------------------------| | Use case |This project connects to real-world industrial and IoT applications such as: Project 123 provides master-level competency in wireless communication, industrial IoT architecture, and automated system integration.|

Components (Things You will need)

Arduino Uno Arduino USB Cable Bread Board Jumper Wires LCD Display Servo Motor Relay Module Real Time Clock RFID Reader

Building the circuit

Things Needed:

  • Arduino Uno Core Board = 1
  • RFID RC522 = 1
  • Servo Motor SG90 = 1
  • IIC 1602 LCD = 1
  • USB Cable & Jumper Wires = 1
  • Bread Board
  • Relay Module
  • Real Time Clock

Mounting the component on the breadboard and wiring the circuit

Step 1: Inventory all modules listed in the Required Components table.

Step 2: Connect line [Wireless / RTC / RFID Bus] to [UART / SPI / I2C Pins] — (Primary telemetry and security bus.).

Step 3: Connect line [Control & Actuator Lines] to [Digital / PWM Pins] — (Relay, motor, and display driver bus.).

Step 4: Connect line [Power Rails] to [5V / 3.3V / GND] — (System power and ground rails.).

Step 5: Double-check all VCC, 5V, 3.3V, and GND polarities to prevent electrical shorts.

Step 6: Connect USB programming cable only after verifying all signal path wiring.

Components on breadboard

Make sure to connect the Arduino USB cable to the Arduino board.

PROGRAMMING

Step 1: Open your Arduino IDE. See how to set up here: Getting Started.

Step 2: Write the complete program implementing the system logic with appropriate pin definitions, setup configuration, and the main control loop.

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

// Pin Definitions
#define SS_PIN 10
#define RST_PIN 9
#define SERVO_PIN 6 // Adjust based on your specific PWM pin connection

MFRC522 mfrc522(SS_PIN, RST_PIN);
Servo garageServo;
LiquidCrystal_I2C lcd(0x27, 16, 2); // Verify your I2C address (often 0x27 or 0x3F)

void setup() {
  Serial.begin(9600);
  SPI.begin();
  mfrc522.PCD_Init();
  garageServo.attach(SERVO_PIN);
  garageServo.write(0); // Initial barrier closed position

  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Garage System");
  lcd.setCursor(0, 1);
  lcd.print("Ready...");

  Serial.println("Project 123: RFID Automated Garage Barrier System Online");
}

void loop() {
  // Look for new cards
  if (!mfrc522.PICC_IsNewCardPresent()) return;
  if (!mfrc522.PICC_ReadCardSerial()) return;

  // Show UID on Serial Monitor
  Serial.print("UID tag :");
  String content= "";
  for (byte i = 0; i < mfrc522.uid.size; i++) {
     content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  content.toUpperCase();

  // Authentication Logic
  if (content.substring(1) == "YOUR_TAG_UID_HERE") { // Replace with your tag's UID
    lcd.clear();
    lcd.print("Access Granted");
    garageServo.write(90); // Open barrier
    delay(3000); // Keep open for 3 seconds
    garageServo.write(0);  // Close barrier
    lcd.clear();
    lcd.print("Garage System");
  } else {
    lcd.clear();
    lcd.print("Access Denied");
    delay(2000);
    lcd.clear();
    lcd.print("Garage System");
  }
}

Step 7: Save your code. See the Getting Started section

Step 8: Select the arduino board and port See the Getting Started section:Selecting Arduino Board Type and Uploading your code.

Step 9: Upload your code. See the Getting Started section:Selecting Arduino Board Type and Uploading your code

CONCLUSION

The system processes telemetry signals and security credentials in real time, driving relays, motors, and displays reliably.