SHTxx Application Note Non-Linearity Compensation >
2.1 Linear
The most basic conversion formula from sensor output to %RH is: >
SOc c RH RH21simple with c >
1 = 0.5; c >
2 = 0.5 >
2.2 2* linear
For improved accuracy with minimal calculation complexity the following calculation is recommended: RH >
real = (a*SO + b) / 256 Where SO denotes the 8 bit
humidity sensor manufacturers output signal. Validity a b SO 107 143 -512 108 SO 255 111 2893 With the above values the calculation can be done with a single 8 bit multiplication followed by a 16bit addition / subtraction.For a 16 bit SO, RH >
real = (a’*SO’ + b’) / 4096, where SO' denotes the 12bit sensor output signal and a' = a, b'= b*16. The validity limits also have to be multiplied by 16. Sample Code 8 bit SO : >
u16 result; // 16Bit unsigned for the result u08 sensor_out; // 8Bit unsigned for the sensoroutput sensor_out = readSensor8(); // read 8 bit humidity value from SHTxx If ( sensor_out <= 107 ) { result = mult8Bit( 143, sensor_out ); // result = a * sensor_out result < 512 ? result = 512; // check for underflow result = result – 512 // result = result + b }else
{ result = mult8Bit( 111, sensor_out ); // result = a * sensor_out result = result + 2893 // result = result + b result > 25600 ? result = 25600; // check for overflow (optional) }//8 MSB’s are 0-100%RH integers, 8 LSB’s are remainder result = result >> 8 // result = result / 256 2.3 Polynomial 2
nd order
Please consult the SHT1x/ SHT7x datasheet for formula and coefficients. >
www.sensirion.comRev. 1.4 2/3