Introduction: Arduino RFID Reader / MFRC522 Turorial

This is an simple tutorial for beginner on how to use a MFRC522 module using Arduino

Remarks* I apologize for my english's grammar because i am a chinese :)



Step 1: Collecting Parts and Programs

In this project, you needed these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.MFRC522 module

3.Arduino IDE ( you can download it from here https://www.arduino.cc/en/Main/Software )

4.5V relay (not necessary)

5.TIP31 transistor (not needed if you didn't use the 5V relay)

6.Jumper cables

7.LEDs

Programs :

You will need the RFID library and the programs which you can download from the file that i attached . If you don't know how to add a library , here's the link https://www.arduino.cc/en/Guide/Libraries

Step 2: Connecting the Component

Connect the pins with following :

- MOSI ---> PIN 11

- MISO ---> PIN 12

- SCK ---> PIN 13

- SS/SDA ---> PIN 10

- RST ---> PIN 9

- LED ---> PIN 7 & GND

- Relay / Output power ---> VCC connect to 5V pins and the collector pin of the TIP31

- GND connect to GND pins,

- IN connect to emitter pin of TIP31

- Pin 8 is connected to the base pin of the TIP31

*Ways to connect the led and relay is shown on the image above ( i didn't connect the arduino with the mfrc522 module because i didn't know how to make it , so just follow the text above to connect them)

*Double check before you connect your arduino with your computer , the wrong connection could damage your arduino

Step 3: Setting Up for Your Card

First:

Plug your arduino into your computer and select the correct board and com, then verify and upload your sketch

Second:

Open up serial monitor and set your baud to 9600 baud

Third:

Scan your card , your should saw a bunch of numbers pop out

Last:

Copy only the number and paste it to the column after "int cards[][5] = { (replace the space with ',' as shown in the image above, in my case, my card is 5 117 21 219 190 )

You're Done !

Pls comment if you spot any mistake of my instructables or any question to ask me

Comments

author
mercer493 (author)2017-08-04

What do you mean by "Setting Up Your Card"? I run the code and place the card over the reader and nothing is being output to the monitor. :/

Also, would this program work with RFID tags as well? :)

author
Robbie1155. (author)2017-07-14

Hey,

I was wondering if some one could post the code to have 10 RFID cads and tags

author
Ehsan Balouch (author)2017-05-18

Hi,

Please help to provide Arduino card to use more than one RFID cards and tags or at least Master and standard tag provided with the kit.

Thanks.

author
AbishekK5 (author)2017-05-11

Hi,I was wondering if I could change the pin values for all the pins as I have already used up most of the pins for other sensors? Thanks in advance

author
Sooncheng (author)AbishekK52017-05-14

For things i know , you can't. I would recommend you to change the sensor's pin. I'll do futher research. Sorry can't help here.

author
MasterA12 (author)2017-04-17

Is works for HID type cards?

author
Sooncheng (author)MasterA122017-04-24

not sure about it, sry

author
Robert 7320 (author)2016-09-19

how can i make this so i can use two or more cards ?

author
GavinM28 (author)Robert 73202016-10-03

Go to the lines where you want to enter your card numbers, and just include more card numbers:


int cards[][5] = {
{5,117,21,219,190}, //Card 1
{181, 2, 398, 810, 193} //Card 2
...
};

author
Sooncheng (author)GavinM282017-04-24

thanks!

author
KaenyI (author)2017-02-11

I saw on the first page that you do not need the relay or the transistor. What is the difference in instructions and outcome if i choose not to use the relay and transistor?

author
Sooncheng (author)KaenyI2017-03-22

Of course you can choose not to use a relay / transistor. I used it because the power output of the Arduino is too small, so i used a relay/transistor to supply a greater power to the things i want to use. Hope this helps !

author
mithunbabbira (author)2017-01-09

there is problem in connection between rfid reader and ardunio. ..plz help me i tried with 2 new readers with many other ways ...but still dint figure it out plz help me ..i have to submit my project within few days and i am out of option here

author
Sooncheng (author)mithunbabbira2017-03-22

I'm Sorry that i couln't help.. i am beginner of Arduino..

author
gunawan eko (author)2016-10-19

thanks for make this,,,

its very greatful...

author
Sooncheng (author)gunawan eko2017-03-22

You're Very Welcome !

author
a1m918 made it! (author)2016-12-11

I made it ^_^

Thanks for a such a nice tutorial !
(Sorry for not posting the images/pictures because I made it to move further so I disassembled it :) )

25834f8.jpg
author
MuhammadH268 (author)a1m9182016-12-14

(Y)

