This example ESP32 will be used to connect to WiFi, read data from DHT11 and send the data to MQTT Broker.
What is covered:
- Integration between Arduino and Stateflow;
- Use of build-in Arduino Libraries in Simulink.
- MATLAB Version 9.13 (R022b)
- Simulink R2022b 10.6 (R022b)
- MATLAB Support Package for Arduino Hardware (version 22.2.2)
- Simulink Support Package for Arduino Hardware (version 22.2.4)
Maybe work with newer versions.
- x1 - ESP32
- x1 - DHT11
- main.slx: Model with the main model/logic of the example.
- DHT11_Handler: This block reads DHT11 sensor and send false if any error is found.
- WiFi_Handler: This block connect to wifi and send true when wifi is connected.
- Serial_CommunicationHandler: This block start and send signal true when serial communication is ok.
- MQTTHandler: Handle MQTT messages (send and recieve).
- Check How to Use Section and make all initial config.
- Open main.slx.
- Change ssid and password to connect to WiFi.
- Check MQTTHandler block to config your MQTT.
- Hardware > Build, Deploy & Start.