Giter VIP home page Giter VIP logo

esprfid / esp-rfid Goto Github PK

View Code? Open in Web Editor NEW
1.3K 114.0 416.0 51.86 MB

ESP8266 RFID (RC522, PN532, Wiegand, RDM6300) Access Control system featuring WebSocket, JSON, NTP Client, Javascript, SPIFFS

License: MIT License

HTML 22.39% JavaScript 28.57% Batchfile 0.47% Python 0.40% C++ 48.17%
esp8266 mfrc522 rc522 rfid-rc522 rfid-doorlock-application rfid-reader websocket esp8266-rfid wiegand rfid-hardware

esp-rfid's Introduction

ESP RFID - Access Control with ESP8266, RC522 PN532 Wiegand RDM6300

Chat at https://gitter.im/esp-rfid/Lobby Build Status Codacy Badge BCH compliance Bountysource

Access Control system using a cheap MFRC522, PN532 RFID, RDM6300 readers or Wiegand RFID readers and Espressif's ESP8266 Microcontroller.

Showcase GifBoard

Features

For Users

  • Minimal effort for setting up your Access Control system, just flash and everything can be configured via Web UI
  • Capable of managing up to 1.000 Users (even more is possible)
  • Great for Maker Spaces, Labs, Schools, etc
  • Cheap to build and easy to maintain

For Tinkerers

  • Open Source (minimum amount of hardcoded variable, this means more freedom)
  • 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)
  • MQTT enabled
  • Bootstrap, jQuery, FooTables for beautiful Web Pages for both Mobile and Desktop Screens
  • Thanks to ESPAsyncWebServer Library communication is Asynchronous

Official Hardware

  • Small size form factor, sometimes it is possible to glue it into existing readers.
  • Single power source to power 12V/2A powers ESP12 module, RFID Wiegand Reader and magnetic lock for opening doors.
  • Exposed programming pins for ESP8266
  • Regarding hardware design, you get multiple possible setup options:
  • Forward Bell ringing on reader to MCU or pass it out of board
  • Track Door Status
  • Control reader’s status LED
  • Control reader’s status BUZZER sound *
  • Power reader, lock and the board through single 12V, 2A PSU
  • Optionally power magnetic lock through external AC/DC PSU
  • Possible to use any kind and any type of Wiegand readers
  • Enables you to make IOT Access System with very little wiring
  • Fits in an universal enclosures with DIN mount
  • Open Source Hardware

Get more information and see accessory options from Tindie Store

What are others saying about esp-rfid?
“Hi, nice project.”@Rotzbua
“Your app works like a charm”@tueddy
“Just stumbled upon this project while planning to do something similar. Very beautifully done!”@LifeP
“Hello, I've come across your project and first of all… wow - thanks to all contributors for your hard work!”@byt3w4rri0r
“Brilliant work.”@danbicks
“This is an impressive project.”@appi1
“I'd like to thank every single contributor for creating this epic project.”@TheCellMc
“Congratulations for your awesome work! This project is absolutely brilliant.”@quikote

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.

What You Will Need

Hardware

  • Official ESP-RFID Relay Board or
  • An ESP8266 module or a development board like WeMos D1 mini or NodeMcu 1.0 with at least 32Mbit Flash (equals to 4MBytes) (ESP32 does not supported for now)
  • A MFRC522 RFID PCD Module or PN532 NFC Reader Module or RDM6300 125KHz RFID Module Wiegand based RFID reader
  • A Relay Module (or you can build your own circuit)
  • n quantity of Mifare Classic 1KB (recommended due to available code base) PICCs (RFID Tags) equivalent to User Number

Software

Using Compiled Binaries

Download compiled binaries from GitHub Releases page https://github.com/esprfid/esp-rfid/releases On Windows you can use "flash.bat", it will ask you which COM port that ESP is connected and then flashes it. You can use any flashing tool and do the flashing manually. The flashing process itself has been described at numerous places on Internet.

Building With PlatformIO

Backend

The build environment is based on PlatformIO. Follow the instructions found here: http://platformio.org/#!/get-started for installing it but skip the platform init step as this has already been done, modified and it is included in this repository. In summary:

sudo pip install -U pip setuptools
sudo pip install -U platformio
git clone https://github.com/esprfid/esp-rfid.git
cd esp-rfid
platformio run

When you run platformio run for the first time, it will download the toolchains and all necessary libraries automatically.

