DEV Community

Data Visualization on the e-RT3 using Node-RED, InfluxDB Cloud, and Grafana

Table of Contents

Setup

Introduction

The purpose of this application is to receive data from sushi sensors, using the e-RT3 as a data acquisition module. The e-RT3 will send sushi data to a cloud database, InfluxDB Cloud, and will monitor the data using a visualization software, Grafana.

Image description

Overview

Materials

  • SD card (SanDisk 32GB Ultra SDHC)
  • Router (CyberTAN Technology WR214E Wireless-B Broadband Router)
  • PC
    • e-RT3 setup
  • CPU module (F3RP70-2L)
    • Power modules (F3PU10-0S, F3PU16-0S, F3PU20-0S, F3PU26-0S, F3PU30-0S, F3PU36-0S)
    • Base modules (F3BU04-0N, F3BU06-0N, F3BU05-0D, F3BU09-0N, F3BU013-0N, F3BU16-0N)
  • Sushi setup (please follow manuals to configure)
    • Vibration/pressure/temperature sensor
    • Gateway
    • Phone with "Sushi Sensor App" and "Key Card Editor"

Software

Manuals

  • e-RT3
    • IM 34M06M52-25E
  • Sushi
    • IM 01W06C01-01EN
  • Gateway
    • TI01W06A51-50EN
  • GA10
    • IM 04L65B01-01EN

Wiring

The LoRaWAN Gateway, PC, and LAN1 of e-RT3 should be connected to the router. All wiring can be connected now or connected as the manual progresses.

Image description

Network Addresses

Default Addresses

e-RT3 Web-browser:
http://192.168.3.72

Gateway Web-browser:
http://192.168.2.1
Default username: admin
Default password: Yokogawa1

Router Web-browser:
http://192.168.1.1
*Default username: admin
*Default password: admin
*Check your router’s default settings

Final Addresses

e-RT3 Web-browser:
http://192.168.2.72

e-RT3 Grafana Server:
http://192.168.2.72:3000
Default username: admin
Default password: admin

e-RT3 Node-RED Server:
http://192.168.2.72:1880

Gateway Web-browser:
https://192.168.2.4/
Default username: admin
Default password: Yokogawa1

Gateway Node-RED Server:
https://192.168.2.4:1880

Router Web-browser:
http://192.168.2.1
*Default username: admin
*Default password: admin
*Check your router’s default settings

Procedure

1) SD Card Setup

Please image the following file onto an SD card. The CPU module supports SDHC 4GB to 32GB. The
recommended SD card is a SanDisk Memory Card.

a. Download balenaEtcher.
b. Un-zip and extract the “eRT3 + Sushi Sensor Application” folder to a desired location.
c. Login or create an account on the Yokogawa Customer Portal.
d. Please locate the latest SD card image and click on the file to download it. You can navigate
from the homepage to “[Useful Links]” “PLC/PAC & Embedded Controller” > “OS-free CPU
module OS image Download” > “Agree” > “OS image for F3RP70”
“rp70_OS_Image_R211.zip”.
OR click on the following link.

Image description

e. Use a SD card reader to insert the SD card into the PC.
f. Open balenaEtcher. Select the OS image. Select target (SD card). Select Flash!

Image description

g. You may now insert the SD card into the SD1 slot of the e-RT3.

2) Setting up the Cloud

a. Create an account on InfluxDB Cloud. Use the official InfluxDB website for more information.
b. Fill out the prompts for company and organization after logging in. My company name is “Yokogawa Corporation of America”. My organization name is “eRT3”. Make sure to select the correct region for the server. I selected “US East”.
c. Choose the “Free” plan.
d. Once you have reached the dashboard, go to “API Tokens”.

Image description

e. Select “Generate API Token” > “All Access API Token”. Enter a description for the API Token. Click “Save”.

Image description

