I failed to get my RC522 module to work using the MFRC522 library having set up the module using a Raspberry Pi 4 with Python 3.7 according to the instructions in https://www.raspberrypi-spy.co.uk/2018/02/rc522-rfid-tag-read-raspberry-pi/ this approach doesn't require the IRQ pin of the module to be connected. This seems to be the same issue faced by others. I have now used the approach given in https://github.com/ondryaso/pi-rc522 which requires the IRQ pin to be connected to GPIO24 and uses the pi-rc522 library. The cards are read OK running the programmes provided on the website. However I don't understand the code and how you would write and read a simple word to and from a card. Does anyone have experience of this approach? Alternatively how would I get my RC522 to work using MFRC522 which seems to have much simpler code.


2 Answers 2


IRQ is any interrupt pin (which we won't be using it in most of the case) which sends an interrupt signal to the CPU i.e., this signal indicates that a certain event has occurred, and requires immediate attention from the CPU. When an interrupt is triggered, the CPU stops executing its current program and jumps to a special routine called an interrupt service routine (ISR) to handle the interrupt.

In most cases we would be needing until necessary.It's better to use the SimpleMFRC522 from the mfrc522 library(if you are a beginner). here's a simple code to get you started.


import time
from mfrc522 import SimpleMFRC522
reader = SimpleMFRC522()

    while True:
        print("Place you rfid tag!")
        id, text = reader.read()
        print(f"ID: {id}")
except KeyboardInterrupt:


from mfrc522 import SimpleMFRC522

reader = SimpleMFRC522()

    data = 'Your content here'
    print("Now place your tag to write")

hope this would help :)


The most popular tutorials don't work (at least when I tried). It is possible there may be different breakout boards.

I decided to debug and found what appear to be incorrect connections.

I found the following works reliably with all the code I tried.

The following may help.

    Standard 3V MIFARE reader solution
    Rev. 3.8 — 17 September 2014

SPI needs to be enabled.

Correct connections
    3.3v connects to Pin 17
    MOSI connects to Pin 19
    MISO connects to Pin 21
    SCK connects to Pin 23
    GND connects to Pin 25
    SDA connects to Pin 24

     3.3v      17 || 18
    SPI0_MOSI  19 || 20
    SPI0_MISO  21 || 22
    SPI0_SCLK  23 || 24  CE0
     GND       25 || 26  CE1

The connection to RST pin 22 does not appear to be necessary (or even accessed by the software).

The pin labelled SDA actually appears to be NSS "SPI signal input" according to the MFRC522 datasheet. Connecting this to SPI CE0 and ignoring RST appears to work.

"NRSTPD" reset and power-down input:
power-down: enabled when LOW; internal current sinks are switched off, the
oscillator is inhibited and the input pins are disconnected from the outside
reset: enabled by a positive edge

Hard power-down is enabled when pin NRSTPD is LOW. This turns off all internal
current sinks including the oscillator. All digital input buffers are separated
from the input pins and clamped internally (except pin NRSTPD). The output pins
are frozen at either a HIGH or LOW level.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.