RFID RC522 (Raspberry Pi)
Intro: RFID RC522 (Raspberry Pi)
Basic tutorial of how to setup a RFID reader/writer (RC522) with the Raspberry Pi.
STEP 1: Parts
RPI 3 - https://amzn.to/2VA9pQY
4 Amp Power Adapter - https://amzn.to/2CTptWu
16GB micro SD - https://amzn.to/2SFMwd3
120 pcs jumper cable: https://ebay.to/2VAb9cY
RFID Sensor - https://amzn.to/2spaDRt
STEP 2: Setup
SDA <--> 24
SCK <--> 23
MOSI <--> 19
MISO <--> 21
IRQ <--> UNUSED
GND <--> 6
RST <--> 22
3.3V <--> 1
1. Enable SPI Interface
sudo raspi-config
2. Reboot
sudo reboot
3. Check if spi_bcm2835 is loaded
lsmod | grep spi
4. Install python2.7-dev
sudo apt-get install python2.7-dev
5. Download Git Project, change directory, and install
git clone https://github.com/lthiery/SPI-Py.git
cd SPI-Py
sudo python setup.py install
6. Install MFRC522-python
git clone https://github.com/mxgxw/MFRC522-python.git
cd MFRC522-python
7. Run script
python Read.py
STEP 3: Code
https://github.com/mxgxw/MFRC522-python.git
Reading from RFID card:
https://github.com/mxgxw/MFRC522-python/blob/maste...
Writing to RFID card:
STEP 4: Additional Info
Official Website:
10 Comments
robpattondotcom 3 years ago
jloleris 4 years ago
GPIO.setup(self.NRSTPD, GPIO.OUT)
Traceback (most recent call last):
File "Read.py", line 41, in <module>
MIFAREReader = MFRC522.MFRC522()
File "/home/pi/MFRC522-python/MFRC522.py", line 135, in __init__
self.MFRC522_Init()
File "/home/pi/MFRC522-python/MFRC522.py", line 406, in MFRC522_Init
self.MFRC522_Reset();
File "/home/pi/MFRC522-python/MFRC522.py", line 138, in MFRC522_Reset
self.Write_MFRC522(self.CommandReg, self.PCD_RESETPHASE)
File "/home/pi/MFRC522-python/MFRC522.py", line 141, in Write_MFRC522
spi.transfer(((addr<<1)&0x7E,val))
TypeError: function takes exactly 2 arguments (1 given)
Please do help, and show me how to fix this, as I keep getting this error message and I have no clue how to fix it.
JodyLNC 3 years ago
If you look at the post from Alba below, it has a reply from Tomato997.
Tomato997's reply has an updated MFRC522.py script you can download and replace the existing MFRC522.py in /home/pi/SPI-Py/MFRC522-python.
Once you have this file replaced, try the python Read.py again and it should work.
That's all I did to get mine going.
Alba Esther 4 years ago
Tomato997 4 years ago
Osquar 4 years ago
Step 3 - where do I change/add the code?
And where do I clone the github for reading and writing? Apart from that, everything above works dandy :)
KschitaXino 5 years ago
I'm getting an error as:" bash: cd: MFRC522-python: No such file or directory "
why is this comming and how can i rectify this?
ChadR1 5 years ago
bhakti_dhongade 5 years ago
kaltax 5 years ago