Gadget Programmers | Arduino|Online RFID Attendance System (Without Ethernet)
Online RFID Attendance System (Without Ethernet)
  • Anshul
    Developed By
  • Arduino
    Categories
Overview/short description

Online Attendance System using RFID Module and PHP&MYSQL Only. Utility for all type of attendance requirements. Useful for online tracking

Requirements / Things Used to build Project

Hardware components:

  1. Arduino UNO & Genuino UNO
  2. RFID RC522
  3. Also need RFID TAGS will get in package
  4. Jumper wires (generic)


ABOUT PROJECT

This is a unique project in the world of Arduino for marking Online Attendance without using ethernet and GSM modules. We have developed this unique project to automate the attendance system for offices, schools and universities etc. using RFID RC522 Module and Arduino. For web support and API you need php and mysql. This project costs less than $10.

The purpose of this project is to remove tedious process of marking attendance manually.We've visited so many sites but no one has the solution for marking online attendance without using Ethernet or GSM Module, so we decided to develop our system without using these components which reduces our project costing.


STORY

How It Works?

The system can be connected to the computer through RS232 or Universal Serial Bus (USB) port and store the attendance taken inside database (MySQL).To view the recorded attendance, web interface is provided using PHP and HTML.

There are 2 types of RFID Tags. They are Passive RFID Tags and Active Tags.

Here, we are using Passive RFID Tags which contains 8 digit number tags inbuilt in it. RFID reader contains a copper winding in it. This winding acts as an antenna. When a person with RFID tag or transponder enters in the range of RFID reader, the RF field induces voltage in the coils of tag. The range can be set by using the appropriate reader of appropriate frequency. This induced field supplies the voltage in case of passive tags and act as a battery in that case.

Due to interaction of tag with reader 8 characters from tag are sent to controller. These 8 characters are sent to Arduino via serial communication.

Here, Processing software is used to communicate between Arduino and PHP Web Application .This processing software read the 8 characters at serial communication and matched with data stored in DB (MYSQL) by calling PHP Api. If it is matched then it is replied with valid user and attendance marked otherwise it is replied with not valid and no attendance marked (Reply from PHP API) on serial you can view the results (Processing output window).

Circuit and Programming

Circuit diagram for Arduino and RFID RC522 Connection

Programming:

Installing XAMPP And Setting up Web Interface:

For web interface we require php installed in our system so firstly we need to install apache and mysql in our system for this install XAMPP using link https://www.apachefriends.org/download.html (According to your os) , may be your'e not good with web programming so there is no need to worry about. Please follow steps in order to install XAMPP for php link: (https://www.wikihow.com/Install-XAMPP-for-Windows )

After installing XAMPP please start the xampp apache/mysql services from xampp control panel as described in tutorial of wikihow.

How to test xampp is working fine?

Open your browser and type:

http://localhost

you will see below screen if everything is fine otherwise please repeat above steps.


This is showing os x because i am using xampp for mac book

Now copy and paste the attendance zip folder in htdocs

XAMPP->htdocs->attendanceSystem

copied folder will be used in PROCESSING code to call api through path specified and to show attendance data online.

Creating DATABASE

Now open the mysql using browser:

http://localhost/phpmyadmin

Paste the mysql query code to create database and tables.

Now we're ready to run our web application :

http://localhost/(your folder name)/

Here you'll see image given below if everything is going fine:

username: anshulpareek@gmail.com

password:12345



Login screen (username: anshulpareek91@gmail.com, password: 12345)

Adding Users in Our DB:

1.Before login please copy and paste Arduino code.

2.Now run and upload Arduino code to device.

3. Please copy and paste the markattendance program into processing window(to mark attendance)(PLEASE CHANGE YOUR PORT ACCORDING TO SYSTEM)

4. Please copy and paste the add_user program into processing window by creating new file in processing software because we have different module to add users.

5. open processing and run add_user program it will show you a message to approximate your card so please approximate your card to RFID after this you'll see the UID Code and a user name box so please enter name of the user related to this UID (RFID TAG) store information to web then press add user button.

hoooorrrreeeyyyy!

you've Added a new in user.

Now run our php code :

After Login as we've logged in before :



Showing Attendance information of users (in my db there is two users)

So this is overall information about our project please grab as you want.

