Professional Documents
Culture Documents
Rfid-Rc-522 Reader Raspberry Pi: Er. Manoj S. Kavedia
Rfid-Rc-522 Reader Raspberry Pi: Er. Manoj S. Kavedia
RaspBerry Pi
Er. Manoj S. Kavedia
www.kaizenfuturetech.com
www.kavediasir.yolasite.com
9324258878 / 8329988738
Raspberry Pi Pin Out
RFID Reader
The RFID RC522 is a very low-cost RFID (Radio-frequency identification) reader and
writer that is based on the MFRC522 microcontroller.
This microcontroller provides its data through the SPI protocol and works by creating a
13.56MHz electromagnetic field that it uses to communicate with the RFID tags.
SPI
In a computer, a Serial Peripheral Interface (SPI) is an interface that enables the
serial (one bit at a time) exchange of data between two devices, one called a
master and the other called a slave .
An SPI operates in full duplex mode. This means that data can be transferred in
both directions at the same time.
The SPI is most often employed in systems for communication between the
central processing unit ( CPU ) and peripheral devices.
Note : wire all of these but the IRQ to our Raspberry Pi’s GPIO pins
MOSI (Master Output/Slave Input) – Line for the master to send data to the slave.
MISO (Master Input/Slave Output) – Line for the slave to send data to the master
Setting up Raspbian for the RFID RC522
sudo raspi-config
sudo reboot
Install the Python Library spidev to our Raspberry Pi using the python “pip” tool
The spidev library helps handle interactions with the SPI
There are two files that are included within our MFRC522 library that we make
use of:
reader = SimpleMFRC522()
try:
text = input('New data:')
print("Now place your tag to write")
reader.write(text)
print("Written")
finally:
GPIO.cleanup()
Wiring the RFID RC522
sudo python3 Write.py
reader = SimpleMFRC522()
try:
id, text = reader.read()
print(id)
print(text)
finally:
GPIO.cleanup()