How to interface RFID-RC522 with Raspberry Pi


In this  tutorial, I will show you how to interface RFID-RC522 with Raspberry Pi4 with some simple step,
Make sure that the tags you purchase for your RFID RC522 operate on the 13.56MHz frequency otherwise we will fail to read them 
I have divided this tutorial into several parts. I believe that if you continue to work with me, you will be able to create projects.
Let's go 

Step-1

First, you need to collect all the materials or components you need for this project and get an idea about this component I will briefly discuss a few here

Equipment List

  1. Raspberry Pi 
  2. Micro SD Card
  3. Power Supply
  4. RC522 RFID Reader
  5. Breadboard
  6. Breadboard Wire
This book will help you to learn more about other Raspberry Pi projects and Raspberry Pi



Step-2

Raspberry pi to RFID-RC522 wiring 

  1. SDA connects to Pin 24.
  2. SCK connects to Pin 23.
  3. MOSI connects to Pin 19.
  4. MISO connects to Pin 21.
  5. GND connects to Pin 6.
  6. RST connects to Pin 22.
  7. 3.3v connects to Pin 1.

Step-3

Some default setting Change

You need to change some default configuration to connect it to Raspberry Pi, By default, the Raspberry Pi has the SPI (Serial Peripheral Interface) disabled, which is a bit of a problem as that is what our RFID reader circuit runs through. So you have to need to Change This.

. l. et's go your Raspberry Pi terminal and write sudo raspi-config

sudo raspi-config

Flow this for Changing your setting 
Some default setting Change

                  Some default setting Change



2. Now you have to need to restart your system 
sudo reboot
3. Once your Raspberry Pi has finished rebooting, we can now check to make sure that it has in fact been enabled. The easiest way to do this is to run the following command to see if spi_bcm2835 is listed.
lsmod | grep spi


Step-4

Now time to update your system and install a library

Before we start programming, we first need to update our Raspberry Pi to ensure it’s running the latest version of all the software. Run the following two commands on your Raspberry Pi to update it
and flow this commend 

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

Now time to install  RFID-RC522 library flowing this commend 
sudo pip3 install mfrc522

No comments

Theme images by Dizzo. Powered by Blogger.