Hi All,
I have a ultra low differential pressure sensor in a flow meter configuration(Venturi meter). https://www.te.com/commerce/Documen...pdfEnglishENG_DS_SM9000_A1.pdfCAT-BLPS0062
Through help from the members on this forum I was able to get rid of the zero error and then after that the sensor was reading perfectly and when I applied a moving average filter I was able to consistent results. I am pushing a calibrated 3 liters of air through the flow meter as seen in the pictures below.
Now the problem: I will push the air through and it will be accurate 3.0L +/- 5% for maybe 20 readings. and then something will happen (not physically, everything is the same setup). But suddenly it will start showing 3.5 -3.8 L for a few readings and then will change and go back to 3L. Does anyone have any idea what could be happening here? This is a supposedly high quality sensor so I would not expect this inconsistency, could it be broken?
I am recording the data as averaged moving filter and also not averaged, sometimes the averaged data is closer to the 3L and then it will switch.
How I am recording the data:
Sensor attached to arduino > into matlab > matlab records 500 data points from the sensor > first and last 50 are used to calculate the zero error( I push the syringe inbetween these values) > those counts from the sensor are turned into pressure differentials across the venturi meter > Volumetric flow rate in L/s is calculated for each of these points> Integrate over these 500 values to get the area under the curve i.e. the total volume that has passed through the venturi meter.
Code attached
I have a ultra low differential pressure sensor in a flow meter configuration(Venturi meter). https://www.te.com/commerce/Documen...pdfEnglishENG_DS_SM9000_A1.pdfCAT-BLPS0062
Through help from the members on this forum I was able to get rid of the zero error and then after that the sensor was reading perfectly and when I applied a moving average filter I was able to consistent results. I am pushing a calibrated 3 liters of air through the flow meter as seen in the pictures below.
Now the problem: I will push the air through and it will be accurate 3.0L +/- 5% for maybe 20 readings. and then something will happen (not physically, everything is the same setup). But suddenly it will start showing 3.5 -3.8 L for a few readings and then will change and go back to 3L. Does anyone have any idea what could be happening here? This is a supposedly high quality sensor so I would not expect this inconsistency, could it be broken?
I am recording the data as averaged moving filter and also not averaged, sometimes the averaged data is closer to the 3L and then it will switch.
How I am recording the data:
Sensor attached to arduino > into matlab > matlab records 500 data points from the sensor > first and last 50 are used to calculate the zero error( I push the syringe inbetween these values) > those counts from the sensor are turned into pressure differentials across the venturi meter > Volumetric flow rate in L/s is calculated for each of these points> Integrate over these 500 values to get the area under the curve i.e. the total volume that has passed through the venturi meter.
Code attached
Code:
clear a dev;
a = arduino();
%%Read from the pressure sensor
clear global;
clear dev counts Erroradjustedcounts p countserr1 countserr2 countserrtot;
i = 0;
data_length = 500;
dev = device(a,'I2CAddress',"0x6C");
x = readRegister(dev,48,2);
F0 = x(1);
F1 = x(2);
C = bitshift(F1,8);
readings = F0 + C;
while i < data_length
i = i + 1;
% Calling the sensor reading
x = readRegister(dev,48,2);
F0 = x(1);
F1 = x(2);
C = bitshift(F1,8);
readings = F0 + C;
count = readings;
counts(i,:) = [i count];
end
Erroradjustedcounts = zeros( i, 2);
outread = zeros(i,2);
p = zeros(i,2);
v = zeros(100, 2);
g = zeros(100, 2);
vf = zeros(i,2);
vfr = zeros(i,2);
i = 0;
for i=1:50 %Calculate zero error over first 50 values
if counts(i,2) < 200
v(i,:) = [i counts(i,2)];
end
end
countserr1 = mode(v(1:50,2)); %Average of the values under 100 in the first 100 hundred values
for i=450:500 %Calculate zero error over last 100 values
if counts(i,2) < 200
g(i,:) = [i counts(i,2)];
end
end
countserr2 = mode(g(450:500,2)); %Average of the values under 100 in the last 100
countserrtot = (countserr1 + countserr2)/2;
for i=1:500
Erroradjustedcounts(i,:) = [i counts(i,2)-countserrtot];
pmin = -250;
outread(i,:) = [i (Erroradjustedcounts(i,2)-(-26215))/(26214-(-26215))];
pmaxpmin = 500;
p(i,:) = [i (pmin+(outread(i,2)*pmaxpmin))]; % Pressure in Pa
if p(i,2) < 0.01
p(i,2) = 0;
end
end
% for i=1:100;
% leftover = sum(Erroradjustedcounts(i,2));% This is ranging from -300 to + 300, this could be the reason of our error
% end
% % % calculating p
% leftovers = 2*sum(leftover);
%
% %Calculating pressure for leftover error
% pmin = -250;
% outreadleftover = ((leftovers)-(-26215))/(26214-(-26215)) ;
% pmaxpmin = 500;
% pleftover = ((pmin+(outreadleftover*pmaxpmin)));
% pleftover = abs(pleftover);
% lvfr = (cd*(a1*sqrt((2*pleftover/(r*((c^2)-1))))));
% lvfr = lvfr*1000;
% %Calculating Volumetric Flow Rate
%
%
for i=1:500
a1=0.00031415927; % Cross sectional Area of the first part of the Tube
a2=0.00023560563; % Cross sectional Area of the second part of the Tube
r=1.225; %Density of air
c=a1/a2; % Ratio of Areas
cd = 0.98; % discharge coefficient
vf(i,:) = [i (cd*(a1*sqrt((2*p(i,2)/(r*((c^2)-1))))))]; %Calculating Volumetric flow rate in M^3/s
vfr(i,:) = [i vf(i,2)*1000];
windowSize = 25;
b = (1/windowSize)*ones(1,windowSize);
a = 1.2;
filvfr = filter(b,a,vfr(:,2));
end
plot(Erroradjustedcounts(:,2));
plot(p(:,2));
plot(filvfr);
plot(vfr(:,2));
Ar = trapz(0.01,vfr(:,2));
Ar2 = trapz(0.01,filvfr) ; %% minus the zero error left over
Attachments
-
2.3 MB Views: 18
-
1.2 MB Views: 18