Libelium is offering new technical support channels, to contact with de Technical Support team to solve any issue our doubt please contact with your sales agent or visit our contact site



Post a new topicPost a reply Page 1 of 2   [ 15 posts ]
Go to page 1, 2  Next
Author Message
 Post subject: Calibration of gas sensors
PostPosted: Fri Feb 24, 2017 9:15 pm 

Joined: Fri Feb 24, 2017 9:01 pm
Posts: 14
Hi,
I have bought some gas sensors and tried to calibrate them also for the effect of temperature and humidity. I end up with an expression for resistances R:

log10(R(temp,hum,conc)/R(temp,hum,conc0))

where conc0 is the calibration concentration in ppm at temperature temp0 and humidity hum0.
Now my question: Is the above expression in the same way linearly related to log10(conc) as is

log10(R(temp0,hum0,conc)/R(temp0,hum0,conc0)),

whose linear curve is given in most of the sensor data-sheets?


Top
 Profile  
 
 Post subject: Re: Calibration of gas sensors
PostPosted: Mon Feb 27, 2017 8:37 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hi gusp,

Can you share with us the link of the product that you are talking about and tell us the platform that you are using?

Thanks.

Regards


Top
 Profile  
 
 Post subject: Re: Calibration of gas sensors
PostPosted: Mon Feb 27, 2017 2:01 pm 

Joined: Fri Feb 24, 2017 9:01 pm
Posts: 14
Hi,

I use arduino and the mq135 hazardous gas sensor.
http://www.datasheetspdf.com/PDF/MQ-135/605076/2

Kind regards,
gusp


Top
 Profile  
 
 Post subject: Re: Calibration of gas sensors
PostPosted: Mon Feb 27, 2017 2:17 pm 

Joined: Fri Feb 24, 2017 9:01 pm
Posts: 14
Hi,

for temperature and humidity I use the htu21d-sensor.
https://www.amazon.de/gp/product/B01NBH ... UTF8&psc=1
Besides the mq135 I use 8 other sensors from the mq-family and the MiCS5524 and MiCs2714 from Libelium. The last two sensors have no data sheet with temp-hum dependence. If there is one, I would like to get.

Regards


Top
 Profile  
 
 Post subject: Re: Calibration of gas sensors
PostPosted: Mon Feb 27, 2017 2:59 pm 

Joined: Fri Feb 24, 2017 9:01 pm
Posts: 14
Dear libelium members,

I ask yo to post also my second post. Because, there I give some more information.

Regards


Top
 Profile  
 
 Post subject: Re: Calibration of gas sensors
PostPosted: Mon Feb 27, 2017 6:06 pm 

Joined: Fri Feb 24, 2017 9:01 pm
Posts: 14
Hi,

I want to share my code for temperature-humidity calibration of gas-sensors with you.
Here is the code for the calculation of the quotient of resistances
log10(R(temp,hum,conc)/R(temp,hum,conc0)):
R(temp,hum,conc)/Ro is measured by the sensor. R(temp,hum,conc0) is calculated by the calibration-algorithm.

float quotRtemphumcRtemphumco(float quotRtemphumcRo, float temp, float temp0, float hum, float hum0, float hum1, float hum2, float R0, float R1, float a01, float a11, float a21, float a31, float a02, float a12, float a22, float a32){
float alpha;
float quotRtemphumcR1;
float quotRtemphum1c1R1;
float quotRtempohumoc1R1;
float quotRtempohum1c1R1;
float quotRtemphumc1R1;
float quotRtempohumocoR1;
float quottemphumcoR1;
float quotRtemphumcoR1;
float quottemp1hum1c1R1;
float quottempohumoc1R1;
float quot;

quotRtemphumcR1 = quotRtemphumcRo*(R0/R1);
quotRtemphum1c1R1 = quotR_R1(temp, a01, a11, a21, a31);
quotRtempohumocoR1 = R0/R1;
quotRtempohum1c1R1 = quotR_R1(temp0, a01, a11, a21, a31);
alpha = quotR_R1(temp0, a02, a12, a22, a32)/quotR_R1(temp0, a01, a11, a21, a31)-1;
quotRtempohumoc1R1 = ((hum0-hum1)/(hum2-hum1))*alpha*quotRtempohum1c1R1+quotRtempohum1c1R1; //// assumption checked
alpha = quotR_R1(temp, a02, a12, a22, a32)/quotR_R1(temp, a01, a11, a21, a31)-1;
quotRtemphumc1R1 = ((hum-hum1)/(hum2-hum1))*alpha*quotRtemphum1c1R1+quotRtemphum1c1R1; //// assumption checked
quotRtemphumcoR1 = (quotRtempohumocoR1/quotRtempohumoc1R1)*quotRtemphumc1R1; // correct for c1==c0
quot = quotRtemphumcR1/quotRtemphumcoR1;

return(quot);
}

float quotR_R1(float temp, float a0, float a1, float a2, float a3){ //the fits to the 2 temperature-humidity-Rs/R1 curves from the data-sheet
float quot;
quot=a0+a1*temp+a2*exp(a3*temp);
return(quot);
}


