Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including node-red-node-pisrf with all npm packages installed. Try it out:

node-red-node-pisrf lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("node-red-node-pisrf/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

node-red-node-pisrf v0.1.4

A Node-RED node for a Raspberry Pi to use a SRF04 or SRF05 range finder


A Node-RED node for Raspberry Pi to read range from an SRF05 Ultrasonic range sensor.

Only works with a Raspberry Pi.


Run the following command in your Node-RED user directory - typically ~/.node-red

npm install node-red-node-pisrf


Raspberry Pi input from an SRF04 or SRF05 ultrasonic range finder.

The configuration requires two GPIO pin numbers, the trigger pin and the echo pin. These can be any spare valid Pi GPIO pins. e.g.


You can also set the repeat frequency of measurements - default 0.5 seconds.

Outputs a msg.payload with a number representing the range in cm.

Produces one measure every 0.5s (by default) - but only if the distance is different from the previous reading.

Note: we are using the actual physical pin numbers on connector P1 as they are easier to locate.


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free