Configuration of the Process Workflow

Configuration of the Process Workflow

This guide provides step-by-step instructions on how to configure Node-RED to process sensor data via MQTT and store it in InfluxDB. The example used is based on group0 from the Node-RED instance running on the Pforzheim University IoT Server via the URL https://iot.hs-pforzheim.de/nodered. If you want to build comparable flows with n8n, review the previous section for an overview of the platform and adapt the MQTT and InfluxDB steps accordingly.

Prerequisites

  • Access to the Node-RED instance at iot.hs-pforzheim.de/nodered
  • Tinkerforge sensors (e.g., temperature, humidity, barometer, CO2 sensors) attached to the HAT and tinkerforge_mqtt running
  • A connection to an InfluxDB organization for bucket storage

Configuration Process

Follow each step thoughfully to successfully preprocess and transfer data from the Mosquitto MQTT Broker to our InfluxDB bucket.

Log into Node-RED

  1. Open a web browser and navigate to iot.hs-pforzheim.de/nodered. Node-RED Login Overview
  2. Use the provided credentials to log into the Node-RED dashboard. For development purposes all students use the same account (admin) to share the same overview.

Once logged in, you should see a workspace where nodes can be arranged and configured.

Node-RED Dashboard

Access the Flow

  • After logging in, navigate to the workspace titled vwa_group0 (as seen in the screenshots). For your own group works, please navigate to your group’s workspace.
  • The flow consists of several sensor inputs (e.g., temperature, humidity, barometer, CO2) that are processed and then output to an InfluxDB instance.
  • Each sensor node captures data from its respective MQTT topic. The nodes for Temperature Sensor, Humidity Sensor, Barometer Sensor, and CO2 Sensor are connected to two outputs:
  • One output stores the data in InfluxDB.
  • The other output forwards the raw data to the debug panel via msg.payload for monitoring.

Temperature Sensor Flow

Adding MQTT Input Nodes

To replicate the sensor configuration:

  1. Drag an MQTT input node from the palette (found on the left side under the common section).
  2. Configure the MQTT input node: MQTT input node overview
    • Set the server details (this is already configured for your group).
    • Define the topic that matches the sensor’s topic (e.g., tinkerforge/callback/temperature_v2_bricklet/Nz7/temperature for the image’s temperature data).
  3. Name the node according to the sensor type (e.g., “Temperature Sensor”).

Storing Data in InfluxDB

  1. Drag an InfluxDB output node from the palette (found under storage if not available).
  2. Configure the node: InfluxDB output node overview
    • Select the connection HSPF InfluxDB (IoT) details for InfluxDB.
    • Define the organization to match VWA
    • As bucket, select your group’s bucket (schema: vwa_groupX) as defined before in the configuration of data storage
    • Ensure the proper format for incoming data is configured (e.g., JSON format for time-series data).
  3. Connect the sensor’s MQTT node to the InfluxDB output node.

Debugging the Data

  1. Add a debug node (found in the palette under the common section) and connect it to the sensor’s MQTT output.
  2. This allows you to view the msg.payload in real time to verify the incoming sensor data.
  3. Open the debug panel on the right-hand side to monitor the output.

Deploy the Flow

  1. After all nodes are configured and connected, click the Deploy button (found in the top-right corner of the Node-RED interface).
  2. This will activate your flow, and you should see incoming data from your sensors being processed and output to InfluxDB. Node-RED deploy overview

Conclusion

You have now successfully created a new workflow in Node-RED for your group. This flow can be used to subscribe to MQTT topics and process them. In a final step, you store the topics payload to your group’s bucket in InfluxDB. Make sure to replace X with the appropriate group number throughout the creation process of your flow. Furthermore, ensure your subscribed topic is written correctly. If you encounter any issues or need further assistance, feel free to consult the Node-RED Documentation or reach out to your system administrator.

In the next section, we will discover how we can visualise these processed information from our bucket.