MFRC522 RC522 RFID on ESP8266 featuring WebSocket JSON JavaScript

ESP-RFID Access Control with ESP8266

Access Control demonstration using a cheap RC522 RFID Hardware and Espressif's ESP8266 Microcontroller.


  • Using WebSocket protocol to exchange data between Hardware and Web Browser
  • Data is encoded as JSON object
  • Records are Timestamped (Time synced from a NTP Server)
  • Bootstrap for beautiful Web Pages
  • Built-in HTML Editor
  • Thanks to ESPAsyncWebServer Library communication is Asyncronous

Join the development at github GitHub - esprfid/esp-rfid: ESP8266 RFID (RC522, PN532, Wiegand, RDM6300) Access Control system featuring WebSocket, JSON, NTP Client, Javascript, SPIFFS. Pull Requests are welcomed.


  • Serve pre-compiled binaries
  • Logging access
  • Password Protection or Authentication for Tags instead trusting UID
  • Settings Panel for Wi-Fi, PICC Password, Factory Reset, NTP Client, etc
  • Schedule User Access
  • Polished web pages
  • Sync Time from Browser if no internet connection
  • Use Sming Framework for Development

Getting Started

Please install Arduino IDE if you don't already, then add ESP8266 Core on top of it. Additional Library download links are listed below:

  • Arduino IDE - The development IDE
  • ESP8266 Core for Arduino IDE - ESP8266 Core
  • ESPAsyncWebServer - Asyncrone Web Server with WebSocket Plug-in
  • ESPAsyncTCP - Mandatory for ESPAsyncWebServer
  • NTPClient - NTP Library for Arduino IDE
  • MFRC522 - MFRC522 RFID Hardware Library for Arduino IDE
  • ArduinoJson - JSON Library for Arduino IDE

You may also need

  • ESP8266FS Uploader - Arduino ESP8266 filesystem uploader

Unlisted libraries are part of ESP8266 Core for Arduino IDE, so you don't need to download them.

Known Issues

  • Built-in HTML Editor has hard-coded JavaScript that loads from CDN Internet

This is probably very interesting and may be very useful. But WTF is it all about?

How about writing a few paragraphs to introduce and explain it.


I was started the project at that time, now we hit the v0.1 - Get more information at GitHub.

Getting Started

This project still in its development phase. New features (and also bugs) are introduced often and some functions may become deprecated. Please feel free to comment or give feedback.


  • First, flash firmware to your ESP either using Arduino IDE or with your favourite flash tool
  • Flash webfiles data to SPIFFS either using ESP8266FS Uploader tool or with your favourite flash tool
  • (optional) Fire up your serial monitor to get informed
  • Power on your ESP
  • Search for Wireless Network "esp-rfid" and connect to it (It should be an open network and does not reqiure password)
  • Open your browser and type either "" or "http://esp-rfid.local" (.local needs Bonjour installed on your computer) on address bar.
  • Log on to ESP, password is "admin" (for now, you can only change it from source)
  • Go to "Settings" page
  • Configure your amazing access control device. Push "Scan" button to join your wireless network, configure RFID hardware, Relay Module.
  • Save settings, when rebooted your ESP will try to join your wireless network.
  • Check your new IP address from serial monitor and connect to your ESP again. (You can also connect to "http://esp-rfid.local")
  • Go to "Users" page
  • Scan a PICC (RFID Tag) then it should glimpse on your Browser's screen.
  • Type "User Name" or "Label" for the PICC you scanned.
  • Choose "Allow Access" if you want to
  • Click "Add"
  • Congratulations, everything went well, if you encounter any issue feel free to ask help on GitHub.


Since we are limited on both flash and ram size things may get ugly at some point in the future. You can find out some test results below.


How many RFID Tag can be handled?

Write some user data on File System worth:

  • 100 seperate "userfile"
  • random 4 Bytes long UID and
  • "Test Name Test Surname Label" as User Name and
  • each have access status integer "1" or "0".

Total 4,284 Bytes

At least 100 unique User (RFID Tag) can be handled, the test were performed on WeMos D1 mini.

It's a DIY door lock control device or access control in general using cheap ESP8266 MCU and MFRC522 (often called RC522) RFID reader hardware, it's actually a Relay module what is controlled.

Its easy to use web based interface makes everything smooth. Once you setup your hardware, you can associate RFID tags to "Users" (or just label them), give them ability to unlock a electric controlled door or whatever you want give access.

You can connect to Web UI anytime to give users access or take it back. Web UI accessible via Wi-Fi network, if your Wi-Fi Access Point is connected to Internet, you can sync Time from NTP Server to timestamp User's access.

Use case scenarios can be expanded. There are several things I want to implement. (such as limited time access, logging, record enter exit time, etc.)

Dear omersiar!

First of all thank you for work!

I wanna use your project to a sauna door open. I have two option that I can't solve. One: I measure the temperature in sauna - how can I display the temperature on the settings site as variable? Two: we need an "open time" example 8pm to 8am the sauna closed so the door can't open with any card. Is it possible to insert a setting that I can use for this?




For 1 you need to code it, for 2 open / close hours will be supported in next version.

I do not have time these days, set a bounty on GitHub and someone may code it for you.


Proud to present you new 0.6 update: