필터 지우기
필터 지우기

How make a GUI using App designer to visualize pressure sensor data

조회 수: 26 (최근 30일)
Anoop Kumar Sinha
Anoop Kumar Sinha 2022년 3월 1일
댓글: Image Analyst 2023년 10월 9일
Hi, I have a pressure sensor matrix with 16 columns and 10 rows. And I am using the circuit with multiplexer and Arduino to get the data. The example code and circuit diagram is exactly the same as shown in this link: https://www.sensitronics.com/tutorials/fsr-matrix-array/ When I am using Arduino I am able to see the individual elements of the array changing with increasing and decreasing pressure at multiple points. This is good. However, now I want to make a pressure map of this sensor in MATLAB GUI or App designer. Does anyone have any idea how to go about it? Or any code to visualize the pressure map in real time? Thanks in advance.
  댓글 수: 1
gdz
gdz 2022년 10월 23일
Did you solve it eventually? I am working on the same problem as well.

댓글을 달려면 로그인하십시오.

답변 (1개)

Amish
Amish 2023년 10월 9일
Hi Anoop,
I understand that you want to plot the data that is getting generated from the Arduino’s pressure sensor. Creating a pressure map in MATLAB App Designer for your pressure sensor matrix would be a way to visualize the data in real-time.
The following workflow define the generic steps for doing the same:
  1. Having a proper hardware setup to read sensor data into MATLAB. (Since you state that you already can acquire the data, I assume you already have this done)
  2. Create your GUI using App Designer in MATLAB. Open MATLAB and type appdesigner in the command window to start designing your interface.
  3. Design a suitable layout that includes a visualization area for the pressure map. You can use axes or a heatmap to display the map.
  4. Create a timer in the App designer or use a loop to continuously acquire the data from the sensor.
  5. Convert the data into a heatmap and update in real-time as new data is acquired.
Here is a boiler-plate code that might help you further:
classdef PressureMapApp < matlab.apps.AppBase
properties (Access = private)
% Properties for storing sensor data and handle to heatmap
pressureData
heatmapHandle
end
methods (Access = private)
% Function to update the pressure map
function updatePressureMap(app)
% Read sensor data from Arduino (you should replace this with your data acquisition code)
sensorData = readSensorData();
% Update the pressureData array with the new sensor data
app.pressureData = sensorData;
% Update the heatmap
updateHeatmap(app.heatmapHandle, app.pressureData);
end
% Function to initialize the app
function createComponents(app)
% Create UI components here (axes, heatmap, buttons, etc.)
app.heatmapHandle = heatmap(app.UIAxes, app.pressureData);
end
% Function to set up the timer for real-time updates
function setupTimer(app)
timerObj = timer('ExecutionMode', 'fixedRate', 'Period', 1); % Update every 1 second
timerObj.TimerFcn = @(~, ~) updatePressureMap(app);
start(timerObj);
end
end
methods (Access = public)
% Constructor
function app = PressureMapApp
% Create and configure the app
createComponents(app);
setupTimer(app);
end
end
% App creation and deletion
methods (Access = public)
% Code that executes after component creation
function startupFcn(app)
% Initialize pressureData with zeros or any initial values
app.pressureData = zeros(10, 16);
end
end
end
Hope this helps!
  댓글 수: 1
Image Analyst
Image Analyst 2023년 10월 9일
OK but you're supposed to give attribution to the chatbot that you used to create that answer.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by