Digital Network Infrastructure

An Automated NSW Smart Solutions Guide

Node-RED provides a browser based programming interface that makes it easy to create “flows” by connecting together “nodes” from a wide range of “palettes”.

This writeup explains how to install NodeRED from a WAGO CC 100 PLC using “Docker” (An open platform that is lightweight and efficient, allowing multiple applications to run on a single device without interfering with each other). 

The main takeaway: Docker is used to house and run various running applications (like Node-Red) on the PLC without interfering with other docker apps or the actual PLC run time environment. Once Node-Red is installed using Docker, a flow can be created using a specific palette to exchange variable values with the PLC runtime. There is also a palette that can natively interact with the PLC’s IO without having to get in and alter (program) the runtime environment. 

NodeRed can be installed and used once the PLC has been flashed with the appropriate firmware. For this writeup, I will be referring to the Wago CC100 using firmware 4.3.3(25) compatible with CodeSys 3.5.

Although NodeRed can be run in parallel with the PLC running an internal program (PLC Rutime), if the PLC runtime is active (running an E!Cockpit or CodeSys application), it will need to be disabled during the installation and setup of NodeRed.

Install Overview

  • CC100 Firmware Flash
  • Docker Install
  • Pallet Installation to communicate with CC100 IO and program variables
  • Pallet Installation of 3rd party integration
  • Create PLC program for Net Send/Receive variables
  • Create NodeRed Flow for Net Send/Receive
  • Create Flow for Modbus Communication

Firmware Flash

PLC Firmware built to a specific CodeSys revision. For this writeup I will be referencing CodeSys Build 3.5 SP18, CC100 Firmware 4.3.3(25). To upgrade the PLC firmware you will need the appropriate Firmware and the WagoUpload_Tool both of which can be acquired from the WAGO Downloads site.

https://downloadcenter.wago.com/wago/software

Docker Installation

Docker is an open containerization platform for developing, shipping, and running of Applications. On the WAGO Platform, Docker is used to build and run applications without the need for complex compilers or cross-build tools.

Docker is installed by downloading the Docker-ipk file image and installing it from the PLC WBM screen …

  • Download the Docker IPK file at: https://github.com/WAGO/docker-ipk
  • Open the WBM via the controller’s IP address in your web browser
  • Navigate to the Configuration page
  • Upload the .ipk file from the “Software Uploads” tab and click “Install”.
  • Reboot the controller

Verify Docker Install (note ssh commands are CAP sensitive)…

  • Login via SSH using “ssh root@ipaddress”doccker
  • Type “docker -v” to get the installed Docker Version
  • Type “docker volume ls” to get a list of Docker Volumes”
  • Type “docker COMMAND –help” for a full listing of commands

Node-Red Volume Creation (continuing with SSH commands)

  • Create Volume on Linux for Node-Red Container (this is done to segregate flows from the Node-Red Container.
    • docker volume create –name node_red_user_data
  • Invoke and run Node-Red
    • docker run –restart unless-stopped -d –name node-red –network=host -v node_red_user_data:data nodered/node-red
      • Note: network=host will expose all ports. If you wish to expose only the ports you plan on using the use -p and the port numbers (-p 502:502 for modbus, -p 1880:1880 for Node-Red IDE Interface, etc)

Exit out of the ssh shell by typing “quit”.

Getting to the Node-Red interface

Once Node-Red is up and running its programming interface can be accessed by simply opening a browser and navigating to the PLC at the specific port of 1880. Example: IPAddress:1880 (the PLC network name can be substituted for the IP address if the network and PLC are set up properly using DNS).

Pallet Installation

Pallets are containers of premade drag and droppable function blocks used to configure programming and connections for specific protocols.

Pallets can be found and installed from the Pallet Browse once Node-Red is up and running. To use this feature the PLC will need internet access and the ability to resolve Node names via a working DNS.

Once installed “Flows” can be created from the function blocks of the installed Pallets. Multiple flows can be used to group and/or segregate different programs.

Pallet Installation and Flow Creation – CC100

Pallet Installation and Flow Creation – Net Send/Receive

  • Net Send/Receive will need to be setup for the running application on the PLC
    • Create a “Network Variable List (Sender)” for Variables being sent.
    • In the properties of the Variable List select “UDP”, select the task that will run it, and from the settings tab choose port 1202  (increase by 1 if the port number is already in use).
    • For each variable being sent add a reference line with the name of the point and the point type (IE … progname.varname : WORD);.
  • From the Pallet Browser find and install the Pallet “node-red-contrib-netvar”

Pallet Installation – Modbus

  • Install palette node-red-contrib-mod
  • Info: https://flows.nodered.org/node/node-red-contrib-modbus
  • Does not require Modbus integration to be set up in the PLC runtime environment (unless you intend to query the PLC Runtime via Modbus).
  • Palette is designed to set up a Modbus client environment to query/command registers associated with a Modbus Server.
  • The CC100 RS485 port can be accessed via Node-Red by add the following command when starting up Node-Red
    • –device=/dev/ttySTM1:/dev/ttySTM1:rw
    • ttySTM1 will be the reference when setting up the Client Node.