Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UHF RFID Reader and Python

I‘m looking for a UHF RFID Reader, that can be easily controlled with a raspberry pi and a python3 library. I could only find readers that were for arduino or serial.

like image 862
umgefahren Avatar asked Sep 12 '26 15:09

umgefahren


1 Answers

Mostly all RFID readers work on serial communication. So you can easily use any serial port python library to connect to RFID module and get the RFID tag id. This will work on any type of machine i.e. windows, linux or raspberry pi.

For ex, follow below code:

import serial

rfid_serial_port = serial.Serial("/dev/ttyUSB0", 9600)

id_num = []
i = 0
while True:
    serial_data = self.rfid_serial_port.read()
    data = serial_data.decode('utf-8')
    i = i + 1
    if i == 12:
        i = 0
        ID = "".join(map(str, id_num))
        print(ID)
    else:
        id_num.append(data)

Or you can use pyembedded python library

pip install pyembedded

from pyembedded.rfid_module.rfid import RFID
rfid = RFID(port='/dev/ttyUSB0', baud_rate=9600)
print(rfid.get_id())

https://pypi.org/project/pyembedded/

like image 112
S Andrew Avatar answered Sep 14 '26 04:09

S Andrew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!