Reputation: 165
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.
Upvotes: 3
Views: 14880
Reputation: 7218
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/
Upvotes: 3