f. Please copy and paste the custom API token into a safe location where you can access it in the future.
g. Navigate to “Load Data” > “Buckets” from the side bar.
h. Click on “Create Bucket” and name the bucket “sushiSensor”. If you are on the free version, keep the “Data Retention Preferences” as “30 days”. Click “Create”.

Image description

i. Please note down the server address located in your URL bar. You can learn more about your cloud region here. For example, if you live in the US East, please note down: https://us-east-1-1.aws.cloud2.influxdata.com/.

3) Configuring the Network

To configure the network and change IP addresses of various devices, the PC IP address will need to be within the same network as the device it is communicating with. This will involve changing the PC IP address various times using the following steps:

a. Go to your PC’s “Control Panel” > “Network and Internet” > “Network Connections”. Select the Ethernet connection to the router.
b. Double-click on “Properties”.
c. Double-click “Internet Protocol Version 4 (TCP/IPv4)”.

Image description

d. Select “Use the following IP address:”.
e. Change the PC IP address to one that is in the same network as the device’s address. For example, the default e-RT3 IP address is 192.168.3.72. Therefore, the PC address would need to be changed to 192.168.3.X (you may choose anything for X that has not already been assigned). Make the Subnet mask 255.255.255.0 (smaller network).

Image description

Changing the e-RT3 IP address

a. On the physical device itself, check to see if the e-RT3 is on Command Mode: 0 (the arrow should be pointing to 0). Make sure the e-RT3 is mounted to the Base module and is being powered through the Power Supply module. Refer to IM 34M06M52-25E for more details.

Image description

b. Using an ethernet cord, connect the PC directly to LAN1 of the e-RT3.
c. Change the PC IP address to one that is in the same network as the e-RT3 (Use Ex: 192.168.3.3).
d. This manual will be using Windows PowerShell as its terminal. If not already installed on your PC, please use the following link to install or find an alternative terminal.
e. Wait until the display on the e-RT3 lights up “OS” under “BAT”. This means that the operating system is now running. If you try to SSH before the “OS” appears, it will not work.
f. SSH into the e-RT3 using the following commands:

ssh ert3@192.168.3.72
Enter fullscreen mode Exit fullscreen mode

When prompted for the password, type (note: the typing will be invisible):

user_ert3
Enter fullscreen mode Exit fullscreen mode

g. (Optional): If you have used this SSH key before and it notifies you that remote host identification has changed, you may need to locate and open your “known_hosts” file (may be located in the .ssh folder) in a text editor and remove the all the lines that includes the IP address and the key (corresponding to 192.168.3.72). You can then save the “known_hosts” file and attempt to SSH again. This time you will be prompted to add and confirm a new host key to the “known_hosts” file. Type “yes” if prompted.
h. To make sure the DNS servers are specified, we need to change the resolved.conf file. Type the command:

sudo nano /etc/systemd/resolved.conf
Enter fullscreen mode Exit fullscreen mode

When prompted for the password, type (note: it will be invisible):

user_ert3
Enter fullscreen mode Exit fullscreen mode

i. Once the file opens in the terminal, uncomment the DNS and Fallback DNS lines by deleted the “#” and add the Google DNS server addresses as shown below. Please note there is a space between “8.8.8.8” and “8.8.4.4”:

[Resolve]
# Some examples of DNS servers which may be used for DNS= and FallbackDNS=:
# Cloudflare: 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001
# Google:     8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844
# Quad9:      9.9.9.9 2620:fe::fe
DNS=8.8.8.8 8.8.4.4
FallbackDNS=8.8.8.8 8.8.4.4
#Domains=
#DNSSEC=no
#DNSOverTLS=no
#MulticastDNS=yes
#LLMNR=yes
#Cache=yes
#DNSStubListener=yes
#DNSStubListenerExtra=
#ReadEtcHosts=yes
#ResolveUnicastSingleLabel=no
Enter fullscreen mode Exit fullscreen mode

j. On your keyboard, use the shortcut “ctrl + s” to save and then “ctrl + x” to exit the program.
k. Restart systemd-resolved:

