Arduino + MFRC522 RFID READER

21,306

59

15

Introduction: Arduino + MFRC522 RFID READER

Interfacing MFRC522 with Arduino Nano.This is one of my fav topics ever. Playing around with the RFID card reader and the PICCs. For this project
you must have the understanding of the SPI interface. We communicate the RFID reader with our Arduino
over the SPI protocol. The card reader and the tags communicate using a 13.56 Mhz electromagnetic field.
The tags that we will use are the ISO 14443A type. We will use the SPI library which is included in the
Arduino software.

The Chip That is used in the card reader is : https://www.nxp.com/documents/data_sheet/MFRC522.pdf

We will also use the excellent RC522 library from Miguel Balboa.
link: https://github.com/miguelbalboa/rfid

Step 1: Parts Required

You can either use an Arduino Uno or Nano. I use Nano here.

1. MFRC522 Module
2. Arduino
3. N number of tags
4. Breadboard
5. leds
6. jumper cables

Step 2: Hardware Connection

This is standard SPI connection.
Arduino pin no. MFRC522 READER
9 RST
10 SDA(SS)
11 MOSI
12 MISO
13 SCK
3.3V 3.3V
GND GND

Step 3: SOFTWARE

Once we have the connections up its time to write the code. There are many variations of the code available.
Some allow you to dump the UID of the card directly to the serial monitor. The AccessControl example
included in the library is a really good code but it is a bit overkill if you are new to the RC522 so i decided to
write a simpler version of the code. In my version of the code you define the UIDs of the Authorized cards in
the code. So once you burn the code into the arduino you cannot add new cards, however from a beginners
perspective you can learn a lot from this example.
here is the code

Step 4: Working

Ill be uploading a YouTube video tomorrow and will embed it here.

edit : uploaded the video

Be the First to Share

    Recommendations

    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Super-Size Speed Challenge

      Super-Size Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020

    15 Discussions

    0
    zliu34
    zliu34

    1 year ago

    Thanks for sharing! Can the chip read RFID tags? or just cards?

    0
    sbx20
    sbx20

    Reply 1 year ago

    It read both of them.

    0
    Dr. AhmedS
    Dr. AhmedS

    2 years ago

    Nice explanation and details.

    0
    NageshB8
    NageshB8

    Question 2 years ago

    i have one question , how to write tag details in that,, in this it able to read tag but unauthorized k, how to give authoried and unauthoried

    0
    SanjanaS24
    SanjanaS24

    Question 2 years ago

    Is this RFID tag reader reprogrammable? If not this, can you suggest any rfid reader which is reprogrammable?

    0
    JoshW136
    JoshW136

    3 years ago

    Hi, I am having trouble, when I am scanning the tags they are not showing up on the serial monitor? I don't think the scanner is detecting the cards?

    0
    sbx20
    sbx20

    Reply 3 years ago

    Please check the SPI connections. If they are correct maybe the module is not working. Also select the correct com port.

    0
    patrik_bajusz
    patrik_bajusz

    3 years ago

    Could you post the code here?
    Thanks

    0
    sbx20
    sbx20

    Reply 3 years ago

    i had added the code previously but i dont know why it disappeared from here. I have added it again in the software step.

    0
    JasonG101
    JasonG101

    3 years ago

    ah i have to wait :) mine was just pass aust date/time snd i see mine commend date stamp is different timezone. sorry mine was early.

    0
    sbx20
    sbx20

    Reply 3 years ago

    np :)

    0
    JasonG101
    JasonG101

    3 years ago

    where video it already next day

    0
    DIY Hacks and How Tos

    This is really cool. I always wanted to try out RFID with some of my Arduino projects. I can think of so many ways that it would be useful.

    0
    sbx20
    sbx20

    Reply 3 years ago

    im going to use a stepper to open/close a door latch. will post it soon.