{"id":15020676,"url":"https://github.com/firsttris/mfrc522-rpi","last_synced_at":"2025-04-02T21:09:45.618Z","repository":{"id":56094306,"uuid":"78240982","full_name":"firsttris/mfrc522-rpi","owner":"firsttris","description":":key: Control your MFRC522 RFID Module with your Raspberry-pi and JavaScript","archived":false,"fork":false,"pushed_at":"2020-11-25T17:52:43.000Z","size":54513,"stargazers_count":120,"open_issues_count":8,"forks_count":35,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-24T02:37:08.023Z","etag":null,"topics":["card","card-memory","chip","encryption","mfrc522","nfc","nodejs","ntag","nxp","raspberry-pi","rfid","rfid-authentication","rfid-reader","rpi","wiringpi"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/firsttris.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-06T21:41:36.000Z","updated_at":"2025-03-05T23:02:40.000Z","dependencies_parsed_at":"2022-08-15T13:01:04.408Z","dependency_job_id":null,"html_url":"https://github.com/firsttris/mfrc522-rpi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firsttris%2Fmfrc522-rpi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firsttris%2Fmfrc522-rpi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firsttris%2Fmfrc522-rpi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firsttris%2Fmfrc522-rpi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firsttris","download_url":"https://codeload.github.com/firsttris/mfrc522-rpi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246892847,"owners_count":20850850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["card","card-memory","chip","encryption","mfrc522","nfc","nodejs","ntag","nxp","raspberry-pi","rfid","rfid-authentication","rfid-reader","rpi","wiringpi"],"created_at":"2024-09-24T19:55:25.503Z","updated_at":"2025-04-02T21:09:45.582Z","avatar_url":"https://github.com/firsttris.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# mfrc522-rpi\n\n:key: JavaScript class to control MFRC522 RFID Module with your Raspberry-pi\n\nMFRC522 is integrated in all types of \u003cb\u003e13.56MHz RFID\u003c/b\u003e passive contactless communication methods and protocols.\n\nIt uses the ISO14443 specification to communicate to MIFARE cards (also known as \u003cb\u003eNTAG, NFC\u003c/b\u003e)\n[MIFARE wiki](https://en.wikipedia.org/wiki/MIFARE)\n[ISO14443 wiki](https://de.wikipedia.org/wiki/ISO/IEC_14443)\n\n## Features\n\n- Read uid \u0026 card memory\n- Write card memory \u0026 card key\n- Buzzer notification (Optional)\n\n## Demo\n\n![Example](https://github.com/firsttris/mfrc522-rpi/raw/master/docs/demonstration/demo.gif)\n\n[Watch on Youtube (with sound)](https://youtu.be/e5D_fy8IIjY)\n\n## Enable SPI\n\nThe 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\n\n[more info about SPI](https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md)\n\n## Install\n\n[![npm version](https://badge.fury.io/js/mfrc522-rpi.svg)](https://badge.fury.io/js/mfrc522-rpi)\n\n```\nnpm install mfrc522-rpi\n```\n\n## [node-rpio Compatibility](https://github.com/jperkin/node-rpio/blob/master/README.md#compatibility)\n\n* Raspberry Pi Models: A, B (revisions 1.0 and 2.0), A+, B+, 2, 3, 3+,\n  3 A+, 4, Compute Module 3, Zero.\n* Node.js Versions: 0.8, 0.10, 0.12, 4, 5, 6, 7, 8, 9, 10, 11, 12\n\n## Usage\n\nThe examples in the `test` folder will help you get things started\n\n#### read uid\n\n`node /node_modules/mfrc522-rpi/test/read.js`\n\n#### dump card\n\n`node /node_modules/mfrc522-rpi/test/dumpCard.js`\n\n#### dump NTAG213 (sticker)\n\n`node /node_modules/mfrc522-rpi/test/dumpNTAG213.js`\n\n#### write NTAG213\n\nhttps://github.com/firsttris/mfrc522-rpi/issues/5 Thanks to [musdom](https://github.com/musdom)\n\n#### write card\n\n`node /node_modules/mfrc522-rpi/test/write.js`\n\n### Card Register\n\nYour MiFare NFC chip consists of multiple sectors, each containing 4 blocks.\nThe first 3 blocks of every sector are used to store data, the last block\ncontains security features (access keys and bits).\nEvery block holds 16 bytes of data. A typical MiFare Classic 1K chip\nhas 16 of these sectors, accounting to 64 blocks with 1024 bytes in total.\n\nThe first sector is reserved for manufacturer data, while the second sector\nis supposed to contain card holder data.\nSo, to be on the safe side, start writing your data on the third sector, starting\nwith block 8.\n\nEvery last block of a sector is called a trailer block. It contains two access\nkeys, which are used for protecting the data against unpermitted access, and\naccess bits controlling what can be done with this sector.\nThe first 6 bytes of such a block contain access key A, the following 4 bytes\nare the access bits, and the last 6 bytes are access key B (optional key).\n\nPlease note that when reading a trailer block with this module, it will always return\nthe same (incorrect) values regardless of its actual content. This might be a security\nfeature of the chips.\n\nFor simplicity reasons, this module will always authenticate with and refer to key A only.\nThe default key A on new cards is always `[0xff, 0xff, 0xff, 0xff, 0xff, 0xff]`.\n\nThe access bits in the middle of a sector trailer block should never be changed without\nexactly knowing what you're doing. They control what can be done with the current sector\nand which of the access key(s) can be used for authentication.\nIf they don't make sense, the sector (4 blocks) is irreversively blocked and can never\nbe used again.\n\nIf you want to safely change the access key for a sector, please use the\n`writeAuthenticationKey` method (see the `writeAuthenticationKey.js` example in `test`).\nAlways store the new access key(s) somewhere safe.\n\nPhysical memory content of the chip/card which was included on the RFID-RC522 Module\n\n```\nBlock: 0 Data: 89,229,151,26,49,8,4,0,98,99,100,101,102,103,104,105\nBlock: 1 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 2 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 3 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 4 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 5 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 6 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 7 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 8 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 9 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 10 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 11 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 12 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 13 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 14 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 15 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 16 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 17 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 18 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 19 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 20 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 21 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 22 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 23 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 24 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 25 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 26 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 27 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 28 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 29 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 30 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 31 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 32 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 33 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 34 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 35 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 36 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 37 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 38 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 39 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 40 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 41 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 42 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 43 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 44 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 45 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 46 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 47 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 48 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 49 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 50 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 51 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 52 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 53 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 54 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 55 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 56 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 57 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 58 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 59 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\nBlock: 60 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 61 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 62 Data: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\nBlock: 63 Data: 0,0,0,0,0,0,255,7,128,105,255,255,255,255,255,255\n```\n\n### Changing Authentication Keys\n\nThis has so far only been tested with MiFare Classic 1K cards (the ones that come with the reader)!\nPlease use the `writeAuthenticationKey` method\n(see the `writeAuthenticationKey.js` example in `test`).\n\n## Documentation\n\nManufacturer documentation of MFRC522\n\n[MFRC522-Doc.pdf](https://www.nxp.com/documents/data_sheet/MFRC522.pdf)\n\n[NFC-TAG Types](http://www.nfc-tag-shop.de/info/ueber-nfc-tags/nfc-tag-typen.html)\n\n[NTAG213_215_216.pdf](https://www.nxp.com/documents/data_sheet/NTAG213_215_216.pdf)\n\n### Wiring\n\nFollow the map here to do the interface pins.\n\n| Name   | Pin # | Pin name           |\n| ------ | ----- | ------------------ |\n| SDA    | 24    | CE0                |\n| SCK    | 23    | SCLK1              |\n| MOSI   | 19    | MOSI1              |\n| MISO   | 21    | MOSO1              |\n| IRQ    | None  | None               |\n| GND    | Any   | Any Ground         |\n| RST    | 22    | GPIO5C3            |\n| 3.3V   | 1     | 3V3                |\n| Buzzer | 18    | GPIO5B3 (Optional) |\n\nNote that the pins number is different from the BCM number.\n\n![Screenshot](wiki/rpi-mfrc522-wiring2.PNG)\n\n![Screenshot](wiki/gpio-map.png)\n\n### Which hardware is used?\n\nList of hardware which are used with links to `amazon.de`:\n\n- [Raspberry Pi 3 B+](https://www.amazon.de/Raspberry-1373331-Pi-Modell-Mainboard/dp/B07BDR5PDW/ref=sr_1_3?crid=78XCCBIEFSD9\u0026keywords=raspberry+pi+3+b%2B\u0026qid=1565892766\u0026s=gateway\u0026sprefix=raspberry%2Caps%2C173\u0026sr=8-3)\n- [RFID kit RC522](https://www.amazon.de/AZDelivery-Reader-Arduino-Raspberry-gratis/dp/B01M28JAAZ/ref=sr_1_1?keywords=MFRC522\u0026qid=1565892804\u0026s=gateway\u0026sr=8-1)\n\n## Buzzer Notifications (optional)\n\nIt's possible to get buzzer notifications when the module reads a chip, simply connect a piezo speaker to your PI.\n\n### Components for Buzzer\n\n- [DC to DC regulator (5V to 3.3V)](https://www.amazon.de/PEMENOL-AMS1117-Stromversorgungsmodul-Raspberry-Mikrocontroller/dp/B07FSLGPR8/ref=sr_1_1?keywords=AMS1117\u0026qid=1565868927\u0026s=ce-de\u0026sr=1-1) (optional) used only if you want to interface buzzer with the system.\n  ![ams1117](wiki/ams1117.png)\n- [Active buzzer (NOT passive)](https://www.amazon.de/BETAFPV-Terminals-Electronic-Continuous-12X9-5mm/dp/B073RH8TQK/ref=sr_1_2?keywords=Active+buzzer\u0026qid=1565892971\u0026s=ce-de\u0026sr=1-2) (optional)\n  ![ams1117](wiki/diff-passive-active-buzzer.jpg)\n- [NPN transistor](https://www.amazon.de/100pcs-S8050-S8050D-Transistor-40Volts/dp/B00CZ6K2SM/ref=sr_1_1?keywords=s8050\u0026qid=1565894051\u0026s=computers\u0026sr=1-1) (Optional)\n\nThose 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.\n\n### Wiring with Buzzer\n\n![Screenshot](wiki/mfrc522-node.png)\n\n## Demonstration\n\n- Some images and video demonstration can be found [here](docs/demo.md)\n\n## Circuit Diagram:\n\nInside `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.\n\n### Sources\n\nhttps://github.com/miguelbalboa/rfid\n\nhttps://github.com/mxgxw/MFRC522-python\n\n## Code of Conduct\n\nSee the [CODE](CODE_OF_CONDUCT.md)\n\n## License\n\nSee the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirsttris%2Fmfrc522-rpi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirsttris%2Fmfrc522-rpi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirsttris%2Fmfrc522-rpi/lists"}