Raspberry Pi 3 Model B & MIFARE RC522 RFID Tag Reading

37,200

27

29

Posted

Introduction: Raspberry Pi 3 Model B & MIFARE RC522 RFID Tag Reading

*EDIT: This instructable was updated to use the latest raspbian version (2017-04-10)

This instructable is about reading rfid tags using the MIFARE RC522 RFID
module and a Raspberry pi 3 B. I'm not an expert in any way concerning electronics or IoT for that matter so I'm just sharing personal experience and the solution I found after nights of testing every proposed solution I came across the web.

The module I bought is using the SPI Interface. Not all modules support it. You might have bought an identical module that supports UART or some other interface. So before we begin check again that your module supports SPI.

Step 1: Solder the Module Pins

IMPORTANT: Some shops ship the module with two pin headers. A straight-one and one in an L shape (90 degrees angle). If your module came with the pin header not soldered onto the module board then solder the module pins or else the module will not work.

This is my first soldering so don't do what I did. I put too much solder on the contacts which resulted in these little shiny balls of solder. For proper soldering, I followed Adafruit Guide To Excellent Soldering

Step 2: Connect the Raspberry Pi GPIO Pins to the Module

Connect the Raspberry Pi GPIO pins to the module according to the next table:


Pin name Pin

SDA --> 24

SCK --> 23

MOSI --> 19

MISO --> 21

GND --> 6

RST --> 22

3.3V --> 1

I use a breadboard in my project. The connections are implemented in the same way, though. Feel free to connect the Pi's GPIO Pins directly to the module Pins if you have female-to-female jumper cables.

Step 3: Install & Configure the Right Software

  • When you're done with the installation, open a console and hit

raspi-config

  • Use the interactive menu to enable the SPI Interface.
  • Reboot your PI using:

sudo reboot

  • When you login again check to see that the SPI Interface is enabled

sudo nano /boot/config.txt

Try to find a line that says:

dtparam=spi=on

If you see the above line then SPI is enabled

  • Save & Reboot your PI using:

sudo reboot

  • When you login again check to see that the spi_bcm2835 module is loaded

lsmod | grep spi

  • Install python2.7-dev: [thanks Teenage kicks, IngmarV2]

sudo apt-get install python2.7-dev

  • Download and Install SPI-Py executing the following commands:

git clone https://github.com/lthiery/SPI-Py.git
cd SPI-Py

sudo python setup.py install

python Read.py

NOTE: You can install other python libraries too. This is just for reference.

Step 4: Acknowledgements & Helpful Links

Share

Recommendations

  • Epilog Challenge 9

    Epilog Challenge 9
  • Paper Contest 2018

    Paper Contest 2018
  • Gluten Free Challenge

    Gluten Free Challenge
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

26 Comments

i followed all the steps you mentioned above but i am getting only these two lines as output. i updated and upgraded also.

Welcome to the MFRC522 data read example

Press Ctrl-C to stop.

i am not getting any uid's.

i am also facing the same problem ..... so plz tell me what you did to resolve the problem

Hi ChaitraN1,

I can't give you an answer if you don't provide any info. i.e. What is your module? What version of raspbian are you using? etc

Michael

Hi ChaitraN1,

In the meantime I updated the instructable to use the latest raspbian version (2017-04-10). Please see if it resolves the issues you had.

Michael

I got exactly the same problem.

Followed the instruction, tripple checked the wiring, all I get is:

Welcome to the MFRC522 data read example

Press Ctrl-C to stop.

SPI Module is the spi_bcm2835

The RC522 Kit I use is this one:

http://www.ebay.de/itm/252715001811?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

Got mine to work, was a broken RC522 module.

Thanks to mbellas for the help. :)

hopefully you see this. My email is nch1066@gmail.com I need help i get a message."can't open device: Permission denied Aborted . I have checked and my SPI is enabled. This worked for me a week back and i was able to read my tags. I have been searching everywhere and need help. Preferably Email me so i will see it

1.As connect to 7" inch LCD used resolution of 800*400 pixel &the capactive touch.HDMI and USB its working properly.

2.while using 2nd link RFID RC522 reader is working properly

3.while join the both RFID unable to Read the Tags

4.what is the steps for I2C to connect the RFID RC522 to raspberrypi which library file was installed in that

can u Checking following list may resolve

the issue.

>>https://alselectro.wordpress.com/2016/08/20/7-touch-screen-lcd-for-raspberry-pi-driver-installation-with-virtual-keyboard/

>>http://raspmer.blogspot.in/2015/07/how-to-use-rfid-rc522-on-raspbian.html

Thanks for the instructable! Followed all the steps but I am getting the following error:

File "Read.py", line 47

key = [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]

^

SyntaxError: invalid syntax

How can I fix this?

2017-06-23-060140_1824x984_scrot.png