sudo systemctl restart systemd-resolved
Enter fullscreen mode Exit fullscreen mode

l. To change the IP address for LAN1, we need to change its network configuration file:

sudo nano /etc/systemd/network/10-eth0.network
Enter fullscreen mode Exit fullscreen mode

If prompted for the password, type (note: it will be invisible):

user_ert3
Enter fullscreen mode Exit fullscreen mode

m. Once the file opens in the terminal, change the text in the file so that it matches to the routes below:

[Match]
Name=eth0

[Network]
Address=192.168.2.72/24

[Route]
Gateway=192.168.2.1
Destination=192.168.2.0/24

[Route]
Gateway=192.168.2.1
Destination=0.0.0.0/0
Enter fullscreen mode Exit fullscreen mode

n. On your keyboard, use the shortcut “ctrl + s” to save and then “ctrl + x” to exit the program.
o. Restart systemd-networkd:

sudo systemctl restart systemd-networkd
Enter fullscreen mode Exit fullscreen mode

p. Turn the e-RT3 off and on. The e-RT3 and PC are now on the same network and the e-RT3 has internet access.
q. (Optional): Change the PC IP address to one that is in the same network as the e-RT3 (Ex: 192.168.2.3). Ping 192.168.2.72 to make sure the PC and the e-RT3 are now on the same network:

ping 192.168.2.72
Enter fullscreen mode Exit fullscreen mode

If you can send and receive packets successfully, the setup is correct.

r. You may now remove the ethernet cord.

Changing the Gateway IP address

If further information is needed to set up the Gateway, please refer to TI01W06A51-50EN.
a. Using an ethernet cord, connect the PC directly to the Gateway.
b. Change the PC IP address to one that is in the same network as the Gateway (Ex: 192.168.2.3). The default IP address of the Gateway is 192.168.2.1.
c. Access the Gateway web-browser by entering “192.168.2.1” into the URL bar.
d. An error message may appear but click on “Advanced” > “Proceed to 192.168.2.1 (unsafe)”.

Image description

Image description

e. Login into the Gateway web-browser with the following default username and password:

Username: admin

Password: Yokogawa1

Image description

f. On the left side of the dashboard, select “Setup” > “Network Interfaces”.
g. Click the pen under “Options” to edit the IP address visible under the name “br0”.

Image description

h. Change the IP address to 192.168.2.4 and hit “Submit”.

Image description

i. Click on “Save and Restart” and press “OK” when prompted.
j. The Gateway IP address is now changed. Give the web-browser some time to restart. Access the web-browser now at https://192.168.2.4:1880/ in the URL bar.
k. You may now remove the ethernet cord.

Changing the router IP address

This procedure is for the CyberTAN Technology router WR214E. Please refer to your own router’s manual if different.

a. Using an ethernet cord, connect the PC directly to one of the ports of the router. Make sure the router is connected to the internet and is powered.
b. Reference your router’s manual to change its IP address. For example, the router in this setup, WR214E, has a default web-browser of http://192.168.1.1 and a default username and password: admin. You will need to change the PC IP address to one that is in the same network as the router temporarily (Ex: 192.168.1.2).
c. After changing the router IP address (to 192.168.2.1) and applying the changes within the web-browser, turn the router off and on.
d. Change the PC IP address to one that is in the same network as the router (Ex: 192.168.2.2). You can now access the router web-browser at http://192.168.2.1.
e. You may now remove the ethernet cord.

Image description

4) Wiring Connections

a. Please connect all devices to the same network via the router. The PC, LAN1 of the e-RT3, and Gateway can all plug into the router with an ethernet cord. The router needs to connect to an ethernet cable wired with internet connectivity. Make sure all devices are powered. The PC is only optional after the application is setup.

Image description

5) e-RT3 Dependencies

