Current version of Sensirion’s SHT1x chips is V4, which comes with different coefficient for calculation of temperature and relative humidity. Coefficients which are used in your example are probably for V3 sensors which are not soled anymore. SHT1x V3 and V4 sensors can be differentiated by code mark; V3 sensors are marked by three digit numeric code, while V4 sensors are marked by three digit alphanumeric code.
Code: Select all
// SHT1x V4 humidity conversion coefficients (12 bits)
const unsigned int C1 = 205; // -2.0468
const unsigned int C2 = 367; // 0.0367 (367 * 10^-4)
const unsigned short C3 = 16; // -1.5955* 10^-6 (15.955 * 10^-7)
// SHT1x V4 temperature compensation coefficients (12 bits)
const unsigned int T1 = 1000; // 0.01 (1*10^-2)
const unsigned int T2 = 8; // 0.00008 (8 * 10^-5)
// SHT1x V4 temperature conversion coefficients (14 bits)
const unsigned int D1 = 4010; // -40.1
const unsigned short D2 = 1; // 0.01
// Original coefficients, probably for SHT V3 sensors
// const unsigned int C1 = 400; // -4
// const unsigned int C2 = 405; // 0.0405 (405 * 10^-4)
// const unsigned short C3 = 28; // -2.8 * 10^-6 (28 * 10^-7)
// const unsigned int D1 = 4000; // -40
// const unsigned short D2 = 1; // 0.01
Code: Select all
// Temperature compensation
// RHtrue=(T-25)*(T1+T2*SOrh)+RHlin
temp=(T1+(T2*SOrh))/1000;
temp=((Ta_res-2500)*temp)/100;
Rh_res=temp+Rh_res;
Code: Select all
SCL_Direction = 0; // define SCL as output
// Measuring temperature
SOt = Measure(0x03); // function for measuring (command 0x03 is for temperature)
// Measuring humidity
SOrh = Measure(0x05); // function for measuring (command 0x05 is for humidity)
SCL_Direction = 1; // define SCL as input
Code: Select all
// Calculating temperature
// Ta_res = D1 + D2 * SOt
Ta_res = SOt * D2 - D1; // calculate temperature
Code: Select all
// Display minus sign on LCD if temperature is negative
if (Ta_res < 0)
Ta[4] = '-';
Best regards,
Uroš Pešović, teaching assistant
Computer Science Laboratory
Technical Faculty Čačak
Serbia