I have also tried to calculate
log10(R(temp0,hum0,conc)/R(temp0,hum0,conc0)), but I was not able to do so. The calculation of this quotient would make the question in my first post irrelevant.

Regard,
gusp


Top
 Profile  
 
 Post subject: Re: Calibration of gas sensors
PostPosted: Mon Feb 27, 2017 9:11 pm 

Joined: Fri Feb 24, 2017 9:01 pm
Posts: 14
Hi,

for the mq135 hazardous gases sensor the parameters of the function are given as follows:


QuotHG_without = ((1023.0 / rawsensorValueHG) - 1.0) / RoHG; //=quotRtemphumcRo
temp //=reading from temperature sensor
tempHGin0 =20; // from data-sheet
hum //=reading from humidity sensor
humHGin0=65;// from data-sheet
humHGin1=33; from data-sheet
humHGin2=85;//from data-sheet
RoHG = (1023.0 / HGin0) - 1.0; // Ro, situation 0, HGin0 to be determined by analog calibration,
// you read out the raw data value from the sensor for
// situation 0 specified in the data-sheet.
R1HG = (1023.0 / HGin1) - 1.0; // R1 situation 1, HGin1 to be determined by analog calibration
a0HGQoutRR1_1 = 0.173248; // all coefficients determined with R-stats-software in such a way
a1HGQoutRR1_1 =0.009743; //that the two temp-humidity Rs/R1 curves from the data-sheet
a2HGQoutRR1_1 =1.196836; //are fitted.
a3HGQoutRR1_1 =-0.030739;
a0HGQoutRR1_2 = 0.303227;
a1HGQoutRR1_2 = 0.006385;
a2HGQoutRR1_2 = 0.935561;
a3HGQoutRR1_2 = -0.032368;

Regards,
gusp


Top
 Profile  
 
 Post subject: Re: Calibration of gas sensors
PostPosted: Mon Feb 27, 2017 9:22 pm 

Joined: Fri Feb 24, 2017 9:01 pm
Posts: 14
Hi,

for fitting the two temp-humidity Rs/R1 curves from the data-sheet I haved used R-statistical software (CRAN).
I have selected 8 points from each curve in the data-sheet and used the R-library nlreg to calculate the fit and the coefficients a01,...,a31, a02,...,a32.

Regards,
gusp


Top
 Profile  
 
 Post subject: Re: Calibration of gas sensors
PostPosted: Mon Feb 27, 2017 9:35 pm 

Joined: Fri Feb 24, 2017 9:01 pm
Posts: 14
Hi,
here is the R-code for the fit of the temp-hum-Rs/R1 relationship.

%calibration done with R: temperature-humidity-R/R1 curves

library("nlreg")
XHG1<-matrix(c(-10,1.7,5,1.275,10,1.13,20,1,30,0.95,40,0.925,50,0.91),ncol=2,nrow=7,byrow=TRUE)
XHG2<-matrix(c(-10,1.53,5,1.15,10,1.03,20,0.91,30,0.85,40,0.83,50,0.8),ncol=2,nrow=7,byrow=TRUE)
dimnames(XHG1)[[2]]<-c("temp","quot")
dimnames(XHG2)[[2]]<-c("temp","quot")
XHG1<-data.frame(XHG1)
XHG2<-data.frame(XHG2)
plot(XHG1[,1],XHG1[,2])
nlregXHG1<-nlreg(quot~a0+a1*temp+a2*exp(a3*temp),start=c(a0=0.8,a1=0,a2=0.3551, a3=-0.05),data=XHG1) ////
summary(nlregXHG1)
a0 = 0.173248
a1 = 0.009743
a2 = 1.196836
a3 = -0.030739 #
y<-seq(-10,50,by=1)
plot(XHG1[,1],XHG1[,2])
lines(y,a0+a1*y+a2*exp(a3*y))
nlregXHG2<-nlreg(quot~a0+a1*temp+a2*exp(a3*temp),start=c(a0=0.8,a1=0,a2=0.3551, a3=-0.05),data=XHG2) ////
summary(nlregXHG2)
a0 = 0.303227
a1 = 0.006385
a2 = 0.935561
a3= -0.032368 #
plot(XHG2[,1],XHG2[,2])
lines(y,a0+a1*y+a2*exp(a3*y))

Regards,
gusp


Top
 Profile  
 
 Post subject: Re: Calibration of gas sensors
PostPosted: Tue Feb 28, 2017 7:31 am 

Joined: Fri Feb 24, 2017 9:01 pm
Posts: 14
Hi,

if the assumption of my first post were not true, the mq135 data-sheet and all other data-sheets would be incomplete. There would be missing at least one more
log10(R(temp3, hum3,c)/R(temp3,hum3,co)) to log10(c) linear relationship in the data-sheet.

Regards,
gusp


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 2   [ 15 posts ]
Go to page 1, 2  Next


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use.