Arduino RFID Reader / MFRC522 Turorial

146,214

483

59

Intro: 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

Share

Recommendations

  • Tiny Home Contest

    Tiny Home Contest
  • Metalworking Contest

    Metalworking Contest
  • Furniture Contest 2018

    Furniture Contest 2018

59 Discussions

0
None
DeanRogers

Tip 5 months ago

When using multiple cards, the sizeof(cards) function does not give the number of 'rows' in the array, which somehow allows any RFID serial number to be allowed. If you change 'sizeof(cards)' in the loop to '(sizeof(cards)/sizeof(cards[0]))' it works fine.

0
None
Nilanjana_chatterjee

Question 7 months ago on Step 3

I've set my card and card has a specific number.okay. But how through that card specific data can be fetched from database? I'm very new to this so please tell me someone

0
None
awe070707

8 months ago

hi friend..if i need add 5 rfid card , what should i do?

i arduino beginner hehehe..

0
None
hetlabrotterdam

10 months ago

Your instruction made me think twice about what I had done earlier. Works fine now. Thanks. Got a more complex .ino working soon afterwards.

1 reply
0
None
mercer493

1 year ago

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? :)

1 reply
0
None
weshan

11 months ago

Hey.. Thank u very much for ur helping. It is very helpful for me

1 reply
0
None
Robbie1155.

1 year ago

Hey,

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

0
None
Ehsan Balouch

1 year ago

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.

0
None
AbishekK5

1 year ago

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

1 reply
0
None
SoonchengAbishekK5

Reply 1 year ago

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.

0
None
GavinM28Robert 7320

Reply 1 year ago

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
...
};

0
None
KaenyI

1 year ago

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?