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

rpi-433-v3

v1.2.0

Published

Simple NodeJS module to send and receive decimal codes through 433Mhz device on RaspberryPI 2

Downloads

68

Readme

rpi-433-v3

Simple NodeJS module to send and receive decimal codes through 433Mhz device on RaspberryPI 2

npm version

NPM

v1/v2/v3

The original library is here. Then ftrier forked it into a new repo called rpi-433-v2 which is now deleted (but still published on NPM). v2 added the ability to set a Protocol and updated the CPP to the latest. However, it seems as though v2 is broken for sniffing as the stdout for the CPP did not flush the output therefore node could not pick up the output. Therefore, I have created v3 which attempts to fix that.

Credits

So all credits go to eroak and ftrier.

Modifications to the original

  • Protocol can be set
  • Updated the scripts (codesend and RFSniffer) to the latest

Dependencies

  • wiringPi : https://projects.drogon.net/raspberry-pi/wiringpi/

Building WiringPi

pi@raspberrypi ~ $ git clone git://git.drogon.net/wiringPi
...
pi@raspberrypi ~ $ cd wiringPi/wiringPi
pi@raspberrypi ~/wiringPi/wiringPi $ sudo su
...
root@raspberrypi:/home/pi/wiringPi/wiringPi# ./build

Installation

npm install rpi-433-v3

Usage

Firstly, make sure you are running your application as root or with sudo, else the Raspberry Pi will not let you output/input to the GPIO and you'll get an error.

sudo node myscript.js

Please note that there are different and confusing ways to reference a channel. This module supports wPi schema. Once wiringPi is installed, in your CLI you can run gpio readall and check the wPi column or consult https://projects.drogon.net/raspberry-pi/wiringpi/pins/

gpio readall

Example

var rpi433 = require("rpi-433-v3"),
  rfSniffer = rpi433.sniffer({
    pin: 2, //Sniff on GPIO 2 (or Physical PIN 13) (optional)
    pulseLength: 350,   // Listen for codes with this pulse length (optional)
    debounceDelay: 500 //Wait 500ms before reading another code
  }),
  rfEmitter = rpi433.emitter({
    pin: 0, //Send through GPIO 0 (or Physical PIN 11)
    pulseLength: 350, //Send the code with a 350 pulse length
    protocol: 4 //Set the protocol.
  });

// Receive (data is like {code: xxx, pulseLength: xxx})
rfSniffer.on("data", function(data) {
  console.log(
    "Code received: " + data.code + " pulse length : " + data.pulseLength
  );
});

// Send
rfEmitter.sendCode(1234, function(error, stdout) {
  //Send 1234
  if (!error) console.log(stdout); //Should display 1234
});

/* Or :

rfEmitter.sendCode(code);
rfEmitter.sendCode(code, {  //You can overwrite defaults options previously set (only for this sent)
  pin: 2,
  pulseLength: 350
});
rfEmitter.sendCode(code, callback);
rfEmitter.sendCode(code, {
  pin: 2,
  pulseLength: 350
}, callback);
*/

//rpi-433 uses the kriskowal's implementation of Promises so,
//if you prefer Promises, you can also use this syntax :
rfEmitter.sendCode(1234, { pin: 0 }).then(
  function(stdout) {
    console.log("Code sent: ", stdout);
  },
  function(error) {
    console.log("Code was not sent, reason: ", error);
  }
);