What is Node-RED?

Disclaimer: We are temporarily not offering support for the Node-RED project. The reason for this is because we are focusing our attention on an official Node.js SDK and CLI Loader, rather than the forked and unsupported libraries that our Bean Node-RED project is currently based on. Once the Node SDKs and CLI Loaders are stable, we will determine if we need to rewrite the Node-RED implementation with the new SDKs, and fully support it again.

Introduction

This guide will walk you through the steps neccessary to connect your Bean to another device using Node-RED, a visual programming interface that requires very little coding experience.

Node-RED Basics

Node-RED is based on Node.js. The Node-RED application runs as a web server, and you customize and manipulate functional “flows” from any computer’s browser, local or remote. Every Node-RED app consists of nodes which are linked together to form the logical flow of your application. The nodes typically fall under input, operation or output.

Below is a very simple example of how these different nodes would interact with each other.

Generic Node-RED app

In reality, you wouldn't have nodes with such generic names as "input" or "output". At Punch Through we have created our own nodes which are specifically designed to communicate with Bean.

Bean Nodes
  • Acceleration: Get accelerometer data from Bean.
  • Serial: Send or recieve serial messages to or from Bean.
  • Temperature: Get the ambient temperature from Bean.
  • Read Scratch: Read scratch data set by Bean.
  • RGB LED: Set Bean's LED to a specified color.
  • Write Scratch: Write scratch data to Bean.

Each of the nodes defined above can be used in a Node-RED application once you install these nodes into your Node environment. We will cover installation and setup in following sections.

Check out the following example of a Node-RED app that grabs temperature data from Bean and tweets it! Connecting your Bean to the internet can be as easy as this.

Bean Node-RED app

Possible Configurations

Node-RED apps for the web in traditional client/server fashion. Most of the time you will run both the server and client on your computer:

PC Server Node-RED

However, a more powerful configuration might be to run your server on a dedicated machine that rarely or never turns off. As long as your server is within connection range of a Bean, this setup can open a whole new world of possibilities.

Rpi Server Node-RED

Next Steps

Now that you have a basic understanding of what Node-RED is and how it can be used to quickly start connecting Beans to your computer and internet, you can get started by installing Node-RED:

Install Node-RED >>

You may also want to check out the official Node-RED docs.