RC522 RFID card suddnely stopped working on raspberry pi

516 Views Asked by At

i have RC522 RFID module and recently stopped reading on raspberry pi i enter the write code but nothing happen (tried on diffrent chips ) i have already worked with it few days before and it was working just fine since i thought it damaged i tried it on Arduino uno and it worked fine i even checked and enbaled SPI again but nothing is working i hope someone can help me i'm doing my final project and i'm running out of time

(i checkec pins many times and they're correct i used this tutorial with wiring and code : https://pimylifeup.com/raspberry-pi-rfid-rc522/)

the code:

#!/usr/bin/env python

import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522

reader = SimpleMFRC522()

try:
        text = input('New data:')
        print("Now place your tag to write")
        reader.write(text)
        print("Written")
finally:
        GPIO.cleanup()

i managed to make this work following exactly what i did

sudo apt update
sudo apt upgrade
sudo apt install python3-dev python3-pip
sudo pip3 install spidev
sudo pip3 install mfrc522

mkdir ~/pi-rfid 
cd ~/pi-rfid
sudo nano Write.py

and the code:

#!/usr/bin/env python

import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522

reader = SimpleMFRC522()

try:
        text = input('New data:')
        print("Now place your tag to write")
        reader.write(text)
        print("Written")
finally:
        GPIO.cleanup()

and if it didnt work i recommend

mkdir ~/pi-rfid  #u don’t have to do this if u already made this
cd ~/pi-rfid
sudo apt update
sudo apt upgrade
sudo apt install python3-dev python3-pip
sudo pip3 install spidev
sudo pip3 install mfrc522
#baiscly we installing it inside the folder itself

and write the code above then run by

sudo python3 Write.py 
0

There are 0 best solutions below