SHT75 + Arduino

Hello Everybody!

Today I got my SHT75, I already connected the SHT75 to my Arduino (VDD to 3.3V, GND to GND, DATA to Digital 9, SCK to Digital 8 ) and used this sketch:

#include <Sensirion.h>

const uint8_t dataPin =  9;              // SHT serial data
const uint8_t sclkPin =  8;              // SHT serial clock
const uint8_t ledPin  = 13;              // Arduino built-in LED
const uint32_t TRHSTEP   = 5000UL;       // Sensor query period
const uint32_t BLINKSTEP =  250UL;       // LED blink period

Sensirion sht = Sensirion(dataPin, sclkPin);

uint16_t 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;

void setup() {
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);
    delay(15);                           // Wait >= 11 ms before first cmd
    // 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()) {           // Note: no error checking
        if (measType == TEMP) {                  // Process temp or humi?
            measType = HUMI;
            temperature = sht.calcTemp(rawData); // Convert raw sensor data
            sht.meas(HUMI, &rawData, NONBLOCK);  // Start humidity measurement
        }
        else {
            measActive = false;
            humidity = sht.calcHumi(rawData, temperature); // Convert raw sensor data
            dewpoint = sht.calcDewpoint(humidity, temperature);
            logData();
        }
    }
}

void logData() {
    Serial.print("Temperature = ");
    Serial.print(temperature);

    Serial.print(" C, Humidity = ");
    Serial.print(humidity);

    Serial.print(" %, Dewpoint = ");
    Serial.print(dewpoint);
    Serial.println(" C");
}

But I always get the same result:
Temperature = -40.10 C, Humidity = 0.10 %, Dewpoint = -90.17 C

I have tried 5V, tried it with and without Pullup Resistor, nothing changed? Can you help me?

I have the same problem, sorry for my english by google translator (I'm Italian). I have read many topics and I could not fix it. I have an Arduino Nano V3.0 and I have the same problem with the DS18B20. may be going to depend on the function delaymicrosecond? how you can solve the problem? thanks

I solved my problem, I hope you find it useful.
I did not understand the pins to be connected, for me, “datapin = 9” referred to the pin of the board, on the other hand is the digital channel No. 9.
the VCC may be 3.3 or 5, no problem. resistance pool up (10K) between data and VCC.
Follow the attached diagram.
by

thx for sharing the solution, not everybody does that. +1

How to view Wet Bulb with this sensor?

Thanks, I am about to use this SHT75 sesnor, you have saved me hours of frustration