Hello there,
I bought this RFID Reader for a little project with my raspberry pi. I know that the pi is not supported according to the wiki article I linked there, but maybe someone can help me anyway.
Setup
First things first, here is my setup. I got a Raspberry Pi 1 B+, the RFID reader mentioned above and a logic level converter to level down the 5V of the reader output to the 3.3V the receiving UART pin of the pi requires.
Here is my schematic.
Maybe I already have an error here, who knows.
Problem
When running a python script to read receiving uart pin I can’t seem to get a clean reading and once I get a valid reading, the reader stops working.
I’m using an rfid card with the following number on it
005744819 087,43187
If I use the following script
import serial
UART = serial.Serial("/dev/ttyAMA0", baudrate=9600, timeout=1)
while True:
rcv = UART.read(14)
if rcv:
print "READ CARD : %s" % rcv
to simply read the serial output of the rfid reader and print it to the console I get the following results:
pi@raspberrypi:~ $ sudo python test2.py
READ CARD : 8
READ CARD : x���x�����x
READ CARD : ����x�����
READ CARD : ����x����x
READ CARD : ����x�����
READ CARD : ����x�����
READ CARD : ����x����x
READ CARD : ����x�����
READ CARD : ���x����x
READ CARD : 120057A8B35E
It always gets to 120057A8B35E eventually, sometimes it takes a bit longer, sometimes it’s faster. So far I can’t recognize any pattern to this. And as mentioned before whenever it gets to that output, the rfid reader won’t read anything else anymore. Not the same card, not any other card, nothing. Until I stop and restart the script.
I also tried using a library for reading uem4100 rfid cards like this one https://github.com/philippmeisberger/pyrfid but it always fails with errors like
[Exception] invalid literal for int() with base 16: ‘x’
or
[Exception] invalid literal for int() with base 16: ‘\x00’
which I can understand, since the reader seems to pick up lots of clutter before actually getting to the valid value of the card.
Any help on this matter would be greatly appreciated. I would love to know if I’m doing something wrong or if I’m misunderstanding anything. Maybe the reader is broken even, but I wouldn’t know since I don’t have anything to compare it to.