Skip to content

RFID-RC522 module usage instructions #2613

Closed

Description

@pelwell

A few years ago I wrote some tried and tested instructions for wiring up the RFID-RC522 module, installing the SPI-Py library, and the MFRC-522 python library and test application. The thread where it appeared (#1547) is now so long that the relevant comment is hidden by default, and the whole thread takes ages to load.

This issue is a repost of that comment.

========

Starting from a clean current Raspbian install:

  1. Use the following wiring:
RFID-RC522 Pin Raspberry Pi Pin Raspberry Pi Pin name SPI1 Pin SPI1 Pin name
SDA/NSS 24 GPIO8 12 GPIO18
SCK 23 GPIO11 40 GPIO21
MOSI 19 GPIO10 38 GPIO20
MISO 21 GPIO9 35 GPIO19
IRQ None None None None
GND 20 GND 34 GND
RST 22 GPIO25 22 GPIO25
3.3V/VCC 17 3V3 17 3V3

Note that there are multiple versions of the module with different pin-outs - I've shown the pin names from two that I know.

  1. Run sudo raspi-config, choose Advanced Options -> SPI -> Yes . You can reboot, but it isn't necessary (dtoverlay -l will show that there is a run-time overlay that enables the SPI interface).

  2. Install git and python-dev:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-dev git
  1. Install the SPI-Py library:
git clone https://github.com/lthiery/SPI-Py.git
cd SPI-Py
sudo python setup.py install
cd ..
  1. Install MFCR522-python:
cd ~
git clone https://github.com/pelwell/MFRC522-python.git
cd MFRC522-python/
  1. Run the script:
sudo python Read.py

If it still doesn't work, triple-check your wiring then upload a photo of it. Also make sure your power-supply is up to the task - 2.5A for a Pi3.

Activity

  1. pelwell commented on Jul 10, 2018

    @pelwell
    ContributorAuthor

    Closing to escape the attentions of the @JamesH65 bot.

  2. JamesH65 commented on Jul 10, 2018

    @JamesH65
    Contributor

    Too late...

    Is this something that out to be in docs somewhere, or perhaps the projects section (not my domain)?

  3. pelwell commented on Jul 11, 2018

    @pelwell
    ContributorAuthor

    Is there any equivalent, application-specific documentation? It does seem like more of a project to me, but just having this short (but growing...) thread with the important information at the top should be sufficient.

  4. pelwell commented on Nov 26, 2018

    @pelwell
    ContributorAuthor

    There's also a simple Python app that uses the SPI-Py library to read registers here.

    When you run it you should see output like this:

    pi@raspberrypi:~$ python MFRC522_test.py
    00: 00 20 80 00 14 00 00 21
    08: 00 93 00 08 10 00 a0 00
    10: 00 3f 00 00 80 00 10 84
    18: 84 4d 00 00 62 00 00 eb
    20: 00 ff ff 88 26 87 48 88
    28: 20 20 00 00 00 00 00 00
    30: 00 00 00 80 00 00 40 92
    38: 00 00 00 88 ff 00 03 00
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions