Skip to the content.

Plot Environment Sensor Data

Lab Objectives

In this lab you will import Node-RED flows which create Dashboard Charts. After learning about Node-RED Dashboard Charts, you will be able to display temperature and humidity graphs of the Device environmental sensors. You will learn:

Introduction

In this section you will learn about Node-RED Dashboard Charts and then create a chart to graph the sensor data arriving from the device.

Step 1 - Add the Dashboard Nodes to the Node-RED Pallet

Follow the steps outlined in the introduction to Node-RED to import the node-red-dashboard nodes to your Node-RED pallet

Note that the instructions below are for IBM Node-RED, and the method for installing nodes may vary by platform. Please look for instructions on how to do this on your chosen platform.

Step 2 - Import the Node-RED Dashboard Chart Flows

Open the “Get the Code” github URL listed below, mark or Ctrl-A to select all of the text, and copy the text for the flow to your Clipboard. Recall from a previous section, click on the Node-RED Menu, then Import, then Clipboard. Paste the text of the flow into the Import nodes dialog and press the red Import button. Finally, click on the red Deploy button in the upper right corner.

Node-RED Dashboard Charts : Get the Code{target=_blank}

Step 3 - Learn about Various Node-RED Dashboard Chart types


IMPORTANT

You need to configure the MQTT connection details in the MQTT input node, to be sure that it will connect to your MQTT broker and subscribe to the right topic matching the sensor data published by your device.


Line chart array

Step 4 – Generating and Displaying Data in Node-RED Dashboards

The next Node-RED flow - Dashboard Intro - uses a variety of UI widgets to display data in the Node-RED Dashboard. There is a Switch node that turns On/Off a random number generator function node. The simple random numbers are sent to a line Chart node, a Gauge node, a Slider node, a Text node and, if the number exceeds a threshold, will display an alert notification message.

Node-RED Dashboard Intro

Step 5 - Plot Device Environmental Sensor Data

Now that you have learned about Node-RED Dashboard and Chart types, you are ready to plot the real-time device environmental sensor data. If the cloud db you are using offers you limited capcity, you may want to delete the tabs Chart Intro and Dashboard Intro by double clicking each tab to open up the tab configuration sidebar, where you will find a delete button.

Temperature and Humidity chart

Step 6 - Trigger Alerts when Real-Time Sensor Data Exceeds a Threshold Value

Often IoT devices and sensors are deployed so that alerts can be triggered when the real time sensor data exceeds a threshold value. In this last Step, the flow checks the temperature values and, if the temperature exceeds the threshold, triggers a Node-RED Dashboard notification.

NRD ESP8266 DHT chart flow

Temperature and Humidity chart


Click to return to the Part 3 homepage.