Clear Filters
Clear Filters

ake a GUI in the App Designer that will display the measurement of indoor temperature and humidity using Raspberry Pi 4 and the obtained data from the DHT22 sensor

9 views (last 30 days)
(Please help ASAP… Our goal is to measure the indoor temperature and humidity using DHT22 sensor and Raspberry Pi 4, and present the data graphs in MATLAB using a GUI built in the App Designer in MATLAB. Fortunately, we think that there is nothing wrong in the sensor and microcontroller, the data was still detected by the RPI.)
1. Make a GUI in the App Designer that will display the measurement of indoor temperature and humidity using Raspberry Pi 4 and the obtained data from the DHT22 sensor, a sample output like in figure 1 and 2 below:
This is the code that we made but we don’t know how to display it on MATLAB:

Answers (1)

Sanjana
Sanjana on 8 Jun 2023
Hi,
I understand that you need help designing a GUI app in MATLAB for displaying the humidity and temperature values generated by DHT11 Sensor connected to Raspberry pi,
At first, please refer to the following link, for interfacing MATLAB with Raspberry pi Hardware,
Then, to run the python script on Raspberry pi, one solution is to write a function in MATLAB, that runs the script using “system” function and returns the humidity and temperature values,
function [humidity, temperature] = DHT11Interface
[humidity, temperature] = system ('Python3 path/to/file').
End
To create GUI applications, App designer in MATLAB can be used,
Please refer to the following link for information on creating GUI apps in MATLAB,
After creating the application, you can call the function defined above and use the returned values to initialize the textboxes in the application.
This is the example code, for using a “button” to display the values inside “Text Area” components,
function ButtonPushed(app, event)
[humidity,temperature] = DHT11Interface();
app.TextArea.Value = humidity;
app.TextArea2.Value = temperature;
end
Hope this helps!

Categories

Find more on MATLAB Support Package for Raspberry Pi Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!