Uncategorized

RFID-RC522 Q&A

Raspberry Pi 4B – RFID-RC522 stopped working

Ask QuestionAsked todayActive todayViewed 12 times1

I connected a RFID-RC522 to my RPi 4. It was working perfectly to read data until now. I don’t know why but I cannot read anymore data now. Nothing changed in the hardware, neither the software. Maybe a configuration of the Pi changed, but I’m not sure.

I connected the pins like that:

Name    Pin #   Pin name
SDA     24      GPIO8
SCK     23      GPIO11
MOSI    19      GPIO10
MISO    21      GPIO9
IRQ     None    None
GND     Any     Any Ground
RST     22      GPIO25
3.3V    1       3V3

Here is my code (I also tried with pirc522 library):

import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522

reader = SimpleMFRC522()
print("Wait RFID tag...")
try:
    id, text = reader.read()
    print(id)
    print(text)
finally:
    GPIO.cleanup()

Nothing happens now, the code is waiting even if I put a tag front of the reader. I don’t know what I can check to see if everything is well configured. I already went to raspi-config to enable SPI. I don’t understand why it suddenly stopped to work.

Thanks in advance for your help.pi-4rfidshareedit  following  close 2flag asked 19 hours agoDark Patate1922 bronze badges

  • 1Not much we can do to help. You need to add debug/trace statements to find the failure point. abyz.me.uk/rpi/pigpio/piscope.html and/or abyz.me.uk/rpi/pigpio/examples.html#Python_monitor_py will help you check the SPI comms. – joan 18 hours ago
  • Your problem of “Code waiting if tag in front of reader” is common. There are many causes, including the following. (1) Rpi OS is upgraded, but old driver does not catch up. (2) Rpi OS reconfigured and no longer compatible to old driver. You can check the config files. If you have no luck checking all the config files, you can try my simple demo program: raspberrypi.stackexchange.com/questions/109773/… to continue, … – tlfong01 15 mins ago    
  • I would recommend the following testing procedures: (1) Get a fresh micro SD card installed with Rpi Os. (2) Follow the three parts to make sure (a) Hardware wiring is OK, (b) SPI loopback test is OK. (c) Install the simple library, (4) Use CLI commands to initialize of class and crate a tag object., (5) Use simple CLI and python statements to write and read a tag. The CLI and python statements are fully debugged. You just blindly copy and paste the text commends. Complete test procedure takes 15~30 minutes. Good luck and cheers. – tlfong01 3 mins ago   Edit   
  • PS – Your might also find the chat record of the above Q&A useful: chat.stackexchange.com/rooms/106073/…. – tlfong01 1 min ago   Edit   

add a comment

Know someone who 

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.