Uncategorized
Asked 
Active today
Viewed 94 times
1

Trying to read my RFID MFRC522 using a Mifare blue tag and it is not working. Wondering if i could get any help on this as when i put the tag to read it doesn’t show up as quick?

using:

https://pimylifeup.com/raspberry-pi-rfid-rc522/

https://medium.com/coinmonks/for-beginners-how-to-set-up-a-raspberry-pi-rfid-rc522-reader-and-record-data-on-iota-865f67843a2d

Python coding based on the websites I've used in order to try to get my tag to read

 New contributor
0

Question

Rpi3 NOOBS python 2.7 SimpleMFRC522 cannot read Mifare tag problem.


Answer

  1. The OP used Rpi3 NOOB python 2.7, and installed himself SpiPy, SpiDev for testing.
  2. I think python 2.7 is a bit out of date. So I am repeating the OP’s situation but instead using Rpi4B buster 2020feb13 (full version image), with the following buster preinstalled software:

    (a) python 3.7.3

    (b) thonny IDE

    (c) spiDev

    (d) pip3

  3. I am using pip3 to install the MFRC522 python library, which includes the following two python3 programs:

    (a) mfrc522.py (about 400 lines)

    (b) simpleMFRC.py (about 100 lines)

  4. I am using the RFID/NFC module already tested OK using libnfc-1.7.1 in I2C configuration (Appendix A).
  5. I am using pip3 to install mrfc522, RPi.GPIO, and spidev in the following directory (Appendix B). I am not sure if the above GPIO and spidev modules are the same or different from the buster’s corresponding preinstalled programs.

    /usr/local/lib/python3.7/dist-packages

  6. I am using the built-in SPI interface /dev/spidev0.0 and /dev/spidev0.1 (Appendix C)
  7. I used python3 shell to import SimpleMFRC522 from mfrc522, and found creating a reader object OK. (Appendix D).

    from mfrc522 import SimpleMFRC522

    reader = SimpleMFRC522()

  8. I read MFRC522-python/mfrc522/SimpleMFRC522.py/ – GitHu 2019mar26 saying the following:

    @death-droid Improve compatibility with Python 3 – 2019mar26

    So I guess the earlier versions of SimpleMFRC522 were not very compatible to python3. I was wondering if my pip3 installed stuff is more or less updated than the OP’s corresponding software using Git Clone. I guess I better download the most updated versions of mfrc522, SimpleMFRC522, and the demo/test red/write tag programs and freeze them for later testing.

  9. Now have tidied up the different version of the four main programs mfrc522.py, samplemfrc522py, read.py, and write.py, and put them in a penzu reading log file. Next step is to skim the two big files to get a rough picture of what is going on.

    https://penzu.com/public/08d4fdf2

  10. Now I have skimmed the two main programs mrfc522.py and simpleMFRC522.py. I surprisingly found the program structure is very simple. So it should not not that difficult to debug and expand. The penzu reading log is here:

    https://penzu.com/p/08d4fdf2

  11. Now I have tried the SPI loopback test and found it OK. (Appendix E)
  12. I tried to repeat the OP is problem, ie, raed a tag. Still no luck, the program hanged. Because I already double checked that the NFC module can read OK the same tag using libbnfc-1.7.1 I2C mode, and SPI loopback at 50kHz is OK. So the problem is likely at the SimpleMFRC522 side. Next step is to debug Read.py, SimpleMFRC522.py and the MFRC522.py library.

simpleMFRC522 test

  1. Now I am checking the schematic of [another similar] nfc module to make sure that my guess of the IRQ and RST wiring is correct, ie, no need to connect these two pins to Rpi. This is verified by the success of libnfc-1.7.1 I2C read card without connect the RST and IRQ pins. Perhaps I can ping the module to make sure SPI Clk, Mosi, and Miso are working OK (the previous SPI loopback only tests 50kHz and only MOSI and Miso, CS is not tested.

pn532 schematic


/ to continue, …


References

(1) to continue, …


Appendices

Appendix A – The PN532 NFC/RFID Module V3 being tested

Reference: nfclib v1.1.7 PN532 NFC Module Testing

pn532 1


Appendix B – Mfrc522 software (including SPIdev and GPIO) setup record

mfrc install


Appendix C – Minimal configuration of SPI and I2C channels for testing the PN532 module

boot/config.txt


Appendix D – PiMyLifeUp Gus SimpleMFRC522 Library

simplemfrc522 lib


Appendix E – SPI Loopback Test

spi loopback test

.END

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: