1. Software & Equipment Requirements
|BB-400 Software Installed||Base image (tested on version 1.1.1). Specifically BB-WebAdmin packages, Docker and BB-IO-Server|
|Node-RED||The base Node-RED software, which you can find on the base image, along with Brainboxes bb-node-red package|
Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its run-time in a single-click.
Although the concept of flows, nodes & palettes may sound unfamiliar, Node-RED makes programming simple by using a visual representation of code in blocks with lines between them.
Some examples of many functions available are:
- A built-in library allows you to save useful functions, templates or flows for re-use.
- The flows created in Node-RED are stored using JSON which can be easily imported and exported for sharing with others.
- An online flow library allows you to share your best flows with the world.
3. Setting up Node-RED
You can download and install Node-RED either via the BB_CLI, the Linux command line or through the web admin interface.
The Brainboxes Node-RED examples can be downloaded via apt or npm. We recommend just downloading the examples from apt, as it will install Node-RED if you haven’t already got it and also install/update your existing Brainboxes package with the latest examples.
To install the Brainboxes Node-RED apt package, execute the following from a terminal window:
$ apt-get update $ apt-get install bb-node-red
If you just want the npm package as you already have your own Node-RED setup, you can download the package via the Node-RED palette search option, or by executing the following:
$ cd ~/node-red-data $ npm install @brainboxes/node-red-contrib-brainboxes
4. An Overview of Node-RED
So what are we looking at and how to get started? Below is an overview of the Node-RED interface, given with annotations with a brief description of each section.
The palette on the left contains all the different nodes available for use. From injecting different types of information (strings, Booleans, numbers, ETC.), executing Linux command lines and the ability to make different types of connections, to recording simple debug traces, sending email notifications and displaying information on a text box.
The workspace in the middle is where your flows will be created.
The sidebar on the right provides additional settings and debug information. Using the debug node available from the palette will show the user what information is being sent, or the information which is being received from the node it’s attached to.
The header at the top, contains the deploy button, which is used for deploying your current workspace. Deploying it will make it available for execution, or it will immediately start running, depending on how you have it set up. You will also find the main menu which allows you to import/export workspaces, or change several configurations regarding your Node-RED project.