Error from Volumetric Flowrate using Pressure Sensor & Arduino

9 ビュー (過去 30 日間)
Andrew Gallagher
Andrew Gallagher 2020 年 10 月 24 日
編集済み: Andrew Gallagher 2020 年 10 月 24 日
TLDR; Arduino Sensor output calculation is roughly 10x smaller than expected.
Hi, I have created a volumetric flow rate from the MPX5010dp Pressure sensor (data sheet here: https://www.nxp.com/docs/en/data-sheet/MPX5010.pdf), Measuring pressure across a change in diameter tube, pictured below. I then convert the pressure into volumetric flow rate and measure this over 10 seconds.
1st: The volumetric rate output seems to be 10x too small, at peak output I would expect 2-4 L/s. And this carries into total volume exhaled which I suspect is 10x too small also. Normal Male Human Lungs are between 4 - 6 Liters I think.
2nd: Has anyone any pointers on how I would get the Area under the curve for the first second after exhalation has started i.e. as soon as the Volumetric flow rate is increasing. Not just on this example but in general.
Thank you very much
ii = 0;
q = zeros(1,1);
t = zeros(1,1);
tic
while toc < 10
ii = ii + 1;
v = readVoltage(a,'A0'); % Read voltage from sensor
if v < 0.22, v = 0; % This is the 0 pressure outpur of sensor
end
v = v - 0.21; % Subtracting 0 pressure output from voltage output
p = (v/5)/0.09 - 0.04; % Converting to Kpa as per data sheet
if p < 0, p = 0; %Zeroing pressure if there is none and not letting it be a negative
end
p = p * 1000; % Converting Kpa to pa
a1 = 0.000415476; % Cross sectional Area of the first part of the Tube
a2 = 0.000028274; % Cross sectional Area of the second part of the Tube
r = 1.225; %Density of air
c = a1/a2; % Ratio of Areas
c= c*c; %Squaring Ratio of Areas
vf = a1 * sqrt( (2/r) * p/((c -1) )); %Calculating Volumetric flow rate in M^3/s
q(ii) = vf * 1000; %converting to Liters/s
t(ii) = toc;
end
q = q(1:ii);
t = t(1:ii);
Ar = trapz(t,q); %Calculating area under curve = total volume exhaled
figure %Plotting curve and graph
plot(t,q,'-o')
xlabel('Elapsed time(sec)')
ylabel('Volume Flow Rate (L/s)')
set(gca,'xlim',[t(1) t(ii)])
hold on
ha1 = area(t(t>0), q(t>0), 'FaceColor', 'g' )
Arstr = sprintf('Forced Volume = %0.5f Liters', Ar)
legend([ha1], Arstr)

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by