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

조회 수: 5 (최근 30일)
(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:

답변 (1개)

Sanjana
Sanjana 2023년 6월 8일
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!

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for Raspberry Pi Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by