Hi,
I want to share my code for temperaturehumidity calibration of gassensors 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 calibrationalgorithm.
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 = ((hum0hum1)/(hum2hum1))*alpha*quotRtempohum1c1R1+quotRtempohum1c1R1; //// assumption checked alpha = quotR_R1(temp, a02, a12, a22, a32)/quotR_R1(temp, a01, a11, a21, a31)1; quotRtemphumc1R1 = ((humhum1)/(hum2hum1))*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 temperaturehumidityRs/R1 curves from the datasheet 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
