image thumbnail

MQTT driver for ESP32 target

version 0.12 (267 KB) by Supachai Vorapojpisut
MQTT blockset for Waijung 2 (ESP32 target) contains three blocks for connecting, subscribing and publishing with MQTT broker.

73 Downloads

Updated 13 Oct 2021

View License

MQTT blockset for Waijung 2 contains three blocks for connecting, subscribing and publishing with MQTT brokers. To use this blockset, user must first download and install Waijung 2 (https://www.aimagin.com/en/waijung-2.html) as Embedded Coder for ESP32 target. Intenally, this blockset wraps the C API of ESP-MQTT libray using MATLAB System Object.
The preparation steps are as follows:
1. extract 7z file using 7zip application, avoid to use path with space and special characters.
2. run MATLAB and change working folder to Waijung 2.
3. run install_waijung2.m to install and set path.
4. create a Simulink model, then add Waijung 2 Target Setup block.
5. configure board (flash memory size and COM port)
6. select Embedded Coder app to show C CODE tab.
7. click Build to build application.
To use this blockset, the model should follow the following guideline.
1. Use WiFi Setup block from Waijung 2 blockset to connect with available a WiFi network.
2. Use the output port of WiFi Setup block to trigger the <MQTT connect> block.
3. Put <MQTT subscribe> and <MQTT publish>blocks inside Enabled Subsystem block to be enabled by <MQTT connect> block.
At version 0.1, only MQTT over TCP and WebSocket is supported. Future improvement is to support other secure connections.

Cite As

Supachai Vorapojpisut (2022). MQTT driver for ESP32 target (https://www.mathworks.com/matlabcentral/fileexchange/100571-mqtt-driver-for-esp32-target), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2021b
Compatible with R2019b to R2021a
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!