Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO RFID Access Control with Servo Lock and LCD Feedback

Image of Arduino UNO RFID Access Control with Servo Lock and LCD Feedback

Circuit Documentation

Summary

This circuit integrates an Arduino UNO microcontroller with an RFID-RC522 module, a servo motor, and an LCD I2C display. The Arduino UNO serves as the central processing unit, controlling the RFID reader for scanning tags, driving the servo motor, and displaying information on the LCD. The RFID-RC522 module is used for reading RFID tags, the servo motor is controlled based on the RFID scans, and the LCD display provides a user interface to display the scanned tag's UID.

Component List

Arduino UNO

  • Microcontroller board based on the ATmega328P
  • It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.

RFID-RC522

  • An RFID reader/writer module that operates at 13.56 MHz
  • It is commonly used for near-field communication (NFC) or RFID systems.

Servo

  • An actuator that can be precisely controlled for angular rotation
  • It has three connections: power (VCC), ground (GND), and control signal (pulse).

LCD I2C Display

  • A liquid crystal display that uses the I2C bus for communication
  • It requires only two data lines (SDA and SCL) for communication, which simplifies the wiring.

Wiring Details

Arduino UNO

  • 3.3V connected to RFID-RC522 VCC (3.3V)
  • 5V connected to Servo VCC and LCD I2C Display SDA
  • GND connected to RFID-RC522 GND, Servo GND, and LCD I2C Display SCL
  • A4 connected to LCD I2C Display VCC
  • A5 connected to LCD I2C Display GND
  • D13 connected to RFID-RC522 SCK
  • D12 connected to RFID-RC522 MISO
  • D11 connected to RFID-RC522 MOSI
  • D10 connected to RFID-RC522 SDA
  • D9 connected to RFID-RC522 RST
  • D3 connected to Servo pulse

RFID-RC522

  • VCC (3.3V) connected to Arduino UNO 3.3V
  • RST connected to Arduino UNO D9
  • GND connected to Arduino UNO GND
  • IRQ (Not connected)
  • MISO connected to Arduino UNO D12
  • MOSI connected to Arduino UNO D11
  • SCK connected to Arduino UNO D13
  • SDA connected to Arduino UNO D10

Servo

  • vcc connected to Arduino UNO 5V
  • gnd connected to Arduino UNO GND
  • pulse connected to Arduino UNO D3

LCD I2C Display

  • GND connected to Arduino UNO A5
  • VCC connected to Arduino UNO A4
  • SDA connected to Arduino UNO 5V
  • SCL connected to Arduino UNO GND

Documented Code

/*RFID tag scan code
 * https://srituhobby.com
 */
 
#include <LiquidCrystal_I2C.h>
#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN 9
#define SS_PIN  10
byte readCard[4];
byte a = 0;

LiquidCrystal_I2C lcd(0x27, 16, 2);
MFRC522 mfrc522(SS_PIN, RST_PIN);

void setup() {
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
  while (!Serial);
  SPI.begin();
  mfrc522.PCD_Init();
  delay(4);
  mfrc522.PCD_DumpVersionToSerial();
  lcd.setCursor(2, 0);
  lcd.print("Put your card");
}

void loop() {
  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    return 0;
  }
  if ( ! mfrc522.PICC_ReadCardSerial()) {
    return 0;
  }

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Scanned UID");
  a = 0;
  Serial.println(F("Scanned PICC's UID:"));
  for ( uint8_t i = 0; i < 4; i++) {  //
    readCard[i] = mfrc522.uid.uidByte[i];
    Serial.print(readCard[i], HEX);
    Serial.print(" ");
    lcd.setCursor(a, 1);
    lcd.print(readCard[i], HEX);
    lcd.print(" ");
    delay(500);
    a += 3;
  }
  Serial.println("");
  mfrc522.PICC_HaltA();
  return 1;
}

This code is designed to run on the Arduino UNO and uses the RFID-RC522 module to scan RFID tags. When a tag is scanned, its UID is displayed on the LCD and printed to the serial monitor. The LiquidCrystal_I2C library is used to control the LCD display via the I2C bus, and the MFRC522 library is used to interface with the RFID module. The code initializes the RFID reader and the LCD display in the setup() function and continuously checks for new RFID tags in the loop() function. When a tag is detected, its UID is read, displayed, and printed.