The SHT11 is a temperature humidity sensor from sensiron.Looking to buy or find the datasheet. Look here.
- 2 factory calibrated sensors for relative humidity & temperature
- Digital 2-wire interface not quite conforming to I2C *&^%&(
- Precise dewpoint calculation possible
- Measurement range: 0-100% RH
- Absolute RH accuracy: +/- 2% RH (10…90% RH)
- Repeatability RH: +/- 0.1% RH
- Temp. accuracy: +/- 0.3°C @ 25°C
- Fast response time < 4 sec.
- Low power consumption (typ. 30 µW)
- Low cost
- High precision sensor at low cost
- Leading CMOSens Technology for superior long-term stability
The SHT11 is well documented and has a library on the arduino playground. I use the 10th december 2010 version.
This has CRC checking and is non blocking so that the processor can do other things.
I used the SMD part of an arduino expansion shield to mount the device and wired it to pins 2 and 3 of the adruino.
Here is the software from the arduino site.
I have updated it to compile with the arduino version 1.0. That is here.
Finally a screendump of the program executing whilst putting finger on the SHT11 chip.
This is the non blocking version. It demonstrates by blinking the LED on PIN13 that it can do other things also.
[spoiler]
/* * Example code for SHT1x eg SHT15 or SHT7x sensors demonstrating blocking calls * for temperature and humidity measurement in the setup routine and * non-blocking calls in the main loop. The pin 13 LED is flashed as a * background task while temperature and humidity measurements are made. * Note that the status register read/write demonstration code places the * sensor in low resolution mode. Delete it to stay in high res mode. * * This example contains two versions of the SHT15 code: one that checks library * function return codes for error indications and one that does not. * The version with error checking may be useful in debuging possible * connection issues with the sensor. A #define selects between versions. */ #include <Sensirion.h> #define ENA_ERRCHK // Enable error checking code const byte dataPin = 2; // SHT11 serial data const byte sclkPin = 3; // SHT11 serial clock const byte ledPin = 13; // Arduino built-in LED const unsigned long TRHSTEP = 5000UL; // Sensor query period const unsigned long BLINKSTEP = 250UL; // LED blink period Sensirion sht = Sensirion(dataPin, sclkPin); unsigned int rawData; float temperature; float humidity; float dewpoint; byte ledState = 0; byte measActive = false; byte measType = TEMP; unsigned long trhMillis = 0; // Time interval tracking unsigned long blinkMillis = 0; #ifdef ENA_ERRCHK // This version of the code checks return codes for errors byte error = 0; void setup() { byte stat; Serial.begin(9600); pinMode(ledPin, OUTPUT); delay(15); // Wait >= 11 ms before first cmd // Demonstrate status register read/write if (error = sht.readSR(&stat)) // Read sensor status register logError(error); Serial.print("Status reg = 0x"); Serial.println(stat, HEX); if (error = sht.writeSR(LOW_RES)) // Set sensor to low resolution logError(error); if (error = sht.readSR(&stat)) // Read sensor status register again logError(error); Serial.print("Status reg = 0x"); Serial.println(stat, HEX); // Demonstrate blocking calls if (error = sht.measTemp(&rawData)) // sht.meas(TEMP, &rawData, BLOCK) logError(error); temperature = sht.calcTemp(rawData); if (error = sht.measHumi(&rawData)) // sht.meas(HUMI, &rawData, BLOCK) logError(error); humidity = sht.calcHumi(rawData, temperature); dewpoint = sht.calcDewpoint(humidity, temperature); logData(); } void loop() { unsigned long curMillis = millis(); // Get current time // Rapidly blink LED. Blocking calls take too long to allow this. if (curMillis - blinkMillis >= BLINKSTEP) { // Time to toggle the LED state? ledState ^= 1; digitalWrite(ledPin, ledState); blinkMillis = curMillis; } // Demonstrate non-blocking calls if (curMillis - trhMillis >= TRHSTEP) { // Time for new measurements? measActive = true; measType = TEMP; if (error = sht.meas(TEMP, &rawData, NONBLOCK)) // Start temp measurement logError(error); trhMillis = curMillis; } if (measActive && (error = sht.measRdy())) { // Check measurement status if (error != S_Meas_Rdy) logError(error); if (measType == TEMP) { // Process temp or humi? measType = HUMI; temperature = sht.calcTemp(rawData); // Convert raw sensor data if (error = sht.meas(HUMI, &rawData, NONBLOCK)) // Start humi measurement logError(error); } else { measActive = false; humidity = sht.calcHumi(rawData, temperature); // Convert raw sensor data dewpoint = sht.calcDewpoint(humidity, temperature); logData(); } } } #else // If ENA_ERRCHK is not defined // This code is the same as above but without error checking void setup() { byte stat; byte error = 0; Serial.begin(9600); pinMode(ledPin, OUTPUT); delay(15); // Wait >= 11 ms before first cmd // Demonstrate status register read/write sht.readSR(&stat); // Read sensor status register Serial.print("Status reg = 0x"); Serial.println(stat, HEX); sht.writeSR(LOW_RES); // Set sensor to low resolution sht.readSR(&stat); // Read sensor status register again Serial.print("Status reg = 0x"); Serial.println(stat, HEX); // Demonstrate blocking calls sht.measTemp(&rawData); // sht.meas(TEMP, &rawData, BLOCK) temperature = sht.calcTemp(rawData); sht.measHumi(&rawData); // sht.meas(HUMI, &rawData, BLOCK) humidity = sht.calcHumi(rawData, temperature); dewpoint = sht.calcDewpoint(humidity, temperature); logData(); } void loop() { unsigned long curMillis = millis(); // Get current time // Rapidly blink LED. Blocking calls take too long to allow this. if (curMillis - blinkMillis >= BLINKSTEP) { // Time to toggle the LED state? ledState ^= 1; digitalWrite(ledPin, ledState); blinkMillis = curMillis; } // Demonstrate non-blocking calls if (curMillis - trhMillis >= TRHSTEP) { // Time for new measurements? measActive = true; measType = TEMP; sht.meas(TEMP, &rawData, NONBLOCK); // Start temp measurement trhMillis = curMillis; } if (measActive && sht.measRdy()) { // Check measurement status if (measType == TEMP) { // Process temp or humi? measType = HUMI; temperature = sht.calcTemp(rawData); // Convert raw sensor data sht.meas(HUMI, &rawData, NONBLOCK); // Start humi measurement } else { measActive = false; humidity = sht.calcHumi(rawData, temperature); // Convert raw sensor data dewpoint = sht.calcDewpoint(humidity, temperature); logData(); } } } #endif // End of non-error-checking example void logData() { Serial.print("Temperature = "); Serial.print(temperature); Serial.print(" C, Humidity = "); Serial.print(humidity); Serial.print(" %, Dewpoint = "); Serial.print(dewpoint); Serial.println(" C"); } // The following code is only used with error checking enabled void logError(byte error) { switch (error) { case S_Err_NoACK: Serial.println("Error: No response (ACK) received from sensor!"); break; case S_Err_CRC: Serial.println("Error: CRC mismatch!"); break; case S_Err_TO: Serial.println("Error: Measurement timeout!"); break; default: Serial.println("Unknown error received!"); break; } }
[/spoiler]
SHT15 images
SHT11 pinout SHT11 closeup SHT11 breakout board