A couple of different dependencies will need to be built on the e-RT3: NVM (Node Version Manager), Node.js, npm, Node-RED, Grafana. To interact with the e-RT3, you will need to SSH into it and continue to work in PowerShell.

Installing NVM, Node.js, and npm

Please refer to this manual for more information on how to install NVM. NVM is used to install Node.js and npm while maintaining various Node.js versions.

a. SSH into the e-RT3 (using the steps shown in the “Configuring the Network” section of this manual.
b. Run the following command to download and install NVM:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

c. Restart PowerShell by closing and opening it.
d. SSH into the e-RT3.
e. Verify that NVM was properly installed by running the following command:

nvm --version
Enter fullscreen mode Exit fullscreen mode

f. Install the latest version of Node.js using the following command:

nvm install --lts
Enter fullscreen mode Exit fullscreen mode

g. Verify that Node.js and npm were properly installed by running the following commands:

node --version
Enter fullscreen mode Exit fullscreen mode
npm --version
Enter fullscreen mode Exit fullscreen mode
Installing Node-RED

a. If needed, SSH into the e-RT3.
b. Run the following command to install Node-RED:

npm install -g --unsafe-perm node-red
Enter fullscreen mode Exit fullscreen mode

c. Verify that Node-RED was properly installed by running the following command:

node-red --version
Enter fullscreen mode Exit fullscreen mode

d. To start the Node-RED server, run the following command:

node-red
Enter fullscreen mode Exit fullscreen mode

If the server is running and you want to access the command line, you will have to open a new terminal as the current terminal will be preoccupied with the server.

e. You may now access the Node-RED web-browser on the e-RT3 at http://192.168.2.72:1880/.

Installing Grafana

a. If needed, SSH into the e-RT3.
b. Update the packages list on the e-RT3:

sudo apt-get update
Enter fullscreen mode Exit fullscreen mode

c. Run the following commands to install Grafana:

sudo apt-get install -y adduser libfontconfig1 musl
Enter fullscreen mode Exit fullscreen mode
wget --no-check-certificate https://dl.grafana.com/oss/release/grafana_10.0.6_armhf.deb
Enter fullscreen mode Exit fullscreen mode
sudo dpkg -i grafana_10.0.6_armhf.deb
Enter fullscreen mode Exit fullscreen mode

d. To start the Grafana server, run the following command:

sudo systemctl start grafana-server
Enter fullscreen mode Exit fullscreen mode

e. You may now access the Grafana web-browser on the e-RT3 at http://192.168.2.72:3000/

6) Boot

Once Node-RED and Grafana are installed, their servers must be manually started through the command line every time the e-RT3 is restarted. For convenience, it is recommended to automatically start the servers when the e-RT3 is booting.

Node-RED Boot

a. If needed, SSH into the e-RT3.
b. To add Node-RED to the systemd boot, we will be using PM2, a process manager for Node.js. Run the following commands:

npm install -g pm2
Enter fullscreen mode Exit fullscreen mode

Please change the highlighted with the latest version of Node.js installed, if different. Use the command “node –version” to find the latest version.

pm2 start /home/ert3/.nvm/versions/node/v20.15.1/bin/node-red
Enter fullscreen mode Exit fullscreen mode
pm2 save
Enter fullscreen mode Exit fullscreen mode
pm2 startup systemd
Enter fullscreen mode Exit fullscreen mode

The following command is given within the terminal and may change depending on your setup. If different than below, please follow the instructions for the path given in the terminal.

sudo env PATH=$PATH:/home/ert3/.nvm/versions/node/v20.15.1/bin /home/ert3/.nvm/versions/node/v20.15.1/lib/node_modules/pm2/bin/pm2 startup systemd -u ert3 --hp /home/ert3
Enter fullscreen mode Exit fullscreen mode

