Introduction: MFRC522 RFID Reader Interfaced With NodeMCU
Hello Makers,
I'm back with another Instructable.
Did you ever wonder what is an RFID or how does it work?
If you have noticed in an office before, you would be probably aware of those RFID cards or Tags that would unlock specific doors depending on your access.
Well let’s make a simple NodeMCU RFID reader using the MFRC522 module, and program the NodeMCU to provide access when the right card is detected. This simple example will read the serial number on the Card or Tag, display it in the serial monitor.
Step 1: Materials Required
Here is the list of components required to get started with the Instructable,
Hardware Components
- NodeMCU
- MFRC522 RFID Reader
- RFID Tags ( 13.56 MHz )
- Bread Board
- Jumper Wires
- Micro USB Cable
Software Components
- Arduino IDE
Step 2: Description
What's RFID?
Radio-Frequency Identification (RFID) is the use of radio waves to read and capture information stored on a tag attached to an object. A tag can be read from up to several feet away and does not need to be within direct line-of-sight of the reader to be tracked. This is the advantage over Bar-code.
> A RFID reader is a device used to gather information from an RFID tag, which is used to track individual objects. Radio waves are used to transfer data from the tag to a reader.
> A passive tag is an RFID tag that does not contain a battery, the power is supplied by the reader. When radio waves from the reader are encountered by a passive rfid tag, the coiled antenna within the tag forms a magnetic field. The tag draws power from it, energizing the circuits in the tag.
Specifications
- Input voltage: 3.3v
- Frequency: 13.56MHz
That's all guys lets get into Connections & Coding part.
Step 3: Pin Wiring
Check the schematic and pin configuration to make connections.
Caution: You must power this device to 3.3V!
Step 4: Library Download
Before you download library you need Arduino IDE to get started.
To download Arduino IDE and for NodeMCU setup, you can check my previous instructacle.
Interface Servo Motor with NodeMCU
Here’s the library you need for this project:
- Download the RFID library here created by miguelbalboa.
- Unzip the RFID library.
- Install the RFID library in your Arduino IDE.
- Restart your Arduino IDE
Step 5: Reading Data From a RFID Tag
After having the circuit ready
Go to File > Examples > MFRC522 > DumpInfo > Upload the code.
This code will be available in your Arduino IDE (after installing the RFID library).
Then, open the serial monitor. You should see something like the image above.
Write down your UID card ( " Card UID : xx xx xx xx " ) because you’ll need it later.
The next step is to write some code to play with RFID cards.
Download the "RFID_Access.ino" file and open it up in the Arduino IDE.
Then Create a new sketch and paste the code below in the arduino IDE and hit Upload.
You can tinker with it if you like based on the application, or just use it as it is.
Attachments
Step 6: Demonstration
Swipe the card you’ve chosen to give access and you’ll see an access message popup on serial monitor.
If you swipe another tag with another UID, the denial message will pop up.
That's all makers!
I hope you found this instructable most useful.
You can contact me by leaving a comment. If you like this instructable probably you might like my next ones.

Participated in the
Makerspace Contest 2017
2 People Made This Project!
- CFCbazar_com made it!
- CFCbazar_com made it!
22 Comments
Question 1 year ago on Step 3
The pin wiring section 3 has a text list matching the NodeMCU to the MFRC522 but the pictures showing the wiring of the NodeMCU do not use the same pins. Which one is right? The list shows the SDA (SS) connecting to D4 GPIO2 but the pictures shows nothing connected to D4 but wait there's more the ino included in this demo shows the SS is #define SS_PIN 4 //D2 and that's not in the text match list or the picture.
1 year ago
I have tested the code with NODEMCU. It works fine but after some random time period, it gets hanged. I think, RFID module goes into sleep mode. Need code how to auto wakeup the RFID module.
Thanks in advance for suggessions, if any
2 years ago
it is showing nothing on serial monitor..........please help!!!!!!!!!!
3 years ago on Step 6
first try : works fine ! thanks !
4 years ago
FOR me its showing below error,
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v0fd86a07
~ld
Reply 3 years ago
Serial monitor has to be configured at 9600 bauds (and not 115200)
5 years ago
Hi. Im getting following error:
signal: bad system call
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
Please advice.
Reply 3 years ago
Try downloading esp8266 board manager, then select the esp-12e module board,
Question 4 years ago on Step 1
How to add more UID to the same code ??
Question 4 years ago on Step 1
I'm using a Amica NODE Mcu with esp8266E-12 on it but when I do as told here the Serial is empty. When I try the same code on arduino Uno everything is working perfectly
5 years ago
I have tested the code & it works.
The problem was with the connection of SDA, RST. The pin configuration mentioned in the code and the circuit are different, maybe that's why it's not working for most of you all.
To make this project work :
Download the RFID_Access.ino from above.
Upload the code.
Connection of RFID TO NODEMCU.
Conenct SDA(SS) to D2
Connect RST(FLASH ) to D1
Hope this helps.
Reply 4 years ago
Or change the sketch to match the wiring :)
#define RST_PIN D3
#define SS_PIN D4
Reply 4 years ago
Hello, my UID not showing
4 years ago
Great, post!!!! Now how could you add a HTTP POST request to this sketch? Since you are using this on a ESP8266 and most people are getting them because of the WiFi feature.
Question 4 years ago
help me im using node mcu, hve to send from rfid to website
4 years ago
Ok, it works in my case, when you use the file above(i mean RFID_Access.ino), you should change the default values of pins RST and SS. D4, D3 in NodeMCU = Pin 2 and Pin 0 in Adruino software, therefore we have
#define SS_PIN 2 //D4
#define RST_PIN 0 //D3
5 years ago
I did exactely the same but i'm getting this error
Reply 4 years ago
Remember to change the PIN numbers in whatever sketch you are using!
#define RST_PIN D3
#define SS_PIN D4
Question 5 years ago on Introduction
RFID reader is not showing its ID on serial monitor using nodemcu. what should we do?
Question 5 years ago on Introduction
where i can simulate this reader ?