No description
  • C 69.3%
  • C++ 19.5%
  • JavaScript 10.4%
  • Python 0.8%
Find a file
Otávio Ribeiro 453e9a471b Project Info
2016-02-20 19:39:19 -02:00
src IRQ programming 2016-02-20 16:58:30 -02:00
.gitignore Updated README.md 2015-11-21 19:36:00 -05:00
binding.gyp cleaning 2016-02-20 02:27:17 -02:00
main.js Programming 2016-02-20 17:23:28 -02:00
package.json renaming project 2016-02-20 19:16:21 -02:00
rc522_output.js Adding parameters to configure the spidev and debug at client site. 2016-02-20 04:18:35 +00:00
README.md Project Info 2016-02-20 19:39:19 -02:00

#rc522-rfid-promise-spidev Module to access an rfid reader with rc522 chipset using linux spidev. Using promises.

Fork of

This is a fork to make the module works with many other boards through linux spidev.

For a nice and simpler module, working with raspberry pi, please see the original:

https://www.npmjs.com/package/rc522-rfid

https://www.npmjs.com/package/rc522-rfid-promise

Purpose

This node module is to access RFID reader with a rc522 chipset (e.g. http://amzn.com/B00GYR1KJ8) via SPI interface using the linux spidev.

The original project only works with raspberry pi, since they used a broadcom library to communicate with the spi port.

With this fork I changed it to use linux's spidev instead, which allows it to work with many other boards like beaglebone.

Functionality

The module is currently only able to read the serial number of the tag which is hold onto the reader.

Requirements

  • The RFID reader is plugged at spidev
  • The GCC compiler is installed sudo apt-get install build-essential
  • node-gyp is installed npm install -g node-gyp

Installation

npm install --save otaviojr/rc522-rfid-promise-spidev

Api

startListening(timeout)
// timeout is optional
// returns a promise

stopListening()
// closes the child process and rejects the promise if still unresolved

Usage

var rc522 = require("rc522-rfid-promise-spidev");

var read = function(){
  rc522.startListening({
    spi:"/dev/spidev1.0",
    enableLog: 0
  },5000)
    .then(function(rfidTag){
        console.log("RFID Tag:" + rfidTag);
        setTimeout(read,10);
    }, function(){
        console.log("Timeout - No Card readed");
        setTimeout(read,10);
    });
}

setTimeout(read,10);