Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO RFID Access Control System with Servo, RGB LED, Buzzer, and LCD Feedback

View and Edit Project In Cirkit DesignerImage of Arduino UNO RFID Access Control System with Servo, RGB LED, Buzzer, and LCD Feedback

Circuit Documentation

Summary of the Circuit

This circuit is designed to interface with multiple peripherals including an RFID reader, an RGB LED, a piezo buzzer, a servo motor, and an LCD display. The central controller of the circuit is an Arduino UNO microcontroller which communicates with the peripherals to perform specific actions when an RFID card is detected. The RFID reader scans for cards and upon successful detection of a pre-programmed card, the RGB LED lights up in green, the servo motor actuates, and the LCD display shows the message "Accessed". If an incorrect card is detected, the RGB LED turns red and the piezo buzzer emits a tone.

Component List

Arduino UNO

A microcontroller board based on the ATmega328P. It has digital input/output pins, analog inputs, a USB connection for programming the board, a power jack, an ICSP header, and a reset button.

Piezo Buzzer

An electronic device that produces a tone or sound when an electrical signal is applied. It is typically used for audible alerts or alarms.

KY-016 RGB LED

A multicolor light-emitting diode that can produce different colors based on the combination of red, green, and blue light.

RFID-RC522

An RFID reader/writer module that operates at 13.56 MHz. It is commonly used for contactless communication and identification.

LCD Display 16x4 I2C

A liquid crystal display that can show up to 16 characters per line across 4 lines. It uses the I2C protocol for communication, which reduces the number of pins needed for interfacing.

Servo (Wokwi Compatible)

An actuator that can be precisely controlled for position. It is commonly used in robotics for controlling mechanisms like arms, legs, or steering systems.

Wiring Details

Arduino UNO

Piezo Buzzer

KY-016 RGB LED

RFID-RC522

LCD Display 16x4 I2C

Servo (Wokwi Compatible)

Documented Code

/*
 * This Arduino sketch interfaces with an RFID reader, an RGB LED, a piezo buzzer,
 * a servo motor, and an LCD display. When the correct RFID card is read, the
 * green LED lights up, the servo motor moves, and the LCD displays 'Accessed'.
 */

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

#define SS_PIN 10
#define RST_PIN 9
#define SERVO_PIN 2
#define BUZZER_PIN 1
#define RED_PIN 3
#define GREEN_PIN 4
#define BLUE_PIN 5

LiquidCrystal_I2C lcd(0x27, 16, 4);
Servo myservo;
MFRC522 rfid(SS_PIN, RST_PIN);

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();
  lcd.begin();
  lcd.backlight();
  myservo.attach(SERVO_PIN);
  pinMode(BUZZER_PIN, OUTPUT);
  pinMode(RED_PIN, OUTPUT);
  pinMode(GREEN_PIN, OUTPUT);
  pinMode(BLUE_PIN, OUTPUT);
  digitalWrite(RED_PIN, LOW);
  digitalWrite(GREEN_PIN, LOW);
  digitalWrite(BLUE_PIN, LOW);
}

void loop() {
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) {
    return;
  }
  String cardID = "";
  for (byte i = 0; i < rfid.uid.size; i++) {
    cardID += String(rfid.uid.uidByte[i], HEX);
  }
  if (cardID == "your_card_id_here") {
    digitalWrite(GREEN_PIN, HIGH);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Accessed");
    myservo.write(90);
    delay(2000);
    digitalWrite(GREEN_PIN, LOW);
    myservo.write(0);
  } else {
    digitalWrite(RED_PIN, HIGH);
    tone(BUZZER_PIN, 1000, 500);
    delay(500);
    digitalWrite(RED_PIN, LOW);
  }
  rfid.PICC_HaltA();
  rfid.PCD_StopCrypto1();
}

This code is designed to be uploaded to the Arduino UNO microcontroller. It initializes the connected devices and sets up the main loop to check for RFID card presence, read the card ID, and perform actions based on the card detected. The code uses libraries for the LCD (LiquidCrystal_I2C), servo motor (Servo), and RFID reader (MFRC522). The defined pin constants correspond to the wiring details provided earlier.