Please shout in comment box if you have any query.

SCHEMATICS

RFID CIRCUIT DIAGRAM

Please make given below circuit using RFID and Arduino Uno

Rfid circuit dig 0ww0qikaqk



Code

/*Created by: Anshul Pareek
 * --------------------------------------------------------------------------------------------------------------------
 * Example sketch/program showing how to read new NUID from a PICC to serial.
 * --------------------------------------------------------------------------------------------------------------------
 * This is a MFRC522 library example; for further details and other examples see: https://github.com/miguelbalboa/rfid
 * 
 * Example sketch/program showing how to the read data from a PICC (that is: a RFID Tag or Card) using a MFRC522 based RFID
 * Reader on the Arduino SPI interface.
 * 
 * When the Arduino and the MFRC522 module are connected (see the pin layout below), load this sketch into Arduino IDE
 * then verify/compile and upload it. To see the output: use Tools, Serial Monitor of the IDE (hit Ctrl+Shft+M). When
 * you present a PICC (that is: a RFID Tag or Card) at reading distance of the MFRC522 Reader/PCD, the serial output
 * will show the type, and the NUID if a new card has been detected. Note: you may see "Timeout in communication" messages
 * when removing the PICC from reading distance too early.
 * 
 * @license Released into the public domain.
 * 
 * Typical pin layout used:
 * -----------------------------------------------------------------------------------------
 *             MFRC522      Arduino       Arduino   Arduino    Arduino          Arduino
 *             Reader/PCD   Uno/101       Mega      Nano v3    Leonardo/Micro   Pro Micro
 * Signal      Pin          Pin           Pin       Pin        Pin              Pin
 * -----------------------------------------------------------------------------------------
 * RST/Reset   RST          9             5         D9         RESET/ICSP-5     RST
 * SPI SS      SDA(SS)      10            53        D10        10               10
 * SPI MOSI    MOSI         11 / ICSP-4   51        D11        ICSP-4           16
 * SPI MISO    MISO         12 / ICSP-1   50        D12        ICSP-1           14
 * SPI SCK     SCK          13 / ICSP-3   52        D13        ICSP-3           15
 */

#include 
#include 

#define SS_PIN 10
#define RST_PIN 9
 
MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class

MFRC522::MIFARE_Key key; 

// Init array that will store new NUID 
byte nuidPICC[4];

void setup() { 
  Serial.begin(9600);
  SPI.begin(); // Init SPI bus
  rfid.PCD_Init(); // Init MFRC522 

  for (byte i = 0; i < 6; i++) {
    key.keyByte[i] = 0xFF;
  }

}
 
void loop() {

  // Look for new cards
  if ( ! rfid.PICC_IsNewCardPresent())
    return;

  // Verify if the NUID has been readed
  if ( ! rfid.PICC_ReadCardSerial())
    return;

  MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak);

  // Check is the PICC of Classic MIFARE type
  if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI &&  
    piccType != MFRC522::PICC_TYPE_MIFARE_1K &&
    piccType != MFRC522::PICC_TYPE_MIFARE_4K) {
    //Serial.println(F("Your tag is not of type MIFARE Classic."));
    return;
  }
 String s;
    for (byte i = 0; i < 4; i++) {
      
      nuidPICC[i] = rfid.uid.uidByte[i];
      
    }
  

    printHex(rfid.uid.uidByte, rfid.uid.size);
    Serial.println();
   
  // Halt PICC
  rfid.PICC_HaltA();

  // Stop encryption on PCD
  rfid.PCD_StopCrypto1();
}

/**
 * Helper routine to dump a byte array as hex values to Serial. 
 */
void printHex(byte *buffer, byte bufferSize) {
  for (byte i = 0; i < bufferSize; i++) {
    Serial.print(buffer[i] < 0x10 ? "0" : "");
    Serial.print(buffer[i], HEX);
  }
}

/**
 * Helper routine to dump a byte array as dec values to Serial.
 */
void printDec(byte *buffer, byte bufferSize) {
  for (byte i = 0; i < bufferSize; i++) {
    Serial.print(buffer[i] < 0x10 ? "0" : "");
    Serial.print(buffer[i], DEC);
  }
}

Credits

Special Thanks to my friend Neetu.