Node-RED: Installation

Zápisník experimentátora

Hierarchy: Node.js

Node-RED is a flow-based environment that lets you create data flows. It works as a package for Node.js that installs on your computer. After running the program, you connect to the local HTTP server. There you will find a flow editor that allows you to create multiple flows that consist of nodes and links between them. You can upload the flow to the server where it will run and process the data you send to it.

Node-RED Installation

You can find Node-RED on the Internet at https://nodered.org/. On the page you will find a description of how to install the development environment, but some details do not emphasize there. Important information is that you must have administrator privileges. You get them on Linux using the sudo command and on Windows by running the console in administrator mode.

Linux

You install the program using npm.

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

Windows

Run the console in administrator mode. For example, for Windows 10 in the English language version, you can do so by right-clicking on the Start icon and selecting Command Prompt (Admin) from the menu.

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

During installation, several lines of information about how the installation took place are listed. For example, this was the installation of version 0.20.3.

C:\WINDOWS\system32>node -v
v8.15.1

C:\WINDOWS\system32>npm -v
6.0.1

C:\WINDOWS\system32>npm install -g --unsafe-perm node-red
C:\Users\Robo\AppData\Roaming\npm\node-red -> C:\Users\Robo\AppData\Roaming\npm\node_modules\node-red\red.js
C:\Users\Robo\AppData\Roaming\npm\node-red-pi -> C:\Users\Robo\AppData\Roaming\npm\node_modules\node-red\bin\node-red-pi
+ node-red@0.20.3
added 15 packages from 11 contributors, removed 23 packages and updated 19 packages in 22.567s

C:\WINDOWS\system32>npm list -g --depth=0
C:\Users\Robo\AppData\Roaming\npm
+-- express-generator@4.16.0
+-- mocha@5.2.0
+-- node-red@0.20.3
+-- nodemon@1.17.4
+-- npm@6.0.1
+-- pm2@2.10.3
`-- pm2-windows-startup@1.0.3

Editor

To run the program, run the command node-red.

C:\WINDOWS\system32>node-red
26 Mar 14:56:32 - [info]

Welcome to Node-RED
===================

26 Mar 14:56:32 - [info] Node-RED version: v0.20.3
26 Mar 14:56:32 - [info] Node.js  version: v8.15.1
26 Mar 14:56:32 - [info] Windows_NT 10.0.17763 x64 LE
26 Mar 14:56:32 - [info] Loading palette nodes
26 Mar 14:56:33 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
26 Mar 14:56:34 - [info] Dashboard version 2.14.0 started at /ui
26 Mar 14:56:34 - [info] Settings file  : \Users\Robo\.node-red\settings.js
26 Mar 14:56:34 - [info] Context store  : 'default' [module=memory]
26 Mar 14:56:34 - [info] User directory : \Users\Robo\.node-red
26 Mar 14:56:34 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
26 Mar 14:56:34 - [info] Flows file     : \Users\Robo\.node-red\flows_RoboHome.json
26 Mar 14:56:34 - [info] Server now running at http://127.0.0.1:1880/
26 Mar 14:56:34 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

26 Mar 14:56:34 - [info] Starting flows
26 Mar 14:56:34 - [info] Started flows

Several lines of text are printed that contain startup information, but the only relevant information is the address where the editor is running. In my case it is http://127.0.0.1:1880/. When you open it, you will see an editor that lets you create flows.

The editor looks like this. It contains four places to work with the editor.

  • Nodes - List of usable nodes. Each node performs a specialized activity. Drag a node to the largest Flow area.
  • Flow - Here you create your flows. Add the desired nodes and link them using links. There are several junction points on each node. The points on the left are inputs and the points on the right are outputs.
  • Info - Here you can see information about a particular designated node.
  • Deploy - Once you have designed the flow, press the Deploy button to upload it to the server where it starts.

On the Node-RED website you will find a detailed manual that also contains some basic examples of how flows are created.

Installing additional nodes

After installing Node-RED, you will only have a basic set of nodes available. Since I am dedicated to Arduino on this site, you will need a few more nodes to connect to the Arduino. Nodes can be installed directly from the editor, but it's a bit hidden. You must click the menu icon at the top right of the screen and select Manage palette from the menu. Choose the Palette/Install tab. Type the following terms into the search and install them.

  • node-red-node-serialport
  • node-red-dashboard

 


26.03.2019


Menu