Useful commands:
  • platformio run - process/build all targets
  • platformio run -e generic -t upload - process/build and flash just the ESP12e target (the NodeMcu v2)
  • platformio run -t clean - clean project (remove compiled files)

The resulting (built) image(s) can be found in the directory /bin created during the build process.

Frontend

You can not simply edit Web UI files because you will need to convert them to C arrays, which can be done automatically by a gulp script that can be found in tools directory or you can use compiled executables at the same directory as well (for Windows PCs only).

If you want to edit esp-rfid's Web UI you will need (unless using compiled executables):

  • NodeJS
  • npm (comes with NodeJS installer)
  • Gulp (can be installed with npm)

Gulp script also minifies HTML and JS files and compresses (gzip) them.

In order to test your changes without flashing the firmware you can launch websocket emulator which is included in tools directory.

  • You will need to Node JS for websocket emulator.
  • Run npm update to install dependencies
  • Run emulator node wserver.js
  • then you will need to launch your browser with CORS disabled:
  • chrome.exe --args --disable-web-security -–allow-file-access-from-files --user-data-dir="C:\Users\USERNAME"

Get more information here: https://stackoverflow.com/questions/3102819/disable-same-origin-policy-in-chrome

Pin Layout

The following table shows the typical pin layout used for connecting readers hardware to ESP:

ESP8266 NodeMcu/WeMos Wiegand PN532 MFRC522 RDM6300
GPIO-15 D8 SS SDA/SS
GPIO-13 D7 D0 MOSI MOSI
GPIO-12 D6 D1 MISO MISO
GPIO-14 D5 SCK SCK TX
GPIO-04 D2
GPIO-05 D1

For Wiegand based readers, you can configure D0 and D1 pins via settings page. By default, D0 is GPIO-4 and D1 is GPIO-5

Steps

  • First, flash firmware (you can use /bin/flash.bat on Windows) to your ESP either using Arduino IDE or with your favourite flash tool
  • (optional) Fire up your serial monitor to get informed
  • Search for Wireless Network "esp-rfid-xxxxxx" and connect to it (It should be an open network and does not require 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, default password is "admin"
  • 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.

Known Issues

  • You need to connect your MFRC522 reader to your ESP properly or you will end up with a boot loop
  • Please also check GitHub issues.

Time

We are syncing time from a NTP Server (in Client -aka infrastructure- Mode). This will require ESP to have an Internet connection. Additionally your ESP can also work without Internet connection too (Access Point -aka Ad-Hoc- Mode), without giving up functionality. This will require you to do syncing manually. ESP can store and hold time for you approximately 51 days without a major issue, device time can drift from actual time depending on usage, temperature, etc. So you have to login to settings page and sync it in a timely fashion.

Security

We assume ESP-RFID project -as a whole- does not offer strong security. There are PICCs available that their UID (Unique Identification Numbers) can be set manually (Currently esp-rfid relies only UID to identify its users). Also there may be a bug in the code that may result free access to your belongings. And also, like every other network connected device esp-rfid is vulnerable to many attacks including Man-in-the-middle, Brute-force, etc.

This is a simple, hobby grade project, do not use it where strong security is needed.

What can be done to increase security? (by you and by us)

  • We are working on more secure ways to Authenticate RFID Tags.
  • You can disable wireless network to reduce attack surface. (This can be configured in Web UI Settings page)
  • Choose a strong password for the Web UI

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

1) How many RFID Tag can be handled?

Restore some randomly generated user data on File System worth:

  • 1000 separate "userfile"
  • random 4 Bytes long UID and
  • random User Names and
  • 4 bytes random Unix Time Stamp
  • each have "access type" 1 byte integer "1" or "0".

Total 122,880 Bytes

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

Additional testing is needed:

  • Logging needs testing. How long should it need to log access? What if a Boss needs whole year log?
  • Reliability on Flash (these NOR Flash have limited write cycle on their cells). It depends on manufacturer choice of Flash Chip and usage.

Community

  • Chat at https://gitter.im/esp-rfid/Lobby Join community chat on Gitter

Projects that is based on esp-rfid

  • ESP-IO Project to manipulate GPIOs with EventGhost
  • ESP-RCM Room Climate Monitor with ESP8266, HTU21D, Si7021, AM2320

Acknowledgements

  • @rneurink
  • @thunderace
  • @zeraien
  • @nardev
  • @romanzava
  • @arduino12
  • @Pako2

See ChangeLog

Donations

If this project helps you in a way, you can buy us a beer. You can make a donation to the ESP-RFID community with Bountysource

