RFID Contactless Reader

RFID Contactless Reader

10 May, 2016 DIY, Raspberry Pi 0

Do you need a contactless access control? Do you want to run some task depending on the card approach the reader? In this tutorial we explain how to identify a RFID card on Raspberry PI. The application shows an image on LCD display, a predefined text and the current date and time. When a card approches to the reader, a buzzer is activated and a message appears as a pop-up, which will disappear after a few seconds.

Hardware requirements:

  • IRP-102 HAT Board
  • Contactless Reader RFID MFRC522 connected to X3 SPI-1 connector
  • Buzzer or piezo speaker connected to X6 connector pin 1 and 6
  • 2 jumper wires (female-female) to connect buzzer
  • SPI Display, in our case 320x240px TFT Color

The application we have developed is for Python so it is necessary to install it from the repository. This tutorial has been made with Raspbian  operating system. As with any installation to get the latest versions of the packages you want to install will first run the following steps:

And if you want to perform an upgrade of already installed packages you run:

If you have not yet installed you should run Python (Python 2 version):

Not all Python packages are available in the Raspbian archives, and those that are can sometimes be out of date, for this, you have to install PIP (for Python 2 version):

1. Bus SPI setup

This RFID reader uses the SPI bus to communicate with the Raspberry Pi, so we must first configure it.

You must install the SPI controller if you don’t do it before. You will use the tool git to clone and install the driver. If you do not have the git package install on your system as follows:

Now clone the driver source code and perform the installation:

With this the SPI bus should be available in the system and your application can access it for card readings.

2. SPI Display installation to showing sensor data

To operate the display for the first time you can follow the tutorial Using 2.2″ LCD SPI in Python with Raspberry Pi

6. Download source code

Once you have everything working: Python for the application and SPI for reader and display, we have just download the source code used to have available at the following link:
o just

from shell.

4. Application modules description

MFRC522.py: Specific driver for this RFID reader.

It contains all the functions that can be used with this reader. The most common functions used are:

main.py: Main application.

It is important to remember that you can use the display and sensors must be imported modules:

To show some information on display:

To show messages on display as a pop-up:

initializing peripherals:

Acoustic notification function (approximate detection card) through a buzzer 19 connected to pin GPIO:

Function detect the approach of a card reader and read your ID:



About the author



Would you like to share your thoughts?

Your email address will not be published. Required fields are marked *

Leave a Reply

Uso de cookies

Este sitio web utiliza cookies para que usted tenga la mejor experiencia de usuario. Si continúa navegando está dando su consentimiento para la aceptación de las mencionadas cookies y la aceptación de nuestra política de cookies, pinche el enlace para mayor información.plugin cookies

Aviso de cookies