This project is aiming to provide easy access to MIFARE RFID tags using MFRC522 and Raspberry Pi.
The code itself can be ported to other platform with little effort since it's purely written in Ruby.
Ruby version 2.3+ is required.
Linux SPIDEV is required. Raspberry Pi can use raspi-config to enable.
You can install it by doing
gem install mfrc522 or using bundler.
RDoc is available at RubyDoc.
This library assumes you have the reader connected to SPI0 CE0 on Raspberry Pi.
If not, adjust the parameters when calling MFRC522 initialize method.
NRSTPD(RST) pin should be connected to 5V or something logically HIGH.
Supported RFID tags
Models supported and have been tested by the author:
- MIFARE Classic
- MIFARE Ultralight
- MIFARE Ultralight C
- MIFARE DESFire EV1, without ISO-7816 APDU
- MIFARE DESFire EV2, without ISO-7816 APDU and new features since EV1
Models implemented but not tested:
- MIFARE Ultralight EV1
Models under development:
- MIFARE Plus
If the card model you want to use is not on the list, you can implement it on top of the
The library provide basic access to ISO 14443-3 and ISO 14443-4 protocol.
Check out files in folder
test for example usage.
You have to rescue exceptions yourself.
For older versions(< 3.0.0), the underlying library
pi_piper we used is known to cause SegFault if you use it along with Gtk3 on Respbian Stretch, which comes with Ruby 2.3.3 by default. Upgrading Ruby to newer version is likely to solve the issue. Ref: issue#4