chart-networkCoreflux MQTT Broker

Real-time vibration severity monitoring using LoT scripting + Python

Overview

This guide walks you through setting up the Coreflux MQTT Broker on a Revolution Pi (ARM64) industrial edge device, deploying LOT (Language of Things) actions from VS Code, and running Python-based vibration severity calculations directly inside the MQTT broker with no cloud dependency.

Data flow

Prerequisites

Hardware

Software (Development PC)

  • Visual Studio Code

  • LoT Languagearrow-up-right Support by Coreflux extension (VS Code marketplace)

  • Python 3.11.9 from python.org (Not Microsoft Store version, see troubleshooting)

Software (Revolution Pi)


1. Installing Coreflux on Revolution Pi

1

Download and Extract

Download the Linux ARM64 build of Coreflux MQTT Broker from coreflux.org. Transfer it to your RevPi via SCP or download directly:

2

Install the Coreflux MQTT Broker

The installation instructions are given on this page: https://docs.coreflux.org/quick-start/installation#raspberry-piarrow-up-right

Start the broker to verify it works:

You should see the broker start and listen on port 1883. Press Ctrl+C to stop after confirming startup.

circle-info

Default Credentials

The default Coreflux broker credentials are username: root, password: coreflux. These are required when connecting from VS Code or MQTT clients.

3

Install VS Code

Install the open source code editor i.e., VS Code, on your computer: https://code.visualstudio.com/arrow-up-right

4

Install LoT extension in VS Code

LoT (Language of Things) is a human-readable language for IoT automation. It uses near-English syntax to define logic, data structures, and integrationsβ€”all executed directly within the Coreflux MQTT broker. The LoT extension lets you interact with the Coreflux MQTT broker from VS Code. To install LoT, go to the extension in VS Code and search for LoT.

5

Learning LoT

To learn how LoT interacts with Coreflux MQTT Broker, check this repository, which has many sample codes and exercises: https://github.com/CorefluxCommunity/Language-Of-Things-Training/tree/mainarrow-up-right

6

Configure VS Code Connection

In your LoT project folder, create or edit the .broker file with credentials embedded in the URL:

circle-exclamation

2. Setting Up Python Runtime on Revolution Pi

Coreflux uses an embedded Python runtime located in ~/coreflux/python_runtime/. On Linux ARM64, this requires manually copying the system Python shared libraries into this folder.

1

Install Required Python Packages

circle-info

Why python3.11-dev?

The -dev package installs the shared library files (libpython3.11.so) that embedded runtimes need to load Python via the C API. Without it, the broker finds the python_runtime folder but cannot initialize Python.

2

Find the Shared Library Files

3

Copy Files to python_runtime

4

Confirm Python Loads at Broker Startup

Start the broker and look for these lines in the output:

circle-check

3. Troubleshooting

3.1 Python Version Compatibility

circle-exclamation

3.2 Windows β€” Microsoft Store Python

On Windows, if Python is installed via the Microsoft Store, the where Python command returns:

circle-exclamation

3.3 Windows- Copying Python to python_runtime

After installing Python 3.11.9 from python.org, copy the full installation into the broker folder. This is in case you are running Coreflux Broker on Windows

3.4 Port 1883 Already in Use (Linux)

If you see 'MQTT Port 1883 is in use by unknown process', another instance of Coreflux is already running (possibly managed by pm2 or systemd):

3.5 'Entity Not Found on Broker' Error

This error appears in the LoT notebook when clicking the play button, but the action has never been deployed, or the broker has restarted and lost the action. The play button in a .lotnb file deploys the action to the broker; it does not auto-persist between broker restarts unless the action file is saved in the broker's persistent storage location.

circle-info

Deployment Tip

After restarting the broker, re-run all cells in your .lotnb file using 'Run All' to redeploy all actions.


4. Vibration Severity Example

4.1 The Python Script- VibrationCalc.py

Create this file in your VS Code project. It will be deployed to the broker's python_scripts folder:

circle-info

ISO 10816 Reference

The output of this function is vibration severity in mm/s RMS. According to ISO 10816: Zone A (0-0.7 mm/s) = excellent, Zone B (0.7-1.8) = acceptable, Zone C (1.8-4.5) = monitor, Zone D (>4.5) = danger.

4.2 The LOT Action

Create a new .lotnb file in VS Code with this LOT action code:

4.3 Deploy from VS Code

  1. Open the .lotnb file in VS Code

  2. Confirm the status bar shows 'MQTT: Connected to mqtt://<RevPi-IP>:1883.'

  3. Enter your user credentials:

    1. Username: root

    2. Password: coreflux

  4. Click the β–Ά play button on the LOT action cell to deploy

  5. Check the COREFLUX ENTITIES panel β€” the action should appear

  6. Publish test messages to X_VRMS, Y_VRMS, Z_VRMS topics

  7. Subscribe to output/vibration_severity to see results

4.4 Test with MQTT Client

In the following example, we are reading actual vibration data via OPC UA. You can just replace the vibration data source in the flow for your use-case.

The source code for this flow is shared in the resource section.

4.5 ISO 10816 Severity Classification Table

Zone

RMS (mm/s)

Classification

Action

A

0 – 0.7

Excellent

New or recently serviced machine

B

0.7 – 1.8

Acceptable

Normal long-term operation

C

1.8 – 4.5

Monitor

Tolerable short-term, investigate

D

> 4.5

Danger

Shutdown recommended immediately


5. Network Configuration on Revolution Pi

5.1 Check Current IPs

5.1 Assign Static IP to eth1

If you need to assign a static IP to the second Ethernet port (e.g. for direct connection to a PLC or IO-Link master):

6. Managing the Coreflux Broker

6.1 Start with Visible Logs

6.2 Run in Background (pm2)

6.3 Run in Background (pm2)

Resources:

Node-RED flow

file-download
21KB

Quick Reference

Item

Value / Command

Broker port

1883

Default credentials

root / coreflux

.broker file format

mqtt://root:coreflux@<IP>:1883

Python version (required)

3.11.x β€” do NOT use 3.12+

python_runtime location (Linux)

/home/pi/coreflux/python_runtime/

python_runtime location (Windows)

CorefluxMQTTBroker_win-x64_1.10.0\python_runtime\

Key apt package

python3.11-dev

Check broker port

sudo lsof -i :1883

View broker logs

sudo ./CorefluxMQTTBroker 2>&1 | tee coreflux.log

Deploy action from VS Code

Click β–Ά play button on .lotnb cell

Output topic

output/vibration_severity

Last updated