When you want to connect an IoT device to anything (or, for that matter, anything to anything), you should take a serious look at Node-RED, a free, open source visual process wiring system from IBM
One of the many things that Raspberry Pi-based systems are excellent for is for building Internet of Things platforms. The price is right ($35), the performance is great for the price, the input/output options are great, there’s an enormous ecosystem of add-on and compatible sensors and other hardware, and an equally enormous supporting community.
As a result of this vibrant market, a slew of operating system choices for the Raspberry Pi have appeared (see my Ultimate Guide to Raspberry Pi Operating Systems parts 1, 2, and 3) along with some really creative software development tools such as Node-RED, a free, open source, visual wiring tool built by IBM Emerging Technologies.
Node-RED was first released for x86 platforms in 2013 and the Raspberry Pi version now comes pre-installed in the Raspbian “Jessie” release of Debian officially released last December by the Raspberry Pi Foundation (although other companies such as Adafruit had Node-RED working on the Raspberry Pi almost a year earlier). And not only does Node-RED run on Windows, Linux, and OS X, it also runs on the Beaglebone Black single board computer and there’s support for connecting Node-RED to Arduino boards.
What’s remarkable about Node.js is how quickly it’s grown in popularity and power though not everyone might agree on its general usefulness (NSFW).
Sorry, gotta do it; here’s “Hello World” for Node.js:
In the following "hello world" example, many connections can be handled concurrently. Upon each connection the callback is fired, but if there is no work to be done Node is sleeping.
Node.js now has well over 225,000 available packages and its own package manager called, boringly, “npm” which is included when Node.js is installed. I mention this because you’ll need some npm “fu” if you’re going to extend Node-RED using the npm repositories.
Node-RED provides a set of building blocks, or “nodes,” which you drag from the left hand palette onto the canvas. You then drag a connection from an output connector on the right side of a node (for those that have outputs; some, such as the debug node which just displays input data, do not), to the input connectors on the left side of a node (again, for those nodes that take inputs). You then edit the properties of each node as needed, click on Deploy, and your process, called a “flow,” starts running with messages being sent a received by nodes.
In the default Node-RED installation there’s large number of nodes types preinstalled including searching for tweets, analyzing text for sentiment, running commands, sending and receiving HTTP requests, queuing and dequeuing message, sending and receiving UDP and TCP requests, and processing CSV, HTML, JSON, and XML messages.
Need more functionality? Nodes are available to support services such as accessing MongoDB and MySQL, interacting with IRC, and using Mustache templates by adding them from npm repositories. This can be done locally from the command line using either npm or the node-red-admin tool (this can also be used remotely).
Pre-built flows are also available from the Node-RED Library which also indexes available nodes. To use a flow, you copy its JSON from the library, then paste it into the Node-RED user interface. You can also save and retrieve flows into your local library.
Node-RED also provides admin, runtime, and storage APIs although you’ll find the documentation pretty scant at present.
If you’re not got a preinstalled Node-RED system then, in theory, installation should be simple. First, if needed, install Node.js:
Check the version and if you get this message:
user@xxx:~ $ node --version
*The program 'node' can be found in the following packages:
Ask your administrator to install one of them*
You need to do this:
sudo ln -s /usr/bin/nodejs /usr/bin/node
And node should work fine (though no guarantees). Now you can install Node-RED using npm.
As well as running Node-RED on a Raspberry Pi 2B, I’ve explored Node-RED using Ubuntu 14.04 installed in a VirtualBox VM on OS X, directly installed on OS X, in a Docker container running on a QNAP NAS and in all installations it’s been solid. As a tool for building IoT applications Node-RED is definitely worthing evaluating. It’s robust, flexible, and definitely addictive (you’ll find yourself thinking “can I just do X with Node-RED?” and then another hour or two will vanish).
If you think this review contains lots of cool RPi stuff, you might also like:
- Ultimate Guide to Raspberry Pi Operating Systems Part 1
- Ultimate Guide to Raspberry Pi Operating Systems Part 2
- Ultimate Guide to Raspberry Pi Operating Systems Part 3
- Sonic Pi: Realtime music creation for the Raspberry Pi (and more)
- New Raspberry Pi 3 Model B Launched
- 10 Reasons why the Raspberry Pi 2 Model B is a killer product
- MIPS Creator CI20: Sort of a challenge to the Raspberry Pi 2 Model B
- Ten operating systems for the Raspberry Pi
Stressed? Low energy? The answer is ThyncNext Post
The shocking truth of how you'll be tracked online and why
Amazon Web Services and Microsoft Azure, take very different approaches in how their data centers are...
A review of 19 companies that offer free cloud storage
By forcing Windows 10 on users, Microsoft has lost the tenuous trust and credibility users had in the...
The attacks that overwhelmed the internet-address lookup service provided by Dyn today were well...
At particular risk are touch-screen voting machines that have no paper trails. If those are hacked or a...
Use these tips for finding inexpensive study resources and getting hands-on experience.
As companies rely more on co-location, cloud and other off-premise computing models, enterprise IT...