Raspberry Pi – RFID Card Reader

In this video I’ll be showing you how to use a Mifare RFID card reader with the Raspberry Pi.

For this project you’ll be needing the following items:

  • Raspberry Pi (I’ll be using the Model 2 B)
  • SD card with a Raspbian jessie image on it
  • MiFare RFID reader
  • Suitable usb power supply
  • Jumper wires
  • Connection to a network

To begin I’ll be inserting the SD card into the Pi followed by connecting the card reader to the Raspberry Pi’s GPIO pins using the jumper wires.

Wiring connections

SDA -> Pin 24
SCK -> Pin 32
MOSI -> Pin 19
MISO -> Pin 21
RST -> Pin 22
3.3v -> Pin 1


Once connected we can then power up the Pi and connect to it via SSH

We can then login to the Pi with the default username pi and password raspberry.

Then run these two commands to update our Pi and install Python.

sudo apt-get update
sudo apt-get install -t jessie python-dev

Followed by this command to install a GPIO library for Python.

sudo apt-get install python-rpi.gpio

Using these commands we can download and install this Python SPI extension.

git clone https://github.com/lthiery/SPI-Py.git
cd SPI-Py
sudo python setup.py install

Once installed we need to edit this configuration file and add two lines to enable SPI on the Pi

sudo nano /boot/config.txt


To test out the card reader i’m going to download and run this python read example.

git clone https://github.com/mxgxw/MFRC522-python.git
cd MFRC522-python
sudo python Read.py