Skip to content

Instantly share code, notes, and snippets.

@IdrisCytron
Created July 25, 2019 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save IdrisCytron/f2560979e4d1310d1f92c4b3481a063e to your computer and use it in GitHub Desktop.
Save IdrisCytron/f2560979e4d1310d1f92c4b3481a063e to your computer and use it in GitHub Desktop.
Create a simple GUI for USB RFid Reader EM4100 using Raspberry Pi.
from gpiozero import LED, Buzzer
from guizero import App, Box, Text, TextBox, warn
import csv
led8 = LED(19)
def clearDisplay():
print("Clear display")
rfidStatus.value = "---"
rfidText.value = ""
led8.off()
rfidStatus.repeat(1000, checkRFidTag)
def checkRFidTag():
tagId = rfidText.value
if tagId != "":
RFidRegistered = False
print(tagId)
with open("Database.csv") as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
if row["RFid"] == tagId:
RFidRegistered = True
print("Welcome " + row["User"])
rfidStatus.value = "Welcome " + row["User"]
led8.on()
rfidStatus.after(5000, clearDisplay)
if RFidRegistered == False:
print("RFid tag is not registered")
rfidStatus.value = "RFid tag is not registered"
rfidStatus.after(3000, clearDisplay)
rfidStatus.cancel(checkRFidTag)
app = App(title="RFID EM4100 Simple GUI", width=350, height=150, layout="auto")
instructionText = Text(app, text="Click on the text button below\nand scan your RFid tag.")
rfidText = TextBox(app)
rfidStatus = Text(app, text="---")
rfidStatus.repeat(1000, checkRFidTag)
designBy = Text(app, text="Design by Idris - Cytron Technologies", align="bottom")
app.display()
@renatojobal
Copy link

Hi! Thanks for sharing it. Could you tell me wich python version are you using?

@IdrisCytron
Copy link
Author

IdrisCytron commented Oct 23, 2019

Hi! Thanks for sharing it. Could you tell me wich python version are you using?

You can refer to this tutorial https://tutorial.cytron.io/2019/07/25/create-a-simple-gui-for-usb-rfid-reader-em4100-using-raspberry-pi/. The video is in the Malay language, but there have English subs. Hope this helps.

@renatojobal
Copy link

@IdrisCytron Nice! Thanks for answering! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment