3

I have the problem that the Python Scripts for the MFRC522 RFID-Reader won't start. I couldn't find any solution to this problem

I tried following this tutorial: https://pimylifeup.com/raspberry-pi-rfid-rc522

when starting the script I get this error:

pi@pi-d339203c:~/pi-rfid $ python3 Read.py
Traceback (most recent call last):
  File "Read.py", line 5, in <module>
    reader = SimpleMFRC522()
  File "/usr/local/lib/python3.5/dist-packages/mfrc522/SimpleMFRC522.py", line 14, in __init__
    self.READER = MFRC522()
  File "/usr/local/lib/python3.5/dist-packages/mfrc522/MFRC522.py", line 131, in __init__
    self.spi.open(bus, device)
FileNotFoundError: [Errno 2] No such file or directory
Lin Du
  • 88,126
  • 95
  • 281
  • 483
Bierly
  • 43
  • 1
  • 8

2 Answers2

3

I had the same issue - turns out I had SPI disabled - it's required for the MFRC522. If you're using Raspbian, run

sudo raspi-config

and enable it in there under Interfacing options -> SPI then reboot.

To check if spi is indeed enabled, run

lsmod | grep spi

the output should look something like this:

spidev                 20480  0
spi_bcm2835            20480  0

If you get no output, then spi is not enabled. I believe you can also enable it by editing /boot/config.txt

wedwo
  • 338
  • 3
  • 11
0

You don't say that you are using windows or linux, but the error message is the format used by windows IOError messages

Your path starts with "/usr/local." which is not on windows, rather linux. So you just need to fix the path to match your OS.

Marichyasana
  • 2,966
  • 1
  • 19
  • 20