License

The code parts written by ESP-RFID project's authors are licensed under MIT License, 3rd party libraries that are used by this project are licensed under different license schemes, please check them out as well.

esp-rfid's People

Contributors

akarakn avatar arduino12 avatar djcysmic avatar donatmarko avatar ibobik avatar matjack1 avatar nardev avatar olika120 avatar omersiar avatar pako2 avatar thunderace avatar zeraien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp-rfid's Issues

Adding buzzer

Hello,
ESP-RFID will be better if we add a buzzer attached to an GPIO and send short sound signals, on reading, giving access/deny access , powerup, ЕТC. I can offer my help for that. I got some (above) basic arduino programing experience, but i'm good at algorithm creation.

Can not retreive logs anymore

Since a couple of days I can not retreive the logs anymore. The page simply says "please wait while fetching data". But nothing happens.

It seems, that there is no possibility to do a hard reset. I reflashed the firmware remotely with the upload feature or did power cycles. But no way...

The problem is, that I have put the whole stuff into a housing and mounted it to the garage door. To do a factory reset or a similar feature would be a great help...

Thanks
Mustafa

Sync data with a remote MySQL database

Hi.
Please include syncronization with a remote MySQL.
This way the log file, which is JSON, might also stored to a MySQL database for security purposes and/or backup.
This way the system can be used as an attendance logger.
Thanks

buzzer, button, localization

Hello! First of all thank you for the great project! I tried to use it as a door lock and I have a couple of questions: Is it possible to add a buzzer to make a sound when access allowed or denied and a button to unlock the door from inside for example and from settings page maybe? Is it possible to realize it for donation? :) From my side I can do localization in Polish and Russian language.

Question?

Did you test the log size and efficiency with a lot of users/cards in the file? How did it behave?

p.s. I plan to make wiegand version and slightly different code structure, is there a way to contact you other than this messages?

Can't get this working correctly... Hopefully you can help!

Hi,

I'm a noob and trying to get this working. Can you confirm if the following board should work? https://www.amazon.co.uk/dp/B01N5D3MV8/ref=pe_3187911_185740111_TE_item

I am able to flash the board and log into the initial web interface but I see this in the serial monitor after the initial config and reboot:

[ INFO ] Trying to setup RFID Hardware
[ INFO ] RFID SS_PIN: 15 and Gain Factor: 32
[ INFO ] MFRC522 Version: 0x0 (unknown)
[ WARN ] Communication failure, check if MFRC522 properly connected
[ INFO ] ESP-RFID is running in AP Mode
[ INFO ] Configuring access point... Failed!
[ INFO ] AP IP address: 192.168.4.1
[ INFO ] AP SSID: test
[ INFO ] ESP-RFID is running in Fallback AP Mode
[ INFO ] Configuring access point... Ready
[ INFO ] AP IP address: 192.168.4.1
[ INFO ] AP SSID: ESP-RFID-1cc374

I only get this far if I pull the 3.3v lead during the boot sequence otherwise i get the known issue boot loop.

I have used this RC522 on another (more simple) project using an uno and it works fine (can scan cards and work a relay), so i'm not sure what the issue can be as it's even failing to setup the AP mode.

Also if I use client mode I am able to connect it to my network but for some reason NTP isn't working (even though I can see the correct DNS server is picked up by DHCP) and I have the same issue with the RC522 card reader.

nodemcu pin

thanks for sharing this! its the first sketch i tried on nodemcu esp8266 and very intrigued with whats possible!

im using the nodemcu (amica) from https://www.banggood.com/NodeMcu-Lua-WIFI-Internet-Things-Development-Board-Based-ESP8266-CP2102-Wireless-Module-p-1097112.html?rmmds=search

i noticed the pin connection comments at top of source code, sda D2 & RST D1 , and later in the code different pins selected referring to ''wemos d1 mini''
// Configure RC522 Device Pins on
#define SS_PIN D8 //Pin on WeMos D1 Mini
#define RST_PIN D3 //Pin on WeMos D1 Mini

Are you testing this on WeMos D1 Mini, and if yes which version would that be?

Latestspiffs for wiegand reader of last arduino release

Hello, I have a problem with the spiff files for the last arduino version.
The option for the wiegand reader is missing in the settings.
image

I am trying to use that wiegand reader. It has an ST microcontroller on it.
Does it work?

Thanks for the development.

BTW, when will the new bootstrap web interface be ready?

Julian.

read bus card

