pythonraspberry-pirfid

Trying to read RFID card in Python => Lost in output format


I'm am trying to read in python an RFID card scanned with a RFID reader plugged in USB on my raspPi.

While the code looks very simple at the first sight, I'm kinda lost in the output and can't find back the decimal number written on the car.

ser = serial.Serial('/dev/tty1', 9600)
    while True:
        incomingByte = ser.read()
        hexo = str(binascii.hexlify(incomingByte))
        print(hexo)
    ser.close()

The output of this code is

b'bb'
b'c2'
b'bb'
b'c2'
b'bb'
b'c3'
b'a9'
b'e2'
b'80'
b'99'
b'28'
b'c2'
b'ab'
b'c3'
b'aa'
b'c3'
b'a9'
b'e2'
b'80'
b'99'
b'0d'

The number on the card is 0002859428043,41380

I scanned the same card by plugging in the RFID reader on my PC, here is the output àààé_(ç'é_ So I'm totally confused about all of that, I can't find the right way to find the card number.

Any help would be highly appreciated.

Thanks and all the best for this new year


Solution

  • I have resolved the issue.

    So basically, the issue was that my raspi keyboard was set to AZERTY while the reader is meant for QWERTY. So changing the localisation in the raspi config turned the output to

    b'0'
    b'0'
    b'0'
    b'4'
    b'6'
    b'5'
    b'0'
    b'7'
    b'4'
    b'3'
    b'\r'
    

    Which corresponds to my RFID card ID