c. Turn the e-RT3 off and on.
d. Verify that Node-RED is properly started at boot by accessing the web-browser (http://192.168.2.72:1880/) without any additional commands.

Grafana Boot

a. If needed, SSH into the e-RT3.
b. To add Grafana to the systemd boot, run the following commands:

sudo /bin/systemctl daemon-reload
Enter fullscreen mode Exit fullscreen mode
sudo /bin/systemctl enable grafana-server
Enter fullscreen mode Exit fullscreen mode
sudo /bin/systemctl start grafana-server
Enter fullscreen mode Exit fullscreen mode

c. Turn the e-RT3 off and on.
d. Verify that Grafana is properly started at boot by accessing the web-browser (http://192.168.2.72:3000/) without any additional commands.

7) Grafana Dashboard Setup

We will be setting up the Grafana Dashboard and its connection to the InfluxDB Cloud server.

a. Access the Grafana web-browser at http://192.168.2.72:3000/
b. Login into the Grafana web-browser with the following default username and password:

Username: admin

Password: admin

c. You can set your own password or choose to keep it the same.
d. On the home page, click the hamburger icon on the left to access “Connections” > “Data sources”.
e. Click on “Add data source”.

Image description

f. Select the InfluxDB option.
g. Under “Query Language”, select “Flux”.
h. Under “HTTP”, fill in the InfluxDB Cloud server URL: https://us-east-1-1.aws.cloud2.influxdata.com/ If you live in a different region, use the appropriate server URL.

Image description

i. Under “Auth”, turn on “Basic auth” and “Skip TLS Verify”.

Image description

Depending on your company’s security policies, you may need to assign a CA certificate rather than skipping the TLS Verify.

j. In “InfluxDB Details”, name the “Organization” as “ert3”. Under “Token”, fill in the API token generated from the InfluxDB Cloud. Click on “Save & test”.

Image description

h. Click on the hamburger icon on the left again and navigate to “Dashboards”.
i. Select “New” > “Import”.
j. Upload the " eRT3_Sushi_Dashboard-1719517428740.json" JSON file from the ZIP-folder provided with this manual.
k. Under the “InfluxDB Cloud” dropdown, select “InfluxDB (default)” and click “Import”. You can now view the dashboard panels and change them as you wish. As the Node-RED flow is not configured and no data has been sent through the cloud database, all the panels should say “No data”.

Image description

8) Gateway Node-RED Setup

We will be setting up the Gateway Node-RED flow and its connection to the e-RT3 Node-RED flow. The purpose of this flow is to receive data from the LoRaWAN and send it to the e-RT3 in the form of a JSON object. It is important to note that firmware versions of the gateway older than 5.3.0 use Node-RED. 5.3.0 or later use the “GW Custom App Generator for Sushi Sensor”. This manual uses the Node-RED firmware version. These steps can also be replicated with the Custom App version by placing http://192.168.2.72:1800/sushidata in the URL box. You can learn more in the Gateway manual TI01W06A51-50EN.

a. Access the Gateway Node-RED web-browser at https://192.168.2.4:1880/. You can also access the web-browser from the Gateway web-browser by navigating to “Apps” and then clicking on “Launch Node-RED”.
b. Login into the Gateway Node-RED web-browser with the following default username and password:

Username: admin

Password: Yokogawa1

c. The dashboard will appear. Ensure all the blocks are in place and connected by dragging and dropping them from the left-hand bar:

Image description

d. Double-click on the orange function block and use the script below:

Image description

e. Exit the function block. Double-click on the yellow input block and match the inputs below:

Image description

The Gateway Node-RED server will be making a http post request to the e-RT3 Node-RED server.

f. Make sure to click on the “Deploy” button if any changes were made.

9) e-RT3 Node-RED Setup

We will be setting up the e-RT3 Node-RED flow and its connection to the Gateway Node-RED flow and the InfluxDB Cloud server. The purpose of this flow is the translate the JSON object received from the Sushi Gateway into readable sensor data and send it to the cloud database.

