How can i read real-time data from dht11 sensors connected to ESP32 into Simulink

13 views (last 30 days)
I have connected dht11 sensors to ESP32 and have been trying to figure out how to read and visualize the real-time data on simulink. I kindly need help on how to resolve this. I can read the data in Arduino IDE serial monitor on real time but want to also read them in Simulink for my work.
  1 Comment
Cris LaPierre
Cris LaPierre on 4 May 2025
Posted in a separate question:
"I had installed simulink support package to my Matlab Simulink, and confirmed that there is connection to the esp32 by blinking the onboard LED. The challenge is the right block and the configuration to enable visualization on real time in Simulink. Kindly assist"

Sign in to comment.

Accepted Answer

Aravind
Aravind on 13 May 2025
Hi @Nonso,
To read live data from the sensors and ESP32 in Simulink, you can use the "IO Device Builder" app, which is part of the Simulink Support Package for Arduino. This app allows you to incorporate Arduino's C++ libraries into MATLAB System objects, which can then be used to create a Simulink block. You can find more information about this app in the following documentation: https://www.mathworks.com/help/simulink/io-device-builder-arduino.html.
Using the "IO Device Builder," you can create a block that incorporates the DHT11 sensor’s Arduino libraries to read the desired values. Once you have done this, you can run the Simulink model to obtain readings from the DHT11 sensor connected to the ESP32 into Simulink. Additionally, you can use code generation to deploy the model onto the ESP32.
Here are some resources to help you get started with the "IO Device Builder" app:
  1. Getting started with the "IO Device Builder" app: https://www.mathworks.com/help/simulink/supportpkg/arduino_ug/io-device-builder.html
  2. Example of implementing the DHT11 sensor: https://www.mathworks.com/help/simulink/supportpkg/arduino_ref/dht11-relative-humidity-temperature-io-device-builder.html
I hope this answers your question.
  1 Comment
Nonso
Nonso on 15 May 2025
Edited: Nonso on 15 May 2025
Thank you for your response. I shall implement it as recommended. Your effort is highly appreciated.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!