14
By Deligence Technologies www.deligence.com Attendance system using MYSQL with Raspberry pi and RFID-RC522

Attendance system using MYSQL with Raspberry pi and RFID-RC522

Embed Size (px)

Citation preview

Page 1: Attendance system using MYSQL with Raspberry pi and RFID-RC522

By Deligence Technologies www.deligence.com

Attendance system using MYSQL with Raspberry pi and RFID-RC522

Page 2: Attendance system using MYSQL with Raspberry pi and RFID-RC522

WHAT WE WILL COVER?Project Description

Software Used

Hardware Used

Raspberry Pi 3 Pin Block Diagram

Brief Description of Raspberry Pi

Node MCU V3 and Its Circuit Diagram

Node MCU Code

Database Python Script Code

Video Presentation

Page 3: Attendance system using MYSQL with Raspberry pi and RFID-RC522

Project Description Attendance system using MYSQL with Raspberry pi and RFID-RC522:

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

Page 4: Attendance system using MYSQL with Raspberry pi and RFID-RC522

Software Used

Raspbian OSArduino IDEMy SQL Database

Page 5: Attendance system using MYSQL with Raspberry pi and RFID-RC522

Hardware Used

Raspberry piNode MCU V3 RFID Reader with TagJumper Wire

Page 6: Attendance system using MYSQL with Raspberry pi and RFID-RC522

Raspberry Pi 3 Pin Block Diagram

Page 7: Attendance system using MYSQL with Raspberry pi and RFID-RC522

Brief Description of 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.)

Page 8: Attendance system using MYSQL with Raspberry pi and RFID-RC522

Node MCU V3NodeMCU 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. Circuit Diagram

Page 9: Attendance system using MYSQL with Raspberry pi and RFID-RC522

Node MCU Code#include <RFID.h>Include the standard Arduino SPI library */#include <SPI.h>/* Include the RFID library */#include <RFID.h>

/* Define the DIO used for the SDA (SS) and RST (reset) pins. */#define SDA_DIO 10#define RESET_DIO 9/* Create an instance of the RFID library */RFID RC522(SDA_DIO, RESET_DIO);

void setup(){ Serial.begin(9600); /* Enable the SPI interface */ SPI.begin(); /* Initialise the RFID reader */ RC522.init();} Continue---

Page 10: Attendance system using MYSQL with Raspberry pi and RFID-RC522

void loop(){ /* Has a card been detected? */ if (RC522.isCard()) { /* If so then get its serial number */ RC522.readCardSerial(); Serial.print("Card detected:"); Serial.print(" "); for(int i=0;i<5;i++) { Serial.print(RC522.serNum[i],DEC); //Serial.print(RC522.serNum[i],HEX); //to print card detail in Hexa Decimal format } Serial.print(" ");

Serial.print("RFID NAME SERIES: "); Serial.print(" "); Serial.print(522); Serial.println(" "); } delay(2000);}

Page 11: Attendance system using MYSQL with Raspberry pi and RFID-RC522

Database Python Script Code#!/usr/bin/pythonimport serialimport timeimport MySQLdb#establish connection to MYSQL.dbConn=MySQLdb.connect("localhost","root","DB_Password","DB_Name") or die ("could not connect to database")#open a cursor to the databasedevice="""/dev/ttyACM0"""try: print "Trying...",device arduino=serial.Serial(device,9600)except: print"Failed to connect on",devicewhile True: time.sleep(1) Continue -----

Page 12: Attendance system using MYSQL with Raspberry pi and RFID-RC522

try: data=arduino.readline() #read data from arduino print data pieces=data.split(" ") #split data by tab try: cursor=dbConn.cursor() cursor.execute("""INSERT INTO DB_Table_Name VALUES(NULL,%s,%s)""",(pieces[1],pieces[3])) dbConn.commit() #commit the insert cursor.close() #close the cursor except MYSQLdb.IntegrityError: print"failed to insert data" finally: cursor.close() # close in case it failed except: print"Processing!"

Page 13: Attendance system using MYSQL with Raspberry pi and RFID-RC522

Connect with us –

www.deligence.com/contact-usEmail : [email protected] : +91 9910130340

Page 14: Attendance system using MYSQL with Raspberry pi and RFID-RC522