Create A Simple GUI For USB RFid Reader EM4100 Using Raspberry Pi

Don't know how to interface USB RFid Reader with Raspberry Pi? Read this tutorial.


Today I would like to try to interface 125KHz USB RFID Smart Card Reader EM4100. Since it is using USB cable, I choose Raspberry Pi as a controller. Even it is using USB, it is not require a driver to interact with computer. You can open any text editor, once the reader detects tag, it will read and display the tag ID to the text editor. But, how if you want to put it in the program? Let’s try!


This video will show you how to create a simple GUI for USB RFid reader model EM4100 using Raspberry Pi.

Hardware Preparation

This is the list of items used in the video.

Sample Program

This is the sample code for creating a simple GUI, reading RFid tag and compare to the database. You need to create a file named Database.csv before you can run this code. For more details, please refer to the video.

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 = ""
rfidStatus.repeat(1000, checkRFidTag)
def checkRFidTag():
tagId = rfidText.value
if tagId != "":
RFidRegistered = False
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"]
rfidStatus.after(5000, clearDisplay)
if RFidRegistered == False:
print("RFid tag is not registered")
rfidStatus.value = "RFid tag is not registered"
rfidStatus.after(3000, clearDisplay)
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")

view raw
hosted with ❤ by GitHub

Thank You


  1. Raspberry Pi: Getting started with GUIs
  2. GUI library package – guizero
  3. Library to control GPIO on Raspberry Pi – gpiozero

Thanks for reading this tutorial. If you have any technical inquiry, please post at Cytron Technical Forum.

4 thoughts on “Create A Simple GUI For USB RFid Reader EM4100 Using Raspberry Pi”

  1. Dah cucuk RFID Reader dkt raspberry pi 4 tapi data tk boleh baca. Even scan data untuk display dkt text file pun tk boleh. Seakan dia tk functioning kt rpi4. Perlu install driver baru ataupun ada cara lain? Mohon beri pencerahan.

  2. Could we do writing process as we do read operation, I mean before the reading process from Database.csv, I want to enter the names right before manually with the help of another function and write it down to the Database.csv file.

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

BLTouch Installation for Ender 3 with 32-bit V4.2.2 Board
Pick and Send Random Meal’s Option and Locations through Telegram Bot Using Grove WiFi 8266 on micro:bit
DIY Automated Vacuum Cleaner Using REKA:BIT With Micro:bit
Rainbow Spark in Mini House using Maker Uno.
TinyML on Arduino using Edge Impulse
Tutorials of Cytron Technologies Scroll to Top