OSSLibraries / Arduino_MFRC522v2

https://osslibraries.github.io/Arduino_MFRC522v2/
GNU Lesser General Public License v2.1
101 stars 39 forks source link

Arduino_MFRC522v2

image GitHub Actions - Arduino Compile Examples GitHub Actions - Arduino Lint image Releases image

Advanced Arduino driver library for MFRC522 and other RFID RC522 based modules.

Read and write different types of Radio-Frequency IDentification (RFID) cards on your Arduino using a RC522 based reader connected via the Serial Peripheral Interface (SPI) or I2C interface.

Hints for this version

Development

Feature status: open; focus on rfid; no applications;

Code status: open; fixes/typos or documentation updates; no specific code for other boards; avoid examples;

Maintenance status: sporadically;

Before buy

Please notice that there are many sellers (ebay, aliexpress, ...) who sell MFRC522 boards. The quality of these boards are extremely different. Some are soldered with wrong/low quality capacitors or fake/defect MFRC522.

Please consider buying several devices from different suppliers. So the chance of getting a working device is higher.

If you got a bad board and you can tell us how to detect those boards (silk, chip description, ...), please share your knowledge.

What works and not?

Compatible IDE

This library works with Arduino IDE 1.6, older versions are not supported and will cause compiler errors. The built-in library manager is supported.

If you use your own compiler, you have to enable c++11-support.

Compatible boards

This library is compatible with boards implementing the Arduino-API. You also have to change pins. See pin layout.

Some user made some patches/suggestions/ports for other boards:

Support/issue

  1. First checkout what works and not and troubleshooting .

  2. It seems to be a hardware issue or you need support to program your project? Please ask in the official Arduino forum, where you would get a much faster answer than on GitHub.

  3. It seems to be a software issue? Open an issue on GitHub.

Code style

Please use fixed integers, see stdint.h. Why? This library is compatible with different boards which use different architectures (16bit and 32bit). Unfixed int variables have different sizes in different environments and may cause unpredictable behaviour.

Pin Layout

The following tables show the typical pin layout used.

Notes:

Arduino

Signal MFRC522 Uno / 101 Mega Nano v3 Leonardo / Micro Pro Micro Yun
RST/Reset RST 9 5 D9 RESET / ICSP-5 RST Pin9
SPI SS SDA 10 53 D10 10 10 Pin10
SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16 ICSP4
SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14 ICSP1
SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15 ICSP3

ESP8266

Signal MFRC522 Wemos D1 mini
RST/Reset RST D3
SPI SS SDA D8
SPI MOSI MOSI D7
SPI MISO MISO D6
SPI SCK SCK D5

ESP32

Signal MFRC522 WROOM-32
RST/Reset RST 21
SPI SS SDA 5
SPI MOSI MOSI 23
SPI MISO MISO 19
SPI SCK SCK 18

Teensy

Signal MFRC522 2.0 ++2.0 3.1
RST/Reset RST 7 4 9
SPI SS SDA 0 20 10
SPI MOSI MOSI 2 22 11
SPI MISO MISO 3 23 12
SPI SCK SCK 1 21 13

Hardware

There are three hardware components involved:

Protocols

Security

Troubleshooting

License

GNU LESSER GENERAL PUBLIC LICENSE, Version 2.1.

It is not allowed to change the license.

Dependency

History

The MFRC522 library was first created in Jan 2012 by Miguel Balboa (from http://circuitito.com) based on code by Dr. Leong (from http://B2CQSHOP.com) for "Arduino RFID module Kit 13.56 Mhz with Tags SPI W and R By COOQRobot".

It was translated into English and rewritten/refactored in the fall of 2013 by Søren Thing Andersen (from http://access.thing.dk).

It has been extended with functionality to alter sector 0 on Chinese UID changeable MIFARE card in Oct 2014 by Tom Clement (from http://tomclement.nl).

Maintained by miguelbalboa until 2016. Maintained by Rotzbua from 2016 until 2022.