All Projects → firsttris → Mfrc522 Rpi

firsttris / Mfrc522 Rpi

Licence: mit
🔑 Control your MFRC522 RFID Module with your Raspberry-pi and JavaScript

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Mfrc522 Rpi

Raspap Webgui
Simple wireless AP setup & management for Debian-based devices
Stars: ✭ 3,383 (+3617.58%)
Mutual labels:  raspberry-pi, rpi
Gentoo On Rpi 64bit
Bootable 64-bit Gentoo image for the Raspberry Pi4B, 3B & 3B+, with Linux 5.4, OpenRC, Xfce4, VC4/V3D, camera and h/w codec support, weekly-autobuild binhost
Stars: ✭ 831 (+813.19%)
Mutual labels:  raspberry-pi, rpi
Cylon
JavaScript framework for robotics, drones, and the Internet of Things (IoT)
Stars: ✭ 3,862 (+4143.96%)
Mutual labels:  raspberry-pi, chip
Margoulineur2000
NFC
Stars: ✭ 24 (-73.63%)
Mutual labels:  card, nfc
Raspberrypi tempmon
Raspberry pi CPU temperature monitor with many functions such as logging, GPIO output, graphing, email, alarm, notifications and stress testing. Python 3.
Stars: ✭ 52 (-42.86%)
Mutual labels:  raspberry-pi, rpi
Amiberry
Optimized Amiga emulator for the Raspberry Pi and other ARM boards
Stars: ✭ 270 (+196.7%)
Mutual labels:  raspberry-pi, rpi
Enclosure Picroft
Mycroft interface for Raspberry Pi environment
Stars: ✭ 649 (+613.19%)
Mutual labels:  raspberry-pi, rpi
Boombeastic
A Raspberry Pi based smart connected speaker with support for airplay, spotify, mpd and local playback
Stars: ✭ 195 (+114.29%)
Mutual labels:  raspberry-pi, rpi
Rpi Battery Monitor
Monitor battery voltage from a Raspberry Pi
Stars: ✭ 51 (-43.96%)
Mutual labels:  raspberry-pi, rpi
Mifare Classic Toolkit
RFID / NFC :: Mifare Classic 1k info and tools
Stars: ✭ 46 (-49.45%)
Mutual labels:  nfc, card
tripreader-data
“读卡识途”项目公开数据
Stars: ✭ 58 (-36.26%)
Mutual labels:  card, nfc
Chameleonmini
The ChameleonMini is a versatile contactless smartcard emulator compliant to NFC. The ChameleonMini was developed by https://kasper-oswald.de. The device is available at https://shop.kasper.it. For further information see the Getting Started Page https://rawgit.com/emsec/ChameleonMini/master/Doc/Doxygen/html/_page__getting_started.html or the Wiki tab above.
Stars: ✭ 1,133 (+1145.05%)
Mutual labels:  nfc, card
Cattlepi
effortlessly boot, configure, update and monitor your raspberry pi ☁️
Stars: ✭ 250 (+174.73%)
Mutual labels:  raspberry-pi, rpi
Meta Raspberrypi
Yocto BSP layer for the Raspberry Pi boards
Stars: ✭ 276 (+203.3%)
Mutual labels:  raspberry-pi, rpi
Mqtt Io
Expose GPIO modules (Raspberry Pi, Beaglebone, PCF8754, PiFace2 etc.) and digital sensors (LM75 etc.) to an MQTT server for remote control and monitoring.
Stars: ✭ 234 (+157.14%)
Mutual labels:  raspberry-pi, rpi
Pinn
An enhanced Operating System installer for the Raspberry Pi
Stars: ✭ 530 (+482.42%)
Mutual labels:  raspberry-pi, rpi
Johnny Five
JavaScript Robotics and IoT programming framework, developed at Bocoup.
Stars: ✭ 12,498 (+13634.07%)
Mutual labels:  raspberry-pi, chip
Rpi gpio
Ruby conversion of RPi.GPIO Python module
Stars: ✭ 185 (+103.3%)
Mutual labels:  raspberry-pi, rpi
Gassistpi
Google Assistant for Single Board Computers
Stars: ✭ 911 (+901.1%)
Mutual labels:  raspberry-pi, rpi
Openvoiceos
OpenVoiceOS is a minimalistic linux OS bringing the open source voice assistant Mycroft A.I. to embbeded, low-spec headless and/or small (touch)screen devices.
Stars: ✭ 64 (-29.67%)
Mutual labels:  raspberry-pi, rpi

mfrc522-rpi

🔑 JavaScript class to control MFRC522 RFID Module with your Raspberry-pi

MFRC522 is integrated in all types of 13.56MHz RFID passive contactless communication methods and protocols.

It uses the ISO14443 specification to communicate to MIFARE cards (also known as NTAG, NFC) MIFARE wiki ISO14443 wiki

Features

  • Read uid & card memory
  • Write card memory & card key
  • Buzzer notification (Optional)

Demo

Example

Watch on Youtube (with sound)

Enable SPI

