No history yet

Introduction to Node-RED

What is Node-RED?

Node-RED is a programming tool that lets you connect devices, services, and APIs using a visual, drag-and-drop interface. Think of it like digital LEGO blocks. Instead of writing lines of code, you connect pre-built blocks, called “nodes,” to create a program or “flow.” Each node has a specific job, like reading a sensor, sending an email, or connecting to a weather service.

Lesson image

Originally developed by IBM's Emerging Technology Services team, Node-RED was built to simplify the process of wiring together the hardware and software that make up the Internet of Things (IoT). It's open-source and built on Node.js, a popular JavaScript runtime, making it both powerful and accessible. It allows you to create complex automations quickly, from a simple home automation task to a sophisticated industrial data processor.

Getting Started with Installation

One of the best things about Node-RED is that it can run almost anywhere. You can install it on your personal computer, a small single-board computer like a Raspberry Pi, or even on cloud platforms.

The installation process is typically straightforward, requiring just a few commands.

On a Local Machine (Windows, macOS, Linux)

The main prerequisite is having Node.js and its package manager, npm, installed. Once you have them, you can install Node-RED with a single command in your terminal or command prompt.

npm install -g --unsafe-perm node-red

After the installation is complete, you can start Node-RED by simply typing node-red in your terminal.

On a Raspberry Pi

Node-RED comes pre-installed on the full version of Raspberry Pi OS (formerly Raspbian). If it's not there, or if you're using a minimal version of the OS, you can run the official installation script.

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

This script handles installing Node.js, Node-RED, and a collection of useful nodes for the Raspberry Pi's hardware.

In the Cloud

You can also run Node-RED on various cloud services like IBM Cloud, Amazon Web Services (AWS), or Microsoft Azure. This is a great option for creating applications that need to be always-on and accessible from anywhere. The specific setup steps vary by provider, but they generally offer one-click deployments or simple guides to get you started.

Exploring the Editor

Once Node-RED is running, you can access its editor through your web browser, typically by navigating to http://localhost:1880. The interface is clean and divided into three main sections.

  1. Palette (Left): This is your toolbox. It contains all the available nodes, organized by category (input, output, function, etc.). To use a node, you simply drag it from the palette onto the workspace.
  2. Workspace (Center): This is the main canvas where you build your flows. You arrange your nodes here and draw wires between their ports to connect them, defining the path your data will take.
  3. Sidebar (Right): This pane provides context and tools. It has tabs for viewing information about selected nodes, reading built-in documentation in the Help tab, and seeing output messages in the Debug tab. The Debug tab is essential for testing and troubleshooting your flows.

Getting comfortable with these three areas is the first step to mastering Node-RED. Your first instinct should be to drag a few nodes into the workspace, wire them together, and see what happens.

Quiz Questions 1/4

What is the primary purpose of Node-RED?

Quiz Questions 2/4

What is the main software prerequisite for installing Node-RED on a local machine like Windows or macOS?

Now you have a basic understanding of what Node-RED is, how to get it running, and how to navigate its editor. You're ready to start building your first flow.