WiFi RFID Reader





Introduction: WiFi RFID Reader

The main idea was to read in 13.56 MHz RFID (tags / tokes / stickers / wristbands / cards) by a magic box and post the RFID UID to a local database by WiFi network.

This instructable builds the base of the whole system - the first working RFID reader on ESP8266 WiFi SoC. (many thanks to nikxha from the ESP8266 forum for the initial help)

Step 1: Requirements

You have to install the Arduino IDE 1.6.4. or 1.6.5.

  • Arduino > Preferences > "Additional Boards Manager URLs:" and add: http://arduino.esp8266.com/package_esp8266com_index.json
  • Arduino > Tools > Board > Boards Manager > type in ESP8266 and install the board
  • download MFRC522 module (see Libraries) and copy folder to Arduino library path


Step 2: Wiring RFID RC522 Module

wiring the MFRC522 to ESP8266 (ESP-12)
(please use wiring below instead of diagram above)

RST = GPIO05 (free GPIO)
SS = GPIO4 (free GPIO)
3.3V = 3.3V

Step 3: Software

define RFID module

#include "MFRC522.h"
#define RST_PIN 15 // RST-PIN for RC522 - RFID - SPI - Modul GPIO15 
#define SS_PIN 2 // SDA-PIN for RC522 - RFID - SPI - Modul GPIO2
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance

Initialize RFID module

void setup() {
Serial.begin(9600); // Initialize serial communications
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522

Read RFID tag

void loop() { 
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
// Show some details of the PICC (that is: the tag/card)
Serial.print(F("Card UID:"));
dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);
} // Helper routine to dump a byte array as hex values to Serial
void dump_byte_array(byte *buffer, byte bufferSize) {
for (byte i = 0; i < bufferSize; i++) {
Serial.print(buffer[i] < 0x10 ? " 0" : " ");
Serial.print(buffer[i], HEX);

Step 4: Final Steps ...

As I wrote at the beginn of this short instructable, this is just the base.
But you can make many funny projects by using this hard and software.

For my next project I'm using not only the RFID module (SPI), I will use a small OLED display (I2C), and toggle button.
The boxes are fully self configurable by one master RFID card.
There is also a webinterface to manage all boxes and add some topics, tags and description.

If I'm finished the project, I will upload it to instructables - so stay tuned.
There will be also a link here to the new tutorial.

3 People Made This Project!


  • Epilog Challenge 9

    Epilog Challenge 9
  • Paper Contest 2018

    Paper Contest 2018
  • Science of Cooking

    Science of Cooking

We have a be nice policy.
Please be positive and constructive.


1 Questions

Can i use this same setup to send data to a database? If not so could you update me on that?

You can send the read data to what destination you want.
My example is just how you can read in the UID.
But there are thousands of examples out there how to send data from ESP8266 to cloud or database. Just spend a little effort to find the correct ones. I'm really busy these days and do not have the time to create new examples...


So you're setup can't be used to send data to the database?
And if I understand correctly, you're setup is used to read uid using the esp8266-01 as board. Yes?
I am sorry if I am asking irrelevant questions cause I am a newbie into this..

Thanks for the great tutorial. I have a quick question... with the RC522 plugged in, I can successfully read and write to a card, but the WiFi becomes incredibly slow and unstable (takes minutes to connect to network, can't connect to a host or make HTTP requests). When I remove the RC522, however, the WiFi connects almost instantly and makes requests very quickly. Do you know what might cause this problem? Maybe the RC522 needs a separate power supply?

Hi Anthony, your idea to use more power is a good one. The RFID module do not use much, but can drain to much power from the RF module of the ESP.
It can also be a to high poll interval of the rfid module inside your loop.
Reading card can take some "time" and if you polling to fast inside the loop, the WIFI handling can be dropped down.

Thanks for your response. I was able to get it to work by connecting the RC522's 3V3 and GND pins to another "dummy" ESP-12E and connecting them to a separate USB power source, and leaving the other pins connected to the first ESP-12E (and leaving it connected to the first USB power source).

But now I'm confused because no one else seems to have had this problem. I have plenty of delays in my loops and have also tried several USB cords. I also tried swapping out the original ESP-12E board altogether to see if it was faulty, but it wasn't.

Would you mind pointing me in the right direction for how to do this without the "dummy" ESP8266? I assume I can have one USB cord or wall wart go to something that splits the power, so that the ESP8266 is not responsible for powering the RC522. But I don't know what to search for.

using delay on ESP8266 is a really bad idea, because it can force to fire the watchdog and reboot.
If you want to "pause" or poll only every x times - just use millis like in this post:

Hi Jorgen,

I'm looking for a similar technology and I need your help. How do I contact you ?

pin connections for esp8266-01????

It only has two IO pins available in addition of RX/TX. You can drive I2C, but not HW SPI as far as I know. Maybe you can use the PN532 module (it has also I2C interface)