Main Content


I needed an access control system for my office, able to log an NFC tag into a mysql database and/or in a text file.
This is a major revision of a previsious version I published some time ago.
I had a spare Aduino Mega and a Ethernet shield at home, so, with a few more components I have been able to build an access control system for my office.
The board uses two rfid modules, 1 used as log IN, 1 used as log OUT.
Bonus! - All the main parameters are configurable via json config file (IP, subn, gat, DNS, Ntp server, operation etc.)
Superbonus! Want more? If you have a 3d printer, I included also a box enclosure for the project :)
Bill of material

Arduino Mega 2560 r3
W5100 ethernet shield with microSD
2 x rc522 rfid modules
RTC DS1307 clock module
LCD display (16,2) (SPI or I2c, as I included both connection methods)
microSD card
a couple of leds with 1k resistors
A php server with mysql database (not needed if you only use SD card to store the data)
Database and MicroSD log can be separately enabld/disabled.

If the db log is enabled, it will log the record into the database.

I put a php process page into the webserver which will process the db log requests.
At first, it will check for the presence of the tag into a “users” table.
The table contains infact known users and their relative tags (this check could be disabled).
If microSD log is enabled a record will be added to a text file (The the date and time, the tag, in or out operation.
I added also a lcd to make the things easier for the users. It simply displays clock time and the operazions done. When the access is recorded, a green led will flash for few seconds and a buzzer will play a short tone with increasing pitch. The lcd will show a short ok message for few seconds.
If some errors occur (as lan not working, or the tag is unknown), a red led will flash instead, and the tone played will have a decreasing pitch. The lcd will show also a short error message for few seconds.
Also, to manage the microSD log, I added a couple more of green/red led blinks after the db blinks.
A twice beep tone will be played in this case. Either here it will be increasing tone freq for an ok operation.. otherwise the two small tones will be decreasing in frequencies.”

Link to article