Skip to content

Quick guide to wire and use the RC522 RFID module with Arduino

 

Hello everybody and welcome to this quick tutorial, today we gonna use a Mifare RC522 RFID module with an Arduino Uno and an optional LCD i2c screen.

IMPORTANT: Don’t forget that the module is powred with 3.3v from Arduino and you can use the other pins normally but for better use, you should use a level shifter (5v to 3.3v) to not damage the component over time. I didn’t know about this so my RC522 is kinda broken, I couldn’t use it the proper way.

In case it’s your first time using LCD i2c Screen here’s a tutorial: Arduino LCD I2C simple use and direct write from serial monitor




The RFID-RC522 will permit you to read RFID Tags, identify their IDs, you can use it in door lock projects, garages, safes…. For the tags there are two types, here I only used one as shown in the video, it’s not” re-writable”, it has a fix ID. There are other versions that are re-writable which means you can modify the Tag data, and it could be very interesting project in case you want to make a credit system to grant access for only few times… or store data.

This is not a tutorial that I’m proud of, now I check after couple of years it needs a revisit, and a proper project, but this will get you started and push through your school project as I did before.

Wiring:

This wiring will do the work but won’t last for long, as I had trouble using a dodgy version of a level shifter. The LCD i²c screen is optional.

The wiring, but it won’t last for long time usage

For better use as mentioned you should wire the pins from the module with a level shifter then with the Arduino Uno.

As you can see it’s technically pretty simple to use, I’ll try one when I receive it. You have HV pins for High voltage (5v) from Arduino and LV pins for low Voltage for the Module.


Libraries

You’ll need the RFID library, this is the one I used to not confuse you: Download here, but you can use some other ones that are better like MFRC522…
If you’re using LCD i²c you’ll need a library also: Download here.

Codes:

The first code is a simple reading of the TAG’s code, every TAG has its “own” code, and it displays it on the serial monitor and the LCD if wired as well.

Code 1:



Code 2:

The second code I didn’t use it on camera, because the module barely worked on the first one, so the second code is for giving access to cards or not, you should use the first code to know the cards ID then add them on the code.

Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

4 thoughts on “Quick guide to wire and use the RC522 RFID module with Arduino Leave a comment

  1. Hello , i want to ask . What is the function int serNum[5]; ,int cards[][5] = {35,231,84,0,144}. If you dont mind, can u explain it more detail.Thank you

    • Those are arrays to store the RFID Tag Id, the one with numbers is already registered and we compare it with the one used with module using functions that use the serNum array.

Leave a Reply

%d bloggers like this: