*Pi RFID Reader

15 Jan

In efforts to come up with a really simple RFID reader I expanded my project to include:

– A LCD screen
– WiFi operation.
– Programmable (writable) “Master Cards”.

Basic thought process.

– Keep minimal python script.
– Program a “master card(s)” using their ID. One card will be a “Add Card” and “Delete Card”. If the ID matches the one in the Python script then allow it to write (or delete) data to a MySQL table “registeredCards”.
– PHP script will lookup “registeredCards” then query the “cardActivity” table.

passwd
sudo su –
raspi-config

cp /usr/share/zoneinfo/America/Edmonton /etc/localtime

apt-get update

apt-get install git python2.7-dev python-smbus ntp

cd ~
git clone https://github.com/lthiery/SPI-Py.git
cd SPI-Py
python setup.py install

cd ~
git clone https://github.com/sourceperl/rpi.lcd-i2c.git
cd rpi.lcd-i2c
python setup.py install

cd ~
git clone https://github.com/pimylifeup/MFRC522-python.git
cd MFRC522-python

#!/usr/bin/env python

import RPi.GPIO as GPIO
import SimpleMFRC522
import RPi_I2C_LCD
from time import *

import mysql.connector

mydb = mysql.connector.connect(
host=”localhost”,
user=”clock”,
passwd=”password”,
database=”clock”
)

mycursor = mydb.cursor()
sql = “INSERT INTO activity (name, number) VALUES (%s, %s)”

lcd = RPi_I2C_LCD.LCD()
lcd.set_backlight(True)
reader = SimpleMFRC522.SimpleMFRC522()

while True:
lcd.clear()
lcd.message(“Ready for card.”)

try:
id, text = reader.read()
print(id)
print(text)
lcd.clear()
lcd.message(text)
val = (text, id)
mycursor.execute(sql, val)
mydb.commit()
sleep(3)

except KeyboardInterrupt:
GPIO.cleanup()

sudo apt-get install apache2 php mariadb-server php-mysql python-mysql.connector

231 thoughts on “*Pi RFID Reader

  1. I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.

  2. Tìm kiếm kèo nhà cái hôm nay? Truy cập mbet.win Việt Nam tại https://mbet.win/ – nhà cái uy tín với tỷ lệ kèo chính xác, nhận định kèo chi tiết và bảo mật tuyệt đối. Trải nghiệm cá cược trực tuyến an toàn tại MBET VN ngay hôm nay!

Leave a Reply

Your email address will not be published.