Sensirion SHTxx Library Absolute Humidity and Heat Index functions

Can anyone help me to figure out how to get the Absolute Humidity and Heat Index functions values from the Sensirion SHTxx Library found here? Google Code Archive - Long-term storage for Google Code Project Hosting. and also mentioned here? http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1292537089

I've tried using the ReadSHT1xValuesNB example and adding hi = shtxx.read(calcHeatIndex); then serial.println(hi);, but all it reads back is 999.99 (because the hi default read error is set to 999.99).

Any help is greatly appreciated!

Can you post your code you have sofar, maybe we can spot something missing.

Sorry for taking so long to respond, busy with work. here is the code i have so far, basically its the example NB code, i've tried calling the calcHeatIndex function, but all it returns is 0.00.

/**
* ReadSHT1xValuesNB
*
* Read temperature and humidity values from an SHT1x-series (SHT10,
* SHT11, SHT15) sensor in non-blocking mode.
*
* Copyright 2010 Eric C. Gionet <lavco_eg@hotmail.com>
*/

#include <SensirionSHTxx.h>

// Specify data and clock connections and instantiate SHT1x object
#define dataPin 10
#define clockPin 11
//
// instantiate SensirionSHTxx instance
SensirionSHTxx shtxx(dataPin, clockPin);
//
#define SMP_ERR 999.99
//
static float taSmp = SMP_ERR;
static float tdSmp = SMP_ERR;
static float rhSmp = SMP_ERR;
static float calcHeatIndex = SMP_ERR;  //Added this
void processSHTxx()
{
  SHTxxSTATE_SENSOR result;
  
  /*
    STATE CODES (checkSensor):
      Sleeping,     // 0
      Measuring,    // 1
      Completed,    // 2
      WriteError,   // 3
      Timeout       // 4
  */
  
  // poll sensor
  result = shtxx.check(&taSmp, &rhSmp, &tdSmp);
  calcHeatIndex = shtxx.check(&calcHeatIndex);  //Added this
  //
  // validate sensor result code
  if ( result == SHTxxSTATE_COMPLETED ) {
 // Print the values to the serial port
    Serial.print("Air-Temperature: ");
    Serial.print(taSmp);
    Serial.print("C. Dewpoint-Temperature: ");
    Serial.print(tdSmp);
    Serial.print("C. Humidity: ");
    Serial.print(rhSmp);
    Serial.println("%");
    Serial.print("Heat Index: "); //Added this
    Serial.println(calcHeatIndex); //Added this
  } else if ( result == SHTxxSTATE_WRITE_ERROR || result == SHTxxSTATE_TIMEOUT ) {
    taSmp = SMP_ERR;
    tdSmp = SMP_ERR;
    rhSmp = SMP_ERR;
    Serial.println("Sensor Read Error/Timeout");
  }
}

void setup()
{
   Serial.begin(9600); // Open serial connection to report values to host
   Serial.println("Starting up");
   //
   // set shtxx measurement interval (3-sec)
   // and enable non-blocking
   shtxx.begin();
   shtxx.setTimerInterval( 3000 );
   shtxx.enableTimer();
}

void loop()
{
   // process sht measurement
   processSHTxx();
}

Any help is greatly appreciated!

SensirionSHTxx.h (3.62 KB)

SensirionSHTxx.cpp (26.1 KB)

keywords.txt (800 Bytes)

ReadSHTxxValuesNBmine.pde (1.83 KB)

I have used this code and schemas without troubles:
http://www.glacialwanderer.com/hobbyrobotics/?p=5
Good luck!

calcHeatIndex = shtxx.check(&calcHeatIndex);  //Added this

the return value of the function is a _state so I think this line should be something like

state = shtxx.check(&calcHeatIndex); 

if ( result == SHTxxSTATE_COMPLETED  && state == SHTxxSTATE_COMPLETED )  // CHECK BOTH !!!
 {
 // Print the values to the serial port

both readings must be complete to give good values.

Thanks for all the input. i have tried a few things and am getting heat index readings now...

i added this...

static float calcHeatIndex = SMP_ERR;

then this under poll sensor...

calcHeatIndex = shtxx.calcHeatIndex(rhSmp, taSmp);

i also added this to convert everything from C to F...

calcHeatIndex = (calcHeatIndex * 9.0)/ 5.0 + 32.0;
    taSmp = (taSmp * 9.0)/ 5.0 + 32.0;
    tdSmp = (tdSmp * 9.0)/ 5.0 + 32.0;

then this to send the result to the serial monitor...

Serial.print("Heat Index: ");
    Serial.println(calcHeatIndex);

However, the heat index reading i get is off by about -12 degF. according to a heat index calculator found here, Heat Index & Wind Chill Calculator, an air temp of 71.73 a dew point of 57.13 and a humidity of 60.08 should give a heat index of 76.05f. instead i get a heat index reading of 64.33.

i've made sure that the values were in the correct places in the "calcHeatIndex = shtxx.calcHeatIndex(rhSmp, taSmp);", if i switch the rhSmp and taSmp, it jumps up to 122degF.

Any ideas or suggestions?