edorfaus/TEMPered — Issue #1: How can we add support for humidity on TemperHUM
Author: lgpzcwee
Created: 2011-12-06 15:27:28+00:00
State: open

Termpered works well with 0c45:7402 Microdia which is a temperhum device showing temperature only.

iManufacturer 1 RDing - iProduct 2 TEMPer2HumiV1.0)

I would like to add support for humidity in the temperhum device to termpered.

Code for other similar devices have sums like:

/* Numerical constants below come from the Sensirion SHT1x
datasheet (Table 9 for temperature and Table 6 for humidity */
temperature = (buf[1] & 0xFF) + (buf[0] << 8);
*tempC = -39.7 + .01*temperature;

rh = (buf[3] & 0xFF) + ((buf[2] & 0xFF) << 8);
temp_hum = -2.0468 + 0.0367*rh - 1.5955e-6*rh*rh;
*relhum = (*tempC-25)*(.01 + .00008 * rh) + temp_hum;

// another codebase says

double C1, C2, C3;
double T1, T2;
double rh, rh_lin, rh_true;

if (low_resolution) {
C1 = -2.0468;
C2 = 0.5872;
C3 = -4.0845E-04;
T1 = 0.01;
T2 = 0.00128;
} else {
C1 = -2.0468;
C2 = 0.0367;
C3 = -1.5955E-06;
T1 = 0.01;
T2 = 0.00008;
}

rh = (resp & 0x0000FFFF);
rh_lin = C1 + (C2 * rh) + (C3 * rh * rh);
rh_true = (readings.temperature_celsius - 25.0) * (T1 + (T2 * rh)) + rh_lin;

if (rh_true > 100.0)
rh_true = 100.0;
if (rh_true < 0.1)
rh_true = 0.1;