WHITE PAPER
Driving the Future of Connected Cars with MQTT →

Bridging KNX Data to MQTT: Introduction and Hands-on Tutorial

Neuron Team
Sep 11, 2023
Bridging KNX Data to MQTT: Introduction and Hands-on Tutorial

Introduction

This blog will introduce how to use Neuron to collect data from KNX devices, upload the collected data to EMQX, and view it using MQTTX.

We will use a Linux machine for installing EMQX, MQTTX, and Neuron. As ETS and KNX Virtual only support Windows, we run a Windows VM to simulate KNX installation.

The Architecture of KNX to MQTT Bridging

EMQX Quick Start

EMQX provides multiple installation methods, and users can check the detailed installation methods in the documentation. This example uses container deployment to quickly experience EMQX.

Run the following command to obtain the Docker image:

docker pull emqx/emqx:5.1.0

Run the following command to start the Docker container:

docker run -d --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8084:8084 -p 8883:8883 -p 18083:18083 emqx/emqx:5.1.0

Access the EMQX Dashboard by visiting http://localhost:8083/ (replace “localhost” with your actual IP address) through a web browser. This allows you to manage device connections and monitor related metrics. Keep the Docker container running for this tutorial. You can refer to the documentation to experience more features in the Dashboard.

Initial username: admin, initial password: public

Setup KNX Virtual Using ETS

We need to download and install KNX Virtual. There is a blog tutorial on how to simulate KNX installation using ETS and KNX Virtual, or if you prefer, a video tutorial KNX Virtual Basics.

To keep things simple, we will simulate a KLiX (D0), a dimming actuator (D0), a blinds/shutter actuator (D2) and a switch actuator (D7) in KNX Virtual. The association between addresses and group objects is shown in the following image.

KNX Virtual

Neuron Quick Start

Consult the installation instruction on how to install Neuron. After Neuron is installed, you can access the dashboard through your browser at http://localhost:7000 (replace "localhost" with your actual IP address).

Step 1. Login

Log in with the initial username and password:

  • Username: admin
  • Password: 0000

Step 2. Add a south device

In the Neuron dashboard, click Configuration -> South Devices -> Add Device to add an knx node.

Add a south device

Step 3. Configure the knx node

Configure the newly created knx node as the following image shows.

Configure the *knx* node

Step 4. Create a group in the knx node

Click the knx node to enter the Group List page, and click Create to bring up the Create Group dialog. Fill in the parameters and submit:

  • Group Name: grp.
  • Interval: 1000.

Create a group in the *knx* node

Step 5. Add tags to the group

Add four tags corresponding to the dimming actuator, shutter actuator and switch actuator in the KNX Virtual configuration.

Add tags to the group

Step 6. Data monitoring

In the Neuron dashboard, click Monitoring -> Data Monitoring, and see that tag values are read correctly.

Data monitoring 1

Data monitoring 2

Step 7. Add an MQTT North app

In the Neuron dashboard, click Configuration -> North Apps -> Add App to add an mqtt node.

Add an MQTT North app

Step 8: Configure the mqtt node

Configure the mqtt node to connect to the EMQX broker set up earlier.

Configure the *mqtt* node

Step 9. Subscribe the mqtt node to the knx node

Click the newly created mqtt node to enter the Group List page, and click Add subscription. After a successful subscription, Neuron will publish data to the topic /neuron/mqtt/knx/grp.

Subscribe the *mqtt* node to the *knx* node

View Data Using MQTTX

Now, you can use an MQTT client to connect to EMQX and view the reported data. Here, we use MQTTX, a powerful cross-platform MQTT client tool, which can be downloaded from the official website.

Launch MQTTX, and add a new connection to the EMQX broker set up earlier, then add a subscription to the topic /neuron/mqtt/knx/grp. After a successful subscription, you can see that MQTTX continues to receive data collected and reported by Neuron. As shown in the following figure.

MQTTX

Conclusion

In this blog, we introduced the KNX protocol and demonstrated the overall process of bridging KNX data to MQTT using Neuron.

KNX provides a robust and flexible platform for home and building automation. Neuron, with its powerful connectivity for Industrial IoT, facilitates the data collection from KNX devices and seamless transmission of the acquired data to the cloud for convenient remote control and monitoring whenever necessary.

Neuron also supports other industrial protocols like Modbus, OPC UA, SIEMENS, and more. For more bridging tutorials, read our post:

Contact Our IIoT Solution Experts
Contact Us →

Related Posts