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

Arduino Nano RFID Access Control with Servo and Buzzer Notification

View and Edit Project In Cirkit DesignerImage of Arduino Nano RFID Access Control with Servo and Buzzer Notification

Circuit Documentation

Summary

The circuit in question is designed to interface an Arduino Nano with an RFID-RC522 module, a Tower Pro SG90 servo motor, a piezo buzzer, and a green LED. The purpose of the circuit is to detect RFID tags, actuate a servo, and provide audio-visual feedback upon successful tag detection. The Arduino Nano serves as the central processing unit, controlling the RFID reader for tag detection, driving the servo motor to a specific position, and triggering the buzzer and LED to indicate the detection event.

Component List

Arduino Nano

RFID-RC522

Tower Pro SG90 Servo

Piezo Buzzer

LED: Two Pin (green)

Wiring Details

Arduino Nano

RFID-RC522

Tower Pro SG90 Servo

Piezo Buzzer

LED: Two Pin (green)

Documented Code

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

#define SS_PIN 10
#define RST_PIN 9
MFRC522 rfid(SS_PIN, RST_PIN);

Servo myServo;
int buzzerPin = 7;

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();
  
  myServo.attach(3);
  pinMode(buzzerPin, OUTPUT);

  Serial.println("Ready to Scan!");
}

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

  Serial.println("Card detected!");
  
  String cardUID = "";
  for (byte i = 0; i < rfid.uid.size; i++) {
    cardUID += String(rfid.uid.uidByte[i], HEX);
  }

  Serial.print("DATA,TIME,");
  Serial.print(cardUID);
  Serial.println(",Accepted");

  digitalWrite(buzzerPin, HIGH);
  delay(100);
  digitalWrite(buzzerPin, LOW);

  myServo.write(90);
  delay(2000);
  myServo.write(0);

  rfid.PICC_HaltA();
}

Code Explanation