Attendance System Using MYSQL With Raspberry Pi and RFID-RC522




About: We are a team of IoT & Embedded Systems developers. We are working in Raspberry Pi and Arduino.

Introduction to Our Project:

In thisproject we are taking data from RFID reader which is connected to Node MCU V3 and saving it to PHPMYADMIN database running on Raspberry pi.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Installation of All Software

a) Raspbian OS:

This is the recommended os for raspberry pi. You can also installed other OS from third party. Raspbian OS is debian based OS. We can install it from noobs installer. you can Download here

b) Python idle:

This is the software we get in raspbian os. For this project we have used python script.

c) Putty:

we are using putty for remote access of Raspberry can Download here

d) Win32DiskImager:

This software is used to burn Raspbian Os on SD Card. you can Download here

e) SDFormatter:

This software is used to format memory card. you can Download here

f) Installation of LAMP Server and PHPMYADMIN:

First of all let us clear one thing that we are using LAMP Server for this project. In case if you don't know what is LAMP, it is an abbreviation of Linux, Apache, MySQL and PHP. So if you have windows or may be MAC then you have to install WAMP and MAMP respectively. So what we are explaining that is only for LAMP server:

and here are the steps for installing LAMP server

1. Install Apache sudo apt-get install apache2

2. Install MySQL: sudo apt-get install mysql-server

3. Install PHP: sudo apt-get install php5 libapache2-mod-php5

4. Restart Server: sudo /etc/init.d/apache2 restart

5. Check Apache http://localhost/

if you install these steps successfully then you will get the apche page like the image above Here we are using PHPMYADMIN that is the web interface of MySQL so for that you have to install that also and the command for that is:

sudo apt-get install phpmyadmin

g) Installation of Arduino IDE:

You can download the latest Arduino IDE from this link:

Step 2: Component Used:

For this project you need :

a )Raspberry pi

b) Node MCU V3

c)RFID Reader with Tag

d) Jumper Wire

a )Raspberry pi:

This is the latest version of raspberry pi. In this we have inbuilt Bluetooth and wi-fi, unlike previously we have to use Wi-Fi dongle in one of its usb port. There are total 40 pins in RPI3. Of the 40 pins, 26 are GPIO pins and the others are power or ground pins (plus two ID EEPROM pins.)

There are 4 USB Port and 1 Ethernet slot, one HDMI port, 1 audio output port and 1 micro usb port and also many other things you can see the diagram on right side. And also we have one micro sd card slot wherein we have to installed the recommended Operating system on micro sd card.There are two ways to interact with your raspberry pi. Either you can interact directly through HDMI port by connecting HDMI to VGA cable, and keyboard and mouse or else you can interact from any system through SSH(Secure Shell). (For example in windows you can interact from putty ssh.)

b) Node MCU V3:

NodeMCU is an open source IOT platform. It includes firmware which runs on the ESP8266 Wi- Fi SoC from hardware which is based on the ESP-12 module. The term "NodeMCU" by default refers to the firmware rather than the dev kits.

c) RFID RC522 Reader with Tag:

There are cheap RFID modules that can read and write Mifare's tags and being sold at several web stores, like eBay and included with many "starter kits" nowadays. Simply search RFID-RC522 (MF-RC522). The microcontroller and card reader uses SPI for communication (chip supports I2C and UART protocols but not implemented on library). The card reader and the tags communicate using a 13.56MHz electromagnetic field.

Step 3: How to Used NodeMCU in Arduino IDE


Firstly open the Arduino IDE.


Go to the File then click on preferences tab like Figure 1. Now you have to copy in the additional board manager URL-

then click ok

Step 3:

Now go to the Tools then select Board Manager. open window like figure 2. Just Scroll down on that window and search for esp8266 by ESP8266 Community and then click on install button.


Restart your Arduino IDE Step5: Now goto Tools then Select like figure 3

Step 4: Circuit Diagram

In this you have two circuit diagrams are given above:

First Connection is for Node MCU with RFID RC522

and Second is for Node MCU with Raspberry Pi.

Here are the connections for First Circuit:







3.3V -- 3.3V

RST -- not connected

IRQ -- not connected

and Second Circuit Connection is given above in second figure.

Step 5: Importing Necessary Library for NodeMCU

Here we are using RFID RC522. So you have to import MFRC522.

Here is a GitHub link:

Step 6: Code for Project

Code of this project is given below or you can download source code in GitHub link

Step 7: Video of Project

The whole project description are given in the above video

we've given our level of best to make you understand this project. Still if you have any doubt feel free comment us below

So finally if all things will go well. Definitely you will enjoy this project.

you also mail us on

And if you want to learn more about these type of project then feel free to visit our youtube channel link

Thanks & Regards,

Deligence Technologies



    • Indoor Lighting Contest

      Indoor Lighting Contest
    • Make It Fly Challenge

      Make It Fly Challenge
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    15 Discussions


    7 months ago

    hello dear sanjay...i would like to know the main reason u have node mcu that other iot platform?


    1 year ago

    Can this code be modified so that I can read data from an RFID connected directly to my Raspberry Pi and storing the data on a MySQL hosted on an internet site? Or is there such a tutorial out there...

    I am trying to read data from an RFID tag using my raspberry Pi and comparing the data with a MySQL db located on a hosted website.


    1 year ago

    Is there anyone who has been able to complete this project by following the instructions provided?

    1 reply

    Reply 1 year ago


    Are you facing any problem is completing this project? Do let us know. We'll be happy to support you.

    Sanjay Kumar


    Reply 1 year ago

    Can you try with any RFID example program? Just to ensure that RFID is installed. The error message suggest that RFID is still not installed.


    1 year ago

    Good Day! May I ask what should I do when an error appear:

    RFID.h: No such file or directory?

    2 replies

    Reply 1 year ago

    You need to import the required library for compiling rfid-rc522, I've mentioned that in the above instructable on STEP 5


    1 year ago

    Excellent project! I'm getting the components to be able to build it. I am not familiar with web page programming and I have the following question: do I have to create my own website to store the database? Thank you very much for your contribution.


    2 years ago


    Very interesting project.

    I just don't understand why you need the ESP8266. You could connect the RFID card reader directly to the Raspberry Pi.


    3 replies

    Reply 2 years ago

    Yes, we can do but here actually
    nodemcu(esp8266) is throwing data to raspberry pi through it's serial
    port which is connected to raspberry pi USB port. And here we are
    getting rfid data through nodemcu code named nodemcu.ino and we are sending it
    to phpmyadmin database through one python script named
    which we are running on raspberry pi.

    Still any doubt feel free to ask



    Reply 2 years ago

    Why via serial? you have chosen to use an ESP8266 board but are using a standard serial to connect to the PI, you done need an esp8266 board for that. If you are plugging it in via serial using the PIs GPIO pins directly does the same thing.


    Reply 2 years ago

    Actually here our code is running on nodemcu only, and we are taking that serial data which is coming from nodemcu, you can chose arduino as well for that.

    And yes we can do this project with raspberry pi only, Soon we will post that also where we don't need nodemcu.

    Still any doubt please ask



    2 years ago

    Very intreseted!