The SPI master driver is disabled by default on Raspbian. To enable it, use raspi-config, or ensure the line dtparam=spi=on isn't commented out in /boot/config.txt. When it is enabled then reboot your pi. If the SPI driver was loaded, you should see the device /dev/spidev0.0

more info about SPI

Install

npm version

npm install mfrc522-rpi

node-rpio Compatibility

  • Raspberry Pi Models: A, B (revisions 1.0 and 2.0), A+, B+, 2, 3, 3+, 3 A+, 4, Compute Module 3, Zero.
  • Node.js Versions: 0.8, 0.10, 0.12, 4, 5, 6, 7, 8, 9, 10, 11, 12

Usage

The examples in the test folder will help you get things started

read uid

node /node_modules/mfrc522-rpi/test/read.js

dump card

node /node_modules/mfrc522-rpi/test/dumpCard.js

dump NTAG213 (sticker)

node /node_modules/mfrc522-rpi/test/dumpNTAG213.js

write NTAG213

https://github.com/firsttris/mfrc522-rpi/issues/5 Thanks to musdom

write card

node /node_modules/mfrc522-rpi/test/write.js

Card Register

Your MiFare NFC chip consists of multiple sectors, each containing 4 blocks. The first 3 blocks of every sector are used to store data, the last block contains security features (access keys and bits). Every block holds 16 bytes of data. A typical MiFare Classic 1K chip has 16 of these sectors, accounting to 64 blocks with 1024 bytes in total.

The first sector is reserved for manufacturer data, while the second sector is supposed to contain card holder data. So, to be on the safe side, start writing your data on the third sector, starting with block 8.

Every last block of a sector is called a trailer block. It contains two access keys, which are used for protecting the data against unpermitted access, and access bits controlling what can be done with this sector. The first 6 bytes of such a block contain access key A, the following 4 bytes are the access bits, and the last 6 bytes are access key B (optional key).

Please note that when reading a trailer block with this module, it will always return the same (incorrect) values regardless of its actual content. This might be a security feature of the chips.

For simplicity reasons, this module will always authenticate with and refer to key A only. The default key A on new cards is always [0xff, 0xff, 0xff, 0xff, 0xff, 0xff].

The access bits in the middle of a sector trailer block should never be changed without exactly knowing what you're doing. They control what can be done with the current sector and which of the access key(s) can be used for authentication. If they don't make sense, the sector (4 blocks) is irreversively blocked and can never be used again.

If you want to safely change the access key for a sector, please use the writeAuthenticationKey method (see the writeAuthenticationKey.js example in test). Always store the new access key(s) somewhere safe.

Physical memory content of the chip/card which was included on the RFID-RC522 Module

Block: 0 Data: 89,229,151,26,49,8,4,0,98,99,100,101,102,103,104,105
Block: 1 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 2 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 3 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 4 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 5 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 6 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 7 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 8 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 9 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 10 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 11 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 12 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 13 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 14 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 15 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 16 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 17 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 18 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 19 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 20 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 21 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 22 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 23 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 24 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 25 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 26 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 27 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 28 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 29 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 30 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 31 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 32 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 33 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 34 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 35 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 36 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 37 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 38 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 39 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 40 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 41 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 42 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 43 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 44 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 45 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 46 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 47 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 48 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 49 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 50 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 51 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 52 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 53 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 54 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 55 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 56 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 57 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 58 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 59 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255
Block: 60 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 61 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 62 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Block: 63 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255

Changing Authentication Keys

This has so far only been tested with MiFare Classic 1K cards (the ones that come with the reader)! Please use the writeAuthenticationKey method (see the writeAuthenticationKey.js example in test).

Documentation

Manufacturer documentation of MFRC522

MFRC522-Doc.pdf

NFC-TAG Types

NTAG213_215_216.pdf

Wiring

Follow the map here to do the interface pins.

Name Pin # Pin name
SDA 24 CE0
SCK 23 SCLK1
MOSI 19 MOSI1
MISO 21 MOSO1
IRQ None None
GND Any Any Ground
RST 22 GPIO5C3
3.3V 1 3V3
Buzzer 18 GPIO5B3 (Optional)

Note that the pins number is different from the BCM number.

Screenshot

Screenshot

Which hardware is used?

List of hardware which are used with links to amazon.de:

Buzzer Notifications (optional)

It's possible to get buzzer notifications when the module reads a chip, simply connect a piezo speaker to your PI.

Components for Buzzer

Those three optional component are required to run the buzzer with 5V. The RC522 is running at 3.3V so we need to step down the voltage a bit.

Wiring with Buzzer

Screenshot

Demonstration

  • Some images and video demonstration can be found here

Circuit Diagram:

Inside project-diagram folder there is a diagram for the system. You can run it with Fritzing application and make a printable PCB after aligning components on your wish.

Sources

https://github.com/miguelbalboa/rfid

https://github.com/mxgxw/MFRC522-python

Code of Conduct

See the CODE

License

See the LICENSE file for license rights and limitations (MIT).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].