author
Sooncheng (author)MuhammadH2682017-03-22

(Y)(Y)(Y)

author
Sooncheng (author)a1m9182017-03-22

Great ! Good Day !

author
Boxoffrogs (author)2017-01-16

Excellent, thank you so much!

author
Sooncheng (author)Boxoffrogs2017-03-22

You're Welcome

author
OmkarT3 (author)2016-09-07

Pin 9,10 voltage is more than 4v and MFRC522 max working voltage 3.3v so may be it can damage MFRC522 module?

author
i_sharma (author)OmkarT32017-03-05

You can use logical level shifter . May be this would help you.

author
Sooncheng (author)OmkarT32016-09-13

you can make a circuit to lower down the voltage

author
GeraldS48 (author)2016-10-06

Has anyone tried this with the UNO R3 with WiFi. The application would be to read the card ID and send the transaction via Web/Cloud?

author
JMorton3 (author)2016-06-16

I am just starting to learn RFID - specifically using the MFRC522 and 13.56MHz tags. I have a question - is it possible to read a certain block only? The reason I ask is this - I am trying to make a game involving around 8 pieces, with each having an RFID tag embedded in it. I will be making several duplicates of each piece in case they are stolen or dropped and broken. If I could read a specific block, then I could write the playing piece number to that block in each of the duplicates, and have the Arduino read that specific block to confirm which playing piece has been positioned. Is this possible? This way I would only need to keep a list of 8 piece numbers, not 32 numbers (if I made 3 duplicates of each of the original pieces).

author
Sooncheng (author)JMorton32016-09-13

hmm.. i am not sure about it , try playing with the code

author
DrewW14 (author)2016-06-05

How do I use two cards at once?

author
Sooncheng (author)DrewW142016-09-13

hmm.. i will try it out

author
curiosity36 (author)2016-06-29

Thank you sir for the most simple RFID example. Works for me.

author
Sooncheng (author)curiosity362016-09-13

welcome good day !

author
pkjær (author)2016-06-19

GREAT INSTRUCTABLES!!
Question....

Is it possible to read NFC chips with this RFID reader? I have hooked it all up and it reads some RFID chips fine, but others not, thinking there is a difference between NFC and RFID. So is it possible

author
Sooncheng (author)pkjær2016-09-13

i am not sure about it , you can try it out

author
BloodyK1 (author)2016-03-16

I just Registered to instructables just to thank You for the code and library, and add one line if(access){

// Serial.println("Welcome!");

digitalWrite(power, LOW);

delay(500);

digitalWrite(power, HIGH);

access = false; // This line

Becouse if access is granted some times unregistered ID card unlocked the relay so after granting access it disables it to unable unlocking by other cards

author
Sooncheng (author)BloodyK12016-09-13

ok thanks !

author
gusm3 (author)2016-03-15

i want to ask ,if i want to read block 4 ,where i must to add listing program
thank's

author
Alpha 23 (author)2015-11-03

Would you know how to use the mgrc522 module to copy the iOS from a tag and write it to another one all in one code

author
gtoal (author)Alpha 232015-11-03

I think what you are looking for is an RFID Emulator. Fairly sure these cards are hard-wired and can't be reprogrammed in software. What's your application that you want to reprogram cards for?

author
benny_boost (author)gtoal2016-02-22

4 months and he is still thinking of a legit excuse.... hows i keep losing my work swipe card and would feel like james bond if i made my own copy :-D

author
BadrA2 (author)2016-01-10

thaaaaaaaaaaaaaaaaaaaaanx a lot

author
CarloL4 (author)2015-12-01

Where should i buy this RFID Reader / MFRC522?

author
ZakariyeA (author)CarloL42016-01-01

ebay and its cost only 4 $

author
bgsdika (author)2016-01-01

Thx! Simple and easy to modify :)

author
TheKirkwoods (author)2015-11-05

We'll put together! I'll try this, thank you.

author
Sooncheng (author)TheKirkwoods2015-12-07

you are welcome

author
Elecrow (author)2015-11-09

Great tutorial

author
Sooncheng (author)Elecrow2015-12-07

Thanks

author
PhamA1 (author)2015-11-12

hello sir :) i have a problem with scanning my card. i don't know why too but i'm follow exactly what you did

author
Sooncheng (author)PhamA12015-11-16

hi PhamA1 , try using another rfid reader or try to change the code (eg.changing the baud value) , double check to see wheter the connection is corret or not , it should works well :)

About This Instructable

101,083views

466favorites

License:

More by Sooncheng:Servo Modification for Continuous Turning (Simple)Dog's Computer !L293D motors controller module / tutorial
Add instructable to: