2. 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
3. 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.
7. 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.)
8. 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.
Circuit Diagram
9. #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---
10. 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);
}
11. #!/usr/bin/python
import serial
import time
import 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 database
device="""/dev/ttyACM0"""
try:
print "Trying...",device
arduino=serial.Serial(device,9600)
except:
print"Failed to connect on",device
while True:
time.sleep(1)
Continue -----
12. 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!"