Evan c
Published © GPL3+

Rfid authentication system

A system that will let you in if you have the right rfid card.

IntermediateWork in progress1 hour288
Rfid authentication system

Things used in this project

Hardware components

Raspberry Pi 4 Model B
Raspberry Pi 4 Model B
×1
Breadboard (generic)
Breadboard (generic)
×1
Sunfounder GPIO extenstion board
×1
RFID reader (generic)
×1
rfid tags
×1
Sunfounder S8550 Transistor
×1
Buzzer
Buzzer
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
Adafruit gpio extension cable
×1
Jumper wires (generic)
Jumper wires (generic)
×1
female to male jumper wires
×1
Resistor 220 ohm
Resistor 220 ohm
×1

Story

Read more

Code

Main code

Python
Put wherever you want. This is the only code needed.
import time
from mfrc522 import SimpleMFRC522
import RPi.GPIO as GPIO
import LCDCONTROL as LCD1602
import os
GPIO.setmode(GPIO.BCM)
reader = SimpleMFRC522()
LCD1602.init()
GPIO.setup(17, GPIO.OUT) 
Buzz = GPIO.PWM(17, 1100)#Change 1100 to desired Hz

def main():
    while True:
        print("Reading...Please place the card...")
        LCD1602.write(0, 0, 'Place the card')
        id, text = reader.read()
        LCD1602.clear()
        if id == 111111111111 : #replace the ones with your card id
            LCD1602.write(0, 0, 'Success')
            time.sleep(4)
            LCD1602.clear()
        else:
            LCD1602.write(0, 0, 'Access Denied')
            os.system('curl -H "X-Priority: 5" -d "Access denied has been activated" nfty.sh/YourTopicName')
            Buzz.start(50)
            time.sleep(2)
            Buzz.stop()
            time.sleep(8)
            LCD1602.clear()
            
        
            
        time.sleep(3)
        
def destroy():
    GPIO.cleanup()
    LCD1602.clear()
    
if __name__ == '__main__':
    try:
        main()
    # When 'Ctrl+C' is pressed, the program destroy() will be  executed.
    except KeyboardInterrupt:
        destroy()


                                                                                                       

Install packages

BatchFile
Run in terminal.
pip3 install mfrc522 RPi.GPIO smbus2 LCDCONTROL --break-system-packages
sudo apt-get install i2c-tools

Credits

Evan c
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.