Project showcase
RFID Identification With LEDs

RFID Identification With LEDs © CC BY-NC-ND

A RFID module connected to two LEDs.

  • 13,641 views
  • 6 comments
  • 46 respects

Components and supplies

Apps and online services

About this project

Hello! My name is Matei, I'm eleven years old and this is my first project. I'm a beginner and I love the Arduino! This is a project for beginners like myself! :)

When the RFID-RC522 scans the card, the card's key will appear in the serial monitor. And if the NFC card is accepted, the green LED will be on, and if the card is not accepted, the red LED will be on.

This is the library for the project : https://github.com/miguelbalboa/rfid

If you like this project, follow me and respect the project!

Donations: https://www.paypal.me/princematthew ( support is really appreciated😃)

Code

RFID with LEDs C/C++
#include "SPI.h"
#include "MFRC522.h"

#define SS_PIN 10
#define RST_PIN 9
#define LED_PIN A0 
#define LED_PIN A1

MFRC522 rfid(SS_PIN, RST_PIN);

MFRC522::MIFARE_Key key;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  Serial.println("I am waiting for card...");
}

void loop() {
  // put your main code here, to run repeatedly:
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial())
    return;

  // Serial.print(F("PICC type: "));
  MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak);
  // Serial.println(rfid.PICC_GetTypeName(piccType));

  // Check is the PICC of Classic MIFARE type
  if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI &&
      piccType != MFRC522::PICC_TYPE_MIFARE_1K &&
      piccType != MFRC522::PICC_TYPE_MIFARE_4K) {
    Serial.println(F("Your tag is not of type MIFARE Classic."));
    return;
  }
  String strID = "";
  for (byte i = 0; i < 4; i++) {
    strID +=
      (rfid.uid.uidByte[i] < 0x10 ? "0" : "") +
      String(rfid.uid.uidByte[i], HEX) +
      (i != 3 ? ":" : "");
  }

  strID.toUpperCase();
  Serial.print("Tap card key: ");
  Serial.println(strID);
  delay(1000);

  if (strID.indexOf("20:CC:6F:85") >= 0) {  //put your own tap card key;
    Serial.println("********************");
    Serial.println("**Authorised acces**");
    Serial.println("********************");
    digitalWrite(A0, HIGH);
    delay (5000);
    digitalWrite(A0, LOW);
    return;
  }
  else {
    Serial.println("****************");
    Serial.println("**Acces denied**");
    Serial.println("****************");
    digitalWrite(A1, HIGH);
    delay (5000);
    digitalWrite(A1, LOW);
    return;
  }
  
}

Schematics

RFID-RC522 WITH LEDs
rfid-rc522_with_leds_PJyl6FiRbc.fzz

Comments

Similar projects you might like

DHT11 Sensor with LEDs and a Piezo Speaker

Project tutorial by Tech with Matthew

  • 6,167 views
  • 3 comments
  • 19 respects

Blinking LEDs with Arduino

Project tutorial by Super Kid

  • 2,357 views
  • 2 comments
  • 13 respects

Security Access Using RFID Reader

by Aritro Mukherjee

  • 260,393 views
  • 42 comments
  • 281 respects

RFID Based Automatic Door System

Project showcase by Robodia Technology

  • 35,766 views
  • 20 comments
  • 97 respects

RFID Badge Scanner with LCD

by Josh From BreakoutBros.com

  • 13,170 views
  • 3 comments
  • 31 respects

Arduino Ethernet Rfid card reader

Project tutorial by David Smerkous

  • 30,699 views
  • 15 comments
  • 50 respects
Add projectSign up / Login