sorry yo open ticket for my question , however I've tried to read my bus card with typical DumpInfo.ino example , but I can only read the card UID and result is as per following , any advice to decode or read such card is really appreciated
``
Find new Card
Card UID: 2E 62 DF CE
PICC type: MIFARE 1KB
Sector Block 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 AccessBits
15 63 PCD_Authenticate() failed: Error in communication.
14 59 PCD_Authenticate() failed: Timeout in communication.
13 55 PCD_Authenticate() failed: Timeout in communication.
12 51 PCD_Authenticate() failed: Timeout in communication.
11 47 PCD_Authenticate() failed: Timeout in communication.
10 43 PCD_Authenticate() failed: Timeout in communication.
9 39 PCD_Authenticate() failed: Timeout in communication.
8 35 PCD_Authenticate() failed: Timeout in communication.
7 31 PCD_Authenticate() failed: Timeout in communication.
6 27 PCD_Authenticate() failed: Timeout in communication.
5 23 PCD_Authenticate() failed: Timeout in communication.
4 19 PCD_Authenticate() failed: Timeout in communication.
3 15 PCD_Authenticate() failed: Timeout in communication.
2 11 PCD_Authenticate() failed: Timeout in communication.
1 7 PCD_Authenticate() failed: Timeout in communication.
0 3 PCD_Authenticate() failed: Timeout in communication.

``

In case of interrupt, log can be damaged.

I have one client which was not able to retrieve log. When i downloaded the latestlof json file, i noticed that the log file was actually interrupted so the format was damaged.

If possible, please others test this case.. once the card is swiped and reader is interrupted, does anything wrong happen.

I hope i'm wrong.

error "Filesystem full" when uploading SPIFFS.bin

Hey,
I'm using a Wemos D1 mini trying to install your great tool. I'm not sure if I'm doing something wrong or the storage on the wemos is simply too small.
I flashed the sketch and can properly connect to the wifi. But when flashing the SPIFFS via esp8266fs.jar I do receive the following error message:

[SPIFFS] data   : C:\Users\sebastian\Documents\Arduino\SPIFFS_upload\data
[SPIFFS] size   : 3052
[SPIFFS] page   : 256
[SPIFFS] block  : 8192
/latestspiffs.bin

SPIFFS_write error(-10001): File system is full.

error adding file!

SPIFFS Create Failed!

Do i have to clear the FS before attempting to re-flash SPIFFS? Or is the flash too small?
Thanks for your help

Future plans/thoughts....

As i pushed Wiegand support, i realized the code structure so.. i realize we could improve it for everyone's good.

Honestly, i would love to make many changes. What do you think about following:

  1. Automate combine & compress css, js and html pages? (i already have a method that i use, i can easily add this)

  2. Restructure the web page, more use of jquery, this approach is quite messy and bit later on, it will be hard to follow changes. The whole process of saving the settings and populating the form in settings page i can do in 10-20 lines of code with jquery, in a smart way.

  3. Extract functions for RFID readers and make auto build for each different reader, so that the code will be light and only what is required in one certain version.
    (This would be very easy if we move code to PlatformIO, just set platform.ini as we need it)

  4. Move to PlatformIO?

  5. I propose to have official hardware, and as i already mentioned, i have a version, which i can easily adjust so that it can accept all kinds of readers, have relay, door status input button for buzzer and input for some extra sensors like PIR sensor for silent alarm etc. (what do you think?)

always loading web data from esp8266 ON MOBILE BROWSER

I set it in AP mode, and works well on PC web browser Chrome, eg: load user list, load log, load settings. But the web page always LOADING on my mobiel(iPhone 6S), either safari or chrome, it looks like something goes wrong on websocket, but I didn't diagnose it yet by any tools. Is it an already-known issue?

No UID Scan

Hello, i have flashed a nodemcu but on the user page i can't see any scanned UID cards.

Can't build it...

I tried to build it, installed all required libs but i got this error.

src/main.cpp:317:14: error: 'class ESP8266WiFiClass' has no member named 'scanNetworksAsync'
WiFi.scanNetworksAsync(printScanResult, true);

Any idea what could be an issue?

p.s. Also after commenting that line:

lib/ESPAsyncWebServer/src/AsyncWebSocket.cpp:40:18: fatal error: Hash.h: No such file or directory
#include <Hash.h>

Any idea???

Support for multiple readers, enter and exit