a. Access the e-RT3 Node-RED web-browser at http://192.168.2.72:1880/
b. Skip through the tutorial and instructions.
c. Click on the hamburger icon on the top-right side and select “Import”.
l. Click on “select a file to import” and upload the “eRT3_Sushi_Application_NodeRED_flow.json” JSON file from the ZIP-folder provided with this manual. Click on “Import”.
d. Switch to the new tab created by the file named “eRT3_Sushi_Application_NodeRED_flow.json”.
e. You will notice that an error is thrown for the influxdb blocks. To fix this error, we will need to add the “influxdb” library.

Image description

f. Click on the hamburger icon and click on “Manage pallete”. Switch to the “Install” tab and look up the module “node-red-contrib-influxdb”. Select the first option with this exact name. When selecting which node-red packages to install, it is important to consider the last time the package was updated.

Image description

g. Click on “install”.
h. Once it is done installing, click on “Close”.
i. Double-click on the brown influxdb block named “[v2.0] Cloud sushi” that has appeared.

Image description

j. Match the inputs below if different:

Image description

The bucket name must match what was named within the InfluxDB Cloud server. If you followed the manual exactly, use “sushiSensor”. Keep the “Measurement” name as “sushi” or you will have to change things later.

k. Click on the pencil icon to edit the influxdb node.
l. Fill in the InfluxDB Cloud server URL: https://us-east-1-1.aws.cloud2.influxdata.com/ If you live in a different region, use the appropriate server URL.
m. Make sure to input the InfluxDB Cloud API token:

Image description

n. Click on “Update” and “Done”.
o. (Optional): Double-click on the leftmost yellow http request block to see it matches the code below:

Image description
The URL must match the endpoint given in the Gateway Node-RED http request (“/sushidata”).

b. Double-click the “sushiTranslation” block and copy and paste the code from the “sushi_translation_script_on_ert3.txt” text file into the “On Message” entry. You can find this file in the ZIP-folder provided with this manual.
c. If you wish to send data to GA10, draw a line from the initial post request to the GA10 post request. You must have GA10 setup on your PC. Please refer to IM 04L65B01-01EN for more information on how to connect GA10 and Sushi. Match the inputs below if different:

Image description

p. Click on “Deploy” in the top-right corner. You should receive a successful deployment message. You have now completed setting up all the software.

Image description

q. To save the flow, click on the hamburger icon. Select “Export”.
r. Click on the “Local” tab. Name the JSON file whatever you wish and click on “Export to library”.

Image description

10) Using the Application

You have completed all the steps to set up the application. To collect data and visualize it, you need to turn on the Sushi sensors that are connected to the Gateway. Vibration, temperature, and pressure sensors work with this application. Please refer to the Sushi sensor and Gateway manuals to learn more, respectively: IM 01W06C01-01EN, TI01W06A51-50EN.

a. Turn on all Sushi sensors configured with the Gateway.
b. Monitor the Grafana “eRT3_Sushi_Dashboard” as data comes through by navigating through the hamburger icon. Click on “Dashboards”. Select the “eRT3_Sushi_Dashboard”.
c. You can select which devices you wish to monitor based on their EUIs. Click on the “eui” drop-down menu and select accordingly. If you select more than one EUI to display, the panels will repeat for each EUI.

Image description

d. Depending on the sensor you are monitoring, certain panels will display “No data”. For instance, if you are displaying a vibration sensor, the panels for temperature and pressure sensors will display “No data”. Depending on the parameters selected within the Sushi app, these will appear appropriately within the panels. In the image below, a vibration sensor with the parameters for only the X-Axis is being visualized:

Image description

e. If you wish to show/hide any panels, click on the drop-down arrows next to the title names:

Image description

f. If you do not wish to have a permanent monitor, you can remove the PC from the setup. The sensors will continue to collect data and send it to the cloud database and Grafana regardless of if the PC is present.

You can now visualize Sushi sensor data on Grafana using InfluxDB Cloud and the e-RT3.
Contact netra.gandhi@yokogawa.com for questions.

Top comments (0)