Realtime Visualisation of IO-Link Vibration data using MQTT, grafana, influxdb, and Godot

Calum Knott - Apr 4 - - Dev Community

For an upcoming project, I wanted to explore the capabilities of a vibration sensor, and to see if i could develop some realtime visualisation.

I had only 1 morning to experiment, so this is the result of some quick prototyping

 Stack

Hardware

The sensor is a VVB001

The IFM AL1350 pushes data via MQTT to a broker.

 Software

For this demo I used Aedes internally in node-red to serve as the broker.

GitHub logo martin-doyle / node-red-contrib-aedes

MQTT broker for Node-RED based on Aedes

node-red-contrib-aedes

MQTT Broker for Node-RED based on Aedes.

You can use the MQTT protocol in Node-RED without an external MQTT broker like Mosquitto.

Node.js CI js-semistandard-style Codacy Badge

Open Source Love NPM version

Background

This node was created because the original MQTT broker node-red-contrib-mqtt-broker uses mosca which is no longer maintained.

Installation

You can install the node directly within the editor by using the Palette Manager.

To install the node from the command-line, you can use the following command from within your user data directory (by default, $HOME/.node-red):

npm install node-red-contrib-aedes
Enter fullscreen mode Exit fullscreen mode

Flows

Just put this node on Node-RED and hit the deploy button. The MQTT Broker will run on your Node-RED instance. flows

Features

  • Standard TCP Support
  • WebSocket Support via port or path
  • SSL / TLS
  • Message Persistence (In-memory, LevelDB or MongoDB)

For more information see Aedes.

Server without public IP or behind firewall

If your server is behind a firewall or you cannot open any ports…

Node red then manipulates the raw byte data, scales it according the the required values, and re-publishes it on a seperate broker, and also simultainiously publishes it via HTTP request to....

InfluxDB V2 is used to store the data for long term analysis / futre playback.

Grafana is used for the web-based realtime visualisation, using the Grafana MQTT live datasource plugin. (we subscribe to the republished MQTT streams

Sidenote - this is a bit of a pain to install, and requires way more build tools than I expected!

Game Engine

I am using Godot, a capable 3D engine, to subscribe to the same MQTT topics, and visualise.

For future reference, Plugins used in this demo video include.

GitHub logo LD2Studio / godot4-graph2d

Graph 2D is an addon able to display plots in your user interface in a very simple way

Graph2D add-on for Godot 4.x

Graph 2D is an addon able to display plots in your user interface in a very simple way.

This repository contains the add-on and examples.

Features

  • Display several plots on the same graph.
  • Supports curve thickness and color.
  • Customizable chart axes (axis label and grid).
  • Real-time plotting.
  • Works with all renderers.
  • Works on desktop platforms and HTML5 (others target were not tested).
  • Documentation included with the plugin.

Usage

Single plot

  • Add a Graph2D node as a child of the root node. Adapt its size to the control.

Alt text

Alt text

  • Create a new plot using the method Graph2D.add_plot_item() from your script. The arguments are in order the name of the plot, its color and finally the thickness of the line.
    • Note: This method will return an Graph2D.PlotItem object which will then be used to reference the plot and update its points.
func _ready() -> void
    
Enter fullscreen mode Exit fullscreen mode

GitHub logo goatchurchprime / godot-mqtt

Godot addon which implements the MQTT client protocol

MQTT

Godot 4 addon - to implement MQTT

Installation

Clone the repo and copy the addons/mqtt folder into your project's addons folder (or use the AssetLib to install when

Applications

MQTT is probably the simplest known networking protocol you can use to communicate between systems, which is why it is often used by low power IoT (Internet of Things) devices.

In spite of its simplicity, MQTT is extremely flexible and has the advantage of being standardized enough that you don't need to write your own server-side software. You can often get by with "borrowing " the use of a public server on the internet (see test.mosquitto.org).

Uses for MQTT in Godot are chat rooms, receiving and sending messages to physical devices, high score tables, remote monitoring of runtime metrics (eg framerate) of an alpha release for quality control, and as a signalling server for the powerful WebRTC peer-to-peer networking…

. . . . . . . . . . . . . . . .
Terabox Video Player