While reading through the mfrc lib issue discussions as well as trying out various mfrc522 examples I noticed many utilizing the SS pin to support multiple mfrc522 readers connected to the same mcu.

In a typical setting, say for a door, an entry and exit readers would be the most common.

So my question is would you consider adding support for (at least) 2 mfrc522 readers where they can be initialized by SS pin individually

mfrc522.PCD_Init(enter);
mfrc522.PCD_Init(exit);

but work in the existing logic, with perhaps sending the id (enter/exit) of the read to JSON (sendDataWs)

With such one could send the json to a remote .php to make a simple access control of entry and exits with timestamps and deviceid. Understand the current logic sends to the websocket for its IP, but the modular approach enables such neat integration - from my limited understanding.

Would like to hear your thoughts on this.

My mfrc522 does not seem to read the card

Hello, I am a novice learning esp8266, I follow the steps to connect the hardware, in the user interface in accordance with the format of the picture inside the card input UID, set the web page test button can be triggered, but the MFRC522 reader part did not respond
[ INFO ] ESP RFID v0.3alpha [ INFO ] Config file found { "command": "configfile", "bssid": "74:7D:24:36:C3:C2", "ssid": "junhao", "wmode": "0", "pswd": "10086520", "sspin": "15", "rfidgain": "96", "rtype": "0", "rpin": "4", "rtime": "300", "ntpserver": "pool.ntp.org", "ntpinterval": "30", "timezone": "8", "hostnm": "admin", "adminpwd": "admin" } [ INFO ] Trying to setup RFID Hardware [ INFO ] RFID SS_PIN: 15 and Gain Factor: 96 [ INFO ] MFRC522 Version: 0x92 = v2.0 [ INFO ] Trying to connect WiFi: junhao.... [ INFO ] Client IP address: 192.168.123.150

SPIFFS.begin(); Twice

This is my first time working with SPIFFS and my first time submitting an issue so please forgive me if I misunderstand something but you seam to run " SPIFFS.begin();" twice in your code.

I really enjoy this project, keep up the good work!

v0.4 Goals

  • Timed Entry
  • Valid Until
  • Add support for active low relays
  • Improve User Data restoring
  • Load page AJAX

Flash compiledbin error

Hey i try to flash the compiledbin (stable and embedded-html) with windows flash.bat

After connect to 192.168.4.1 it open a site with "Not found"

What am i doing wrong

Embedded web files

Under the embedded-html branch you have the new esp-rfid version without FS (except for data storage of course).

With the big help from the ESP8266_WiFi_v2.x project. Thanks to them.

TODO :

  • Authentification
  • One htm file and one js file -> Cancelled, see the all_in_one_html branch
  • handle fonts (done but the firmware is very big now : perhaps decrease the SPIFFS size is needed)
  • Gzip required.* files -> FAILED
  • add fallback in case there are no java and internet access

@omersiar don't merge. and, after merge, don't delete this branch

Sending periodical when RFID is read

Is it possible to continue sending MQTT-Messages while a RDIF tag is placed on the reader? Or send a message when it is placed on the reader and another (different) message when it's removed? Function should be similar to a hotel card plugged in slot near the door.
The usage will be a smart home "switch" to send a MQTT message, when e.g. a NFC tag of a phone is placed on the reader to signal night mode.

v0.2

  • Get SSID, connect to BSSID
  • pseudo code for give access until specific date.
    `if (epoch <= validuntil) { grantaccess() }
  • fix status command in AP mode
  • add "available/used space on SPIFFS" to status

Alternative reader?

2 questions is there a way to get esp to load settings if MFRC522 is not connected. (Haven’t arrived yet)
2nd any way of using ibuttons (onewire devices) instead of MFRC522

ESP-IO

Hi Omer!
I want to thank you for this project. I'm a newcomer to ESP8266 and I was looking for how I should start. Your project was perfectly suited to my needs and I used almost everything.
You can see the result here: ESP-IO

Note:
I have solved (at least for my needs) two security holes:

  1. Entering the editor is password protected. I do not suppose that it is necessary to open the editor if the device works in "Fallback to AP Mode".
  2. (Direct) access via the websocket is also password protected. This is more or less a "scam". If a JavaScript is triggered (and this happens only if the user enters the admin password), it first opens EventSource. The server will reply to this opening by sending a password. Websocket communications can then be started by asking for a password (from the server side). So if I want to open directly websocket (for example, using Eventghost) then I need to know the password. Otherwise, the server will disconnect me.
    However, I'm aware that this is just a minimal protection and it can not be used where real system attacks can be.

Thanks again for your project!

Pako

Doesn`t detect NFC of my Smartphones

