{"id":16820377,"url":"https://github.com/techniq/node-pn532","last_synced_at":"2025-04-04T16:13:19.346Z","repository":{"id":21476382,"uuid":"24795014","full_name":"techniq/node-pn532","owner":"techniq","description":"Native Node.js driver for the PN532 NFC chip","archived":false,"fork":false,"pushed_at":"2024-11-17T11:57:14.000Z","size":76,"stargazers_count":73,"open_issues_count":13,"forks_count":32,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-28T15:06:18.101Z","etag":null,"topics":["nfc","node","pn532","rfid"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techniq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-04T16:43:31.000Z","updated_at":"2024-11-17T11:57:18.000Z","dependencies_parsed_at":"2024-12-01T02:34:29.508Z","dependency_job_id":"edd3a7ef-b5c1-4903-8c37-64073b8df7a9","html_url":"https://github.com/techniq/node-pn532","commit_stats":{"total_commits":40,"total_committers":4,"mean_commits":10.0,"dds":0.07499999999999996,"last_synced_commit":"938a0f1dfb64df33dbc3c8316123c0376e2bc2fc"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techniq%2Fnode-pn532","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techniq%2Fnode-pn532/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techniq%2Fnode-pn532/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techniq%2Fnode-pn532/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techniq","download_url":"https://codeload.github.com/techniq/node-pn532/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208139,"owners_count":20901570,"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":["nfc","node","pn532","rfid"],"created_at":"2024-10-13T10:56:28.121Z","updated_at":"2025-04-04T16:13:19.330Z","avatar_url":"https://github.com/techniq.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PN532\n\nDriver for the PN532 NFC chip.  Provides an event and promise-based API, and requires either:\n- [node-serialport](https://github.com/voodootikigod/node-serialport)\n- [node-i2c](https://github.com/kelly/node-i2c) (WIP)\n\nThis implementation does not require libnfc, and should work on both X86 (32-bit or 64-bit) and ARM (RPi / Beaglebone) systems\n\nTested on a Mac OSX 10.9 system using a UART/FTDI cable to an [Adafruit breakout board](https://www.adafruit.com/products/364)\nand on a BeagleBone using UART.  I2C support is currently a WIP at the moment.\n\nAPI is subject to change until the 1.0.0 release\n\n### Install\n    npm install pn532\n\nand `npm install serialport` or `npm install i2c`\n\n### Example\n\n#### UART (using [node-serialport](https://github.com/voodootikigod/node-serialport))\n```js\nvar pn532 = require('pn532');\nvar SerialPort = require('serialport');\n\nvar serialPort = new SerialPort({path:'/dev/tty.usbserial-AFWR836M',  baudRate: 115200 });\nvar rfid = new pn532.PN532(serialPort);\n```\n\n#### I2C (using [node-i2c](https://github.com/kelly/node-i2c))\n```js\nvar pn532 = require('pn532');\nvar i2c = require('i2c');\n\nvar wire = new i2c(pn532.I2C_ADDRESS, {device: '/dev/i2c-1'});\nvar rfid = new pn532.PN532(wire);\n```\n\n#### Scan a tag\n```js\nrfid.on('ready', function() {\n    rfid.scanTag().then(function(tag) {\n        if (tag) console.log('tag:', tag.uid);\n    });\n});\n```\n\n#### Poll for a tag\n```js\nrfid.on('ready', function() {\n    console.log('Listening for a tag scan...');\n    rfid.on('tag', function(tag) {\n        if (tag) console.log('tag:', tag.uid);\n    });\n});\n```\n\n#### Retrieve the firmware version\n```js\nrfid.on('ready', function() {\n    rfid.getFirmwareVersion().then(function(data) {\n        console.log('firmware: ', data);\n    });\n});\n```\n\n### Read and write tag data (using [ndef library](https://www.npmjs.com/package/ndef))\nTested using NTAG203 tags.  Should support other NTAG and Mifare Ultralight tags.  Mifare Classic tags are currently NOT supported, but could be in the future.\n\n#### Read\n```js\nrfid.on('ready', function() {\n    rfid.on('tag', function(tag) {\n        rfid.readNdefData().then(function(data) {\n            var records = ndef.decodeMessage(Array.from(data));\n            console.log(records);\n        });\n    });\n});\n```\n#### Write\n```js\nrfid.on('ready', function() {\n    rfid.scanTag().then(function(tag) {\n        var messages = [\n            ndef.uriRecord('http://www.google.com'),\n            ndef.textRecord('test')\n        ];\n        var data = ndef.encodeMessage(messages);\n\n        rfid.writeNdefData(data).then(function(response) {\n            console.log('Write successful');\n        });\n    });\n});\n```\n\n### Examples\nExamples are available under the `examples` directory\n\n### Debug logging\n`PN532_LOGGING=debug node examples/card_scan.js`\n\n### Note for using UART on a Raspberry Pi 3\nIf you are using this library on a Raspberry Pi 3, you will likely encounter an [issue](https://github.com/techniq/node-pn532/issues/9) with the device sending or receiving data over UART due to some hardware and configuration changes with regards to the serial port.\n\nTLDR workaround:\n  1. Add `core_freq=250` in the `/boot/cmdline.txt`\n  2. Use `/dev/ttyS0` instead of `/dev/ttyAMA0`\n\nFor details on why these changes are needed, see [here](http://elinux.org/RPi_Serial_Connection#Preventing_Linux_using_the_serial_port) and [here](https://blog.adafruit.com/2016/03/07/raspberry-pi-3-uart-speed-workaround/)\n\n### Links\n- [Datasheet](http://www.nxp.com/documents/short_data_sheet/PN532_C1_SDS.pdf)\n- [User manual](http://www.nxp.com/documents/user_manual/141520.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechniq%2Fnode-pn532","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechniq%2Fnode-pn532","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechniq%2Fnode-pn532/lists"}