Go Down

Topic: MFRC522 RC522 RFID on ESP8266 featuring WebSocket JSON JavaScript (Read 1 time) previous topic - next topic

omersiar

ESP-RFID Access Control with ESP8266

https://github.com/omersiar/esp-rfid



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

Features

  • 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 https://github.com/omersiar/esp-rfid. Pull Requests are welcomed.

TODO

  • 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
Pure SPI Library for 1602 LCD using Shift Register
https://github.com/omersiar/ShiftedLCD

RFID Access Control Project
https://github.com/omersiar/RFID522-Door-Unlock

Robin2

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.

...R

Two or three hours spent thinking and reading documentation solves most programming problems.

omersiar

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

https://github.com/omersiar/esp-rfid





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.



Steps

  • 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 "http://192.168.4.1" 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.



Scalability

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.

Tests

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.
Pure SPI Library for 1602 LCD using Shift Register
https://github.com/omersiar/ShiftedLCD

RFID Access Control Project
https://github.com/omersiar/RFID522-Door-Unlock

omersiar

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.)

http://forum.arduino.cc/index.php?topic=256260.msg3273056#msg3273056
Pure SPI Library for 1602 LCD using Shift Register
https://github.com/omersiar/ShiftedLCD

RFID Access Control Project
https://github.com/omersiar/RFID522-Door-Unlock

Georgie9117

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?

Cheers

G.

omersiar

@georgie9117

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.

https://www.bountysource.com/teams/esp-rfid
Pure SPI Library for 1602 LCD using Shift Register
https://github.com/omersiar/ShiftedLCD

RFID Access Control Project
https://github.com/omersiar/RFID522-Door-Unlock

Go Up