当前位置:网站首页>Mqtt protocol usage of LabVIEW

Mqtt protocol usage of LabVIEW

2022-06-24 18:46:00 Pouring rookie

One 、MQTT summary

MQTT Protocol is a message queuing transmission protocol , Adopt subscription 、 Publishing mechanism , Subscribers receive only the data they have subscribed to , Non subscription data will not be received , It ensures the necessary data exchange , It also avoids the storage and processing caused by invalid data . Therefore, it has been widely used in the industrial Internet of things .

Be careful : It can be seen from the picture that ,MQTT There were : Publisher 、 subscriber 、 The server . If you are interested, you can go to MQTT Chinese net understand .

Two 、MQTT Project Download

because NI The company has not yet released MQTT modular , So we can only use open source projects for testing , Of course, the little friend can also according to MQTT The agreement TCP Write on the basis of communication .

Here I will test it with an open source project ,github Download address :https://github.com/cowen71/mqtt-LabVIEW, Will use GitHub You can download according to the download address , Here I download it in the form of a compressed package , As shown in the figure below :

3、 ... and 、 Open the project

  1. Double click the project file to open , As shown in the figure below :

  2. Open the test program . As shown in the figure below :

  3. Enter the test program , As shown in the figure below :

Four 、 Project use

The interface required by the test program is as follows :

All my friends know that , Connect MQTT service , You need to know about the server IP And port , So in LabView Configure... In the test program IP And port are shown in the following figure :

5、 ... and 、MQTT The server

MQTT The server is used in many ways , For example, you can set up a server by yourself MQTT platform , You can also directly use the public platform for testing ( For example, Tencent cloud 、 Alicloud, etc ).

No account has been registered on the cloud platform , So here I use mosquitto Software , A local one MQTT The server , of mosquitto The software can be browsed mosquitto Use and common configurations .

6、 ... and 、 test

  1. start-up MQTT The server , As shown in the figure below :

  2. Use mosquitto subscribe "a/b" The theme , The following figure shows the successful subscription :

  3. Use LabView Release data

  4. Use LabView Subscription data

  5. Use mosquitto Release data

As can be seen from the above results ,LabView Of MQTT There is no problem with project testing , So you can study it carefully , Of course, you should pay attention to the copyright of others when using open source projects , As shown in the figure below :

reference

MQTT agreement :https://baike.baidu.com/item/MQTT agreement /56980070?fr=aladdin
Labview adopt MQTT Protocol publish and subscribe messages :https://wenku.baidu.com/view/0daf4e2c5b1b6bd97f192279168884868762b83a.html

原网站

版权声明
本文为[Pouring rookie]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241551012338.html