Hi,

thank you for this cool project. Fits exactly to my needs. It's working successfully with my NFC Badge, Keyring and Stickers. But unfortunately it doesn`t work anymore with my Smartphones (Samsung S6 and Huawei P10 Lite). Whenever creating the user in the Settings (by holding the smartphone to the reader), it always generates a different ID with 7 digits. Each try seems to generate a unique ID.

When testing with the first compiled binary both smartphones worked. But after the last version (or before) it doesn`t work anymore.

Please wait while fetching data...

I've got this joining my wifi and initialising the MFRC522 — so far so good.

I'm stalled now on the web UI with it saying "Please wait while fetching data..." — which it never does.

I've tried re-uploading the SPIFFS a few times. No joy.

Thoughts?

(Ace project by the way! Hoping to use it on our new Makerspace and Men's Shed)

Not an issue but an implementation

Not an issue but I've been working on my own RFID system and i thought lets merge these projects. So heres some code to implement a timing system

The timing system makes it available so someone can select times for each day to allow someone to enter.
capture

I'm still working on converting my logging system to this project. Feel free to ask questions

Code is in attached zip file

RFID_ESP.zip

Edit:
Also it might be handy to use Gitt to improve communication around your projects

Using Visual Studio Code with PlatformIO

I tried to run the latest arduino release on a previously working arduino install, which worked couple months ago, but kept getting esp board errors.

Taking that as an excuse, I have tried to download PlatformIO with Visual Studio Code and sharing my experience to get the latest branch to work on these combo;

Please note I have not used PlatformIO before and only seen the discussion on moving to this platform.
Therefore this might help others with similar upgrade path to get esp rfid running on platform io under windows 10 x64.

For Windows 10 x64;
Once you download the latest esprfid dev and create new project in VS Code PlatformIO, under platform.ini change the upload_port to COMx where x is your com port. It was assuming Linux in esprfid dev version - as of this message.
Also when tried to upload the compiled code it was giving error on downloading tool_mkspiffs

So I downloaded this manually via https://bintray.com/package/files/platformio/dl-packages/tool-mkspiffs
for windows, version 2, and manually moved under directory c:\users[username].platformio\packages\tool-mkspiffs

After which uploading the firmware was success. But the default build doesn't upload the spiff,
so I ran the command pio run --target uploadfs
which uploaded the spiff as expected.

This is much better than fiddling with arduino ide library and board manager. The difference is day and night.

One point though, when I tried to use the Serial monitor in platformIO VScode, like in Arduino IDE, default 9600 baud, setting the com port correctly i was getting gibberish and couldnt find how to change the baud rate or get the serial output to work. Likely missing something here.
If anyone knows how to get it to work please kindly share here.

Quick observations on the dev branch as of this message;
On mobile chrome on iOS, the rfid settings page changes were not being shown after save reboot.
I had to switch to desktop chrome to get this working.

In desktop chrome, i observed the console is giving errors for retrieving woff2 and ttf fallback fonts ;
`
(Slow network is detected. Fallback font will be used while loading: http://192.168.1.135/fonts/glyphicons-halflings-regular.woff2
required.js:21 GET http://192.168.1.135/fonts/glyphicons-halflings-regular.woff2 net::ERR_ABORTED
getViewportWidth @ required.js:21
getWidth @ required.js:21
calculate @ required.js:21
get @ required.js:21
(anonymous) @ required.js:21
(anonymous) @ required.js:2
i @ required.js:2
add @ required.js:2
(anonymous) @ required.js:2
each @ required.js:2
(anonymous) @ required.js:2
Deferred @ required.js:2
then @ required.js:2
init @ required.js:21
(anonymous) @ required.js:21
Deferred @ required.js:2
_execute @ required.js:21
execute @ required.js:21
(anonymous) @ required.js:21
(anonymous) @ required.js:2
i @ required.js:2
add @ required.js:2
(anonymous) @ required.js:2
each @ required.js:2
(anonymous) @ required.js:2
Deferred @ required.js:2
then @ required.js:2
_init @ required.js:21
(anonymous) @ required.js:21
(anonymous) @ required.js:2
i @ required.js:2
add @ required.js:2
(anonymous) @ required.js:2
each @ required.js:2
(anonymous) @ required.js:2
Deferred @ required.js:2
then @ required.js:2
_construct @ required.js:21
(anonymous) @ required.js:23
(anonymous) @ required.js:21
construct @ required.js:21
k @ required.js:21
b.init @ required.js:21
(anonymous) @ users.js:42
i @ required.js:2
add @ required.js:2
n.fn.ready @ required.js:2
n.fn.init @ required.js:2
n @ required.js:2
initTable @ users.js:38
socketMessageListener @ users.js:275
users.htm:1 Slow network is detected. Fallback font will be used while loading: http://192.168.1.135/fonts/glyphicons-halflings-regular.woff
/fonts/glyphicons-halflings-regular.woff:1 GET http://192.168.1.135/fonts/glyphicons-halflings-regular.woff net::ERR_ABORTED
users.htm:1 Slow network is detected. Fallback font will be used while loading: http://192.168.1.135/fonts/glyphicons-halflings-regular.ttf
/fonts/glyphicons-halflings-regular.ttf:1 GET http://192.168.1.135/fonts/glyphicons-halflings-regular.ttf net::ERR_ABORTED)

`

data dir missing

scripts should prepare data dir for pio to know from where to upload the data to spiffs

Last commit broke the user page...

Unfortunately, last commits broke the user page. It just stops at a message:

"You can add new users by either scanning a RFID Tag or by clicking on "New User" button."

And there is no add button to be shown etc..

please check, i have Wiegand version waiting for that. It's tested, works fine.. but this is confusing :(

NodeMCU has encountered a problem

Thank you for your project When I give the NodeMCU brush into the firmware, log on 192.168.4.1, in the interface after the operation click the save button is not used, the serial monitor will keep the code in the loop
a little advice: you can add a device to the 1602 iic screen, GPIO16 and GPIO2 are free

  • [ INFO ] ESP RFID v0.2
    [ INFO ] Config file found
    {
    "command": "configfile",
    "bssid": 0,
    "ssid": "HZDY",
    "wmode": "1",
    "pswd": "19970727",
    "sspin": "15",
    "rfidgain": "32",
    "rpin": "4",
    "rtime": "",
    "ntpserver": "",
    "ntpinterval": "",
    "timezone": "-12",
    "hostnm": "",
    "adminpwd": "admin"
    }

Soft WDT reset

ctx: cont
sp: 3fff11f0 end: 3fff1500 offset: 01b0

stack>>>
3fff13a0: 00241001 00000001 3fff04e0 40106449
3fff13b0: 00000002 3fff00e4 3fff01a4 4020e0b7
3fff13c0: 402012fa 00000001 00000032 402012ef
3fff13d0: 00000020 00000010 3fff00e4 4020e229
3fff13e0: 00000001 0000000f 3fff00e4 4020e31d
3fff13f0: 00000020 00000000 3fff00e4 4020e33b
3fff1400: 00000000 0000000f 3fff3840 40207497
3fff1410: 00000001 3fff0414 3fff3840 4020a337
3fff1420: 3ffe9fb8 00000000 000003e8 40218d11
3fff1430: 3fff36bc 3fff36fc 3ffe8dd8 00000000
3fff1440: 3fff3834 00000200 4021907d 3fff145c
3fff1450: 00100000 3fff1448 00000119 3fff0414
3fff1460: 00000220 3fff3714 3fff0414 40216cfd
3fff1470: 3ffe8b6c 00000000 3fff0414 3fff04d4
3fff1480: 3fff1524 3fff2898 3fff2894 40218d5b
3fff1490: 3fffdad0 00000000 3fff0414 3fff04d4
3fff14a0: 3fff1524 00000000 3fff0414 4020a5ac
3fff14b0: feefeffe feefeffe feefeffe feefeffe
3fff14c0: feefeffe feefeffe feefeffe feefeffe
3fff14d0: feefeffe feefeffe feefeffe feefeffe
3fff14e0: 3fffdad0 00000000 3fff04cd 40218164
3fff14f0: feefeffe feefeffe 3fff04e0 4010070c
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
vf6d232f1
~ld

all in one HTML/JS/CSS files

done

in the "all_in_one_html" branch.
Need some work/test for backup and restore.

  • test settings backup and restore
  • investigate some esp8266 crashes
  • fix user acces type bug on new user (always displayed as disabled')
  • fix user 'valid until' format on user edit
  • fix scan detection (web part)
  • fix add user replace the first line in table (sometimes)
  • expand the log table width to the parent

'class ESP8266WiFiClass' has no member named 'scanNetworksAsync'

Hi there

when i try to compile the code i get the below error. i have esp2866 2.3.0.rc3 installed and i still get this error.

Arduino: 1.8.2 (Windows 10), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, 115200, 4M (3M SPIFFS)"

Build options changed, rebuilding all
C:\Users\Jem\Documents\Arduino\esp-rfid-master\esp-rfid\esp-rfid.ino: In function 'void onWsEvent(AsyncWebSocket*, AsyncWebSocketClient*, AwsEventType, void*, uint8_t*, size_t)':

esp-rfid:272: error: 'class ESP8266WiFiClass' has no member named 'scanNetworksAsync'

     WiFi.scanNetworksAsync(printScanResult);

          ^

exit status 1
'class ESP8266WiFiClass' has no member named 'scanNetworksAsync'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

what would be the ideal way to communicate with a notify/mgmt server

Assuming communicating with a remote server is an option, in case its considered I have the following proof of concept that I run to see the time it takes between communication and test different scenarios.

This is purely to initiate discussion and not meant to be a polished integration;
Question/points it raises;

  • if httpclient is the right approach, or websocket based, async is the way to go for posting to remote server.

  • SSL seems possible by declaring the ca certificate at the top (untrusted but works), which can also be added (trusted) via settings in the future.

  • would it be possible to enforce 2 person entry; i.e. a UID needs to be scanned with another (paired) UID to grant access. Perhaps within 10 second time window. UID x is stored with pair field as the other UID y - thats how perhaps we can handle it simply, if pair exists wait for pair to be scanned.

  • it makes more sense to pass JSON to server, rather than querystring it seems. Im learning as I go along so any input are welcome.

#include <ESP8266HTTPClient.h>

String notifyserver="192.168.1.2";
String handler="/mgmt/index.php?";
String deviceid="MainDoor";
String hquery= "http://"+ notifyserver + handler + "device="+ deviceid + "&uid=";
// should pass the deviceid, uid, timestamp in JSON ideally, not in querystring.

void pingMgmtServer()
{

  HTTPClient http;
 Serial.print("[HTTP] begin...\n");
 http.begin(hquery);
 //if we want to do it with HTTPS, need ca certificate defined above
 //  http.begin("https://notifyserver/handler/?", ca); //HTTPS 
        
        Serial.print("[HTTP] GET...\n");
        // start connection and send HTTP header
        int httpCode = http.GET();
        
String payload="";

        // httpCode will be negative on error
        if(httpCode > 0) {
            // HTTP header has been send and Server response header has been handled
            Serial.printf("[HTTP] GET... code: %d\n", httpCode);

            // file found at server
            if(httpCode == HTTP_CODE_OK) {
                 payload = http.getString();
                Serial.println(payload);
              
            }
            
             
                
        } else {
            Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
        }

        http.end();

 switch (payload) {
    case "logged":    // logged in server/db
      Serial.println("logged record.");
      break;
    case "removed":    // indicates uid access right is removed
      Serial.println("the uid has been removed, do we do something?");
      break;
    case "added":    // n/a
      Serial.println("add not implemented");
      break;
    case "twokey":    // this uid needs another uid to be scanned before/after; i.e. 2person presense entry
      // perhaps the paired (second) uid can be send by server to client within the payload.
      Serial.println("this card needs the 2nd pair to be tapped to allow entry");
      break;
  }

       

}

Support for MQTT?

Since now my setup is working flawlessly now, I do have the first feature request :-)
Could you imagine making MQTT message sending optionally available?
Here's my idea:
I would like to send the UID of a scanned RFID tag via MQTT to my broker which is a home-automation system. There I'd like to do some more actions, like turning on lights, starting to play music, etc.

This is is how I could imagine an implementation:

  • enhance the "setting page" with an additional form. The following fields are needed:
    • MQTT host containing an IP address.
    • MQTT topic which is a string like "my/special/topic"
    • MQTT user optionally
    • MQTT password optionally in case one is using a public MQTT server on the internet
  • As soon as the MQTT host variable is filled, the MQTT sending should be activated.
  • As soon as an RFID token is successfully scanned, the MQTT message should be sent to the configured broker using the configured topic
  • The most commonly used MQTT library is: arduino-mqtt and from the examples it seems to be quite easy to implement

This would really boost functionality.
Let me kwow what you think.
Thanks much

Issue on OSX Sierra

I have a problem with websocket on OSX Sierra!
" the message sent directly in websock.onopen doesent work , if you try by console it work"

Ivan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.