
Get More IIoT Insights
Click the blue text
Follow us


HongKe
IIoT
Learn to Use Industrial Raspberry Pi as
MQTT Broker for Testing
Introduction
MQTT is a client-server based message publish/subscribe transport protocol. The characteristics of the MQTT protocol are lightweight, simple, open, and easy to implement, making it widely applicable. Currently, the MQTT protocol is widely used in scenarios such as satellite link communication sensors, occasionally dialed medical devices, smart homes, and some miniaturized devices. Additionally, the MQTT protocol can also be used in machine-to-machine (M2M) communication and Internet of Things (IoT) scenarios.
In the communication process, there are three identities in the MQTT protocol: Publisher, Broker (Server), and Subscriber. The message publishers and subscribers are both clients, while the message broker is the server, and a message publisher can also be a subscriber. The industrial Raspberry Pi can act as both a client and a server. This article will share how to set up the industrial Raspberry Pi as an MQTT server.
HongKe Technology
Hong
/
Ke
/
Solution
01
Tools
1. 24V Power Supply * 1
2. RevPi Connect Module * 1
3. Router * 1
02
Operation Steps

Download the dependencies required for mosquitto
sudo apt-get install libssl-dev
sudo apt-get install uuid-dev
sudo apt-get install cmake

Download mosquitto and extract
1. Version:
Currently, the latest version of mosquitto on the official website is 2.0.14. For more version information, you can click the link to view: Download | Eclipse Mosquitto. This article uses version 2.0.9 as an example:
wget https://mosquitto.org/files/source/mosquitto-2.0.9.tar.gz

2. Extract:
tar zxfv mosquitto-2.0.9.tar.gz
3. Enter the directory:
cd mosquitto-2.0.9
4. Compile:
make

If an error occurs: fatal error: cjson/cJSON.h: No such file or directory, execute the following code before compiling again:
sudo apt install libcjson1 libcjson-dev

5. Install
sudo make install

Start mosquitto
mosquitto -v

The default configuration file is used here. If you have other requirements, you can modify the configuration file yourself.
At this point, start the MQTT client and try to connect.

03
Conclusion
The industrial Raspberry Pi can facilitate MQTT testing to a certain extent. For example, in cases with smaller data volumes, the industrial Raspberry Pi can be used as a testing tool to replace the server for testing pathways.
Furthermore, the industrial Raspberry Pi is more suitable as a client to upload data to the cloud platform, enabling data interaction between the site and the cloud platform. The industrial Raspberry Pi supports many communication protocols, such as Modbus TCP/RTU, EtherCAT, Profinet, etc., and can act as a protocol conversion gateway, transmitting industrial site device data through communication protocols to the industrial Raspberry Pi, which then uploads the processed data to the cloud platform via MQTT for management.

04
Solution Overview
The HongKe industrial Raspberry Pi product features a real-time Raspbian system, with an integrated Broadco multi-core processor capable of handling complex tasks such as image processing.

Additionally, it is compact and flexible, with low power consumption, supports development using Python/Java/C/C++/C#/Node-RED visual programming tools, and can realize CPDESYS soft PLC functions, helping users quickly create applications in data acquisition and small control scenarios, achieving industrial IoT and digital production.


HongKe – Industrial IoT
HongKe is a high-tech company with over 3 years of experience in the industrial IoT IIoT industry, collaborating with top companies in the world such as EXOR, Eurotech, Unitronics, Matrikon, KUNBUS, etc., providing advanced high-end industrial 4.0 industrial touch screens, high-end edge computers, IoT development frameworks, PLC and HMI integrated machines, OPC UA, industrial Raspberry Pi, SCADA and other solutions. All members of the IoT division are professionally trained and certified, with an average of over 3 years of technical experience, consistently earning excellent reputations from customers. We actively participate in industry associations and have made significant contributions to the promotion of advanced technology. To date, HongKe has provided various solutions from hardware to software for numerous users in the industry and has participated in and assisted in many OEM device R&D and migration projects, as well as intelligent factory and industrial 4.0 upgrade projects for end users.
Follow HongKe for more cutting-edge IIoT knowledge
Previous Issues
Highlights
RevPi Application Cases · Here
● Quickly upload sensor data to the cloud in just 4 steps using CloudRai.Box
● How to achieve mutual conversion between industrial protocols and MQTT in a low-code/no-code manner?
● Five possible uses of the industrial Raspberry Pi as a soft PLC
● How the industrial Raspberry Pi, combined with CODESYS, easily solves three major challenges faced by IIOT
Edge Computing · What You Should Know
● Want to achieve device servitization? You need a powerful edge device!
● What is the machine-as-a-service model?
● What features should HMI for the food & pharmaceutical industry have?
● Application of smart industrial control screen eX707 in underwater remote-controlled robots
What You Want to Know · OPC UA
● How to solve the headache of DCOM configuration
● A step-by-step guide to mastering all your UA servers with the OPC UA data platform
Powerful Data Acquisition and Monitoring System · mySCADA
● Example of upgrading and controlling wastewater treatment automation with myBOX
● Example of remote monitoring for smart buildings/homes
MQTT Broker · HiveMQ
● Supporting communication between AGV vehicles and control systems
● IAV applies HiveMQ and automotive data to build an urban mountain flood early warning system
● BMW car-sharing applications rely on powerful HiveMQ for reliable connections