npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-rfid

v1.0.7

Published

A node module to interface rc522 rfid reader with raspberry pi via node js!!!

Downloads

65

Readme

node-rfid

This module supports both Raspberry Pi (RPi) and BeagleBone Black development boards.

It requires your RPi (or BeagleBone Black) SPI interface to be enabled for being used. For that:

a) Go the terminal and type:

 sudo raspi-config

b) This will open your raspi-config interface. Choose Advanced Options if no Interfacing Options is found else choose Interfacing Options.

   

c) This will redirect you to next interface with various interfaces options. From those options choose the option SPI.

After following these procedures, just hook up your rc522 rfid reader to the RPi (or BeagleBone Black) with the following datasheet:

The schematic image for raspberry pi is:

Note: The image is for RPi2, but the same works for RPi3 too!!!

After this, just browse to your node working directory through terminal via the command:

cd /folder_path

Then just install this node module as:

npm install node-rfid

This will add the node-rfid module to your node_modules folder

Now in your working nodejs code (or by creating a new file) just following the below guideline example:

Simple reading

This code waits the until the rfid tag is shown to the rfid reader

var rfid=require('node-rfid');

rfid.read(function(err,result){
     if(err) console.log("Sorry, some hardware error occurred"); //some kind of hardware/wire error
     console.log(result); //print rfid tag UID
});

Reading with time limit

This code waits thr rfid tag to be shown to the rfid reader within a time linit, else displays timeout message. The following sample waits for 5000 ms (5 s) for the rfid reader to get rfid tag shown to it. On reaching or exceeding the time limit, the timeout message is displayed. You may change the time limit by passing the time in millisecond as the first parameter in the function "readintime". For example: for 1 second time limit, just pass 1000.

var rfid=require('node-rfid');

rfid.readintime(5000,function(err,result){
	   if(err) console.log("Sorry, some hardware error occurred"); //some kind of hardware/wire error
	   if(result=="timeout"){ 
	    console.log("Sorry, You timed out");  //check if time exceeded the time you passed as argument and print timeout message
	   }else{
	     console.log(result); //print rfid tag UID
	   }
});

Now just run your js file as below and see the output in the terminal:

 node /file_name