MQTT Publish from Simulink model to mosquitto broker
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to publish MQTT messages from my model in Simulink to the mosquitto broker. So far I have been able to publish messages successfully from MATLAB script to the mosquitto broker using the MQTT in MATLAB toolbox. I would like to do the same through my Simulink model.
I understand that there is a MQTT Publish block in Simulink for Raspberry Pi that publishes message to a ThingSpeak broker. Is there a way to use this block for any other Simulink model (that does not use Raspberry Pi) and also for any other broker like mosquitto in my case?
If the MQTT Publish block cannot be used for this purpose, should I use a MATLAB function block and write the MATLAB code for MQTT in a .m file and include it in Simulink?
Is there any other way to implement MQTT Publish in Simulink models (without Raspberry Pi and for brokers other than ThingSpeak)?
Antworten (1)
Reeno Joseph
am 12 Nov. 2020
Hello Joyeeta ,
The MQTT blocks in the Raspberry Pi Simulink support package can work with other brokers as well.
You can configure the broker details within the model config setting.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/411338/image.png)
2 Kommentare
dhanavaradhan M
am 16 Feb. 2021
can you say how u did that ( " I used the MQTT in MATLAB toolbox, wrote a MATLAB code for MQTT Publish and used it in the Simulink model in a MATLAB function block " )
Communitys
Weitere Antworten in ThingSpeak Community
Siehe auch
Kategorien
Mehr zu Run on Target Hardware finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!