SHT11 digital humidity & temp sensor

Hi guys,

Datasheet here: http://www.sensirion.com/images/getFile?id=25

See my code below. I'm not receiving the ack after transmission of the command. I can't figure out what I am doing wrong!

My code can be seen below.

int vddPin = 11;
int dataPin = 12;
int sckPin = 13;


void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(vddPin, OUTPUT);
  digitalWrite(vddPin, HIGH);
  pinMode(sckPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  // Transmit start condition
  d(sckPin, HIGH);
  d(dataPin, LOW),
  pulseSck();
  d(dataPin, HIGH);  
  // Transmit address (000)
  d(dataPin, LOW);
  pulseSck();
  pulseSck();
  pulseSck();
  // Transmit command (00011, measure temp)
  d(dataPin, LOW);
  pulseSck();
  pulseSck();
  pulseSck();
  d(dataPin, HIGH);
  pulseSck();
  pulseSck();
  // Wait for ack (data pin pulled low by sensor)
  pinMode(dataPin, INPUT);
  while(digitalRead(dataPin) != LOW) {
    delay(10);
  }
  Serial.print("ack");
  pinMode(dataPin, OUTPUT);
  
}

void pulseSck() {
  d(sckPin, LOW);
  delayMicroseconds(1);
  d(sckPin, HIGH);
}

void d(int pin, int level) {
  digitalWrite(pin, level);
}

hi

this can help

Thanks. I'm not the original poster, but I'm in a similar place, and that link looks quite helpful.

Here is mine.

Seems to work... but it's still a little sloppy.

http://www.railsimstuff.com/files/SHT11.pde

Pete

Hello everyone...It has been a long time since someone wrote something on this thread. Anyway, I have a Sensirion SHT-1x from Parallax (the one with the compatible carrier for breadboards etc) and an Arduino Duemilanove. I tried out these two:

http://www.railsimstuff.com/files/SHT11.pde

and some more. I think that both of these should be working but they don't. In the first one I get an ack error 0, that means the sensor doesn't even get a command. Afterwards, I get a ack error 2 and some wrong measurements. I checked the datasheet and everything looks fine to me, it should work.

In the second link, since it doesn't do any error handling, I just get 615 degrees Celsius. Of course any measurement in both the examples doesn't change if I put my finger on the sensor.

Any suggestions? Thanks in advance.

I'm having exactly the same results as described by constanton above.
Would greatly appreciate any assistance as this is really holding me up and I've been bashing my head against the datasheet with no luck for a while now.

I would recommend using the sensirion library: http://www.target23.de/data/Sensirion_20081128.zip I have been using it for about a year. You'll have to make a couple of changes to avoid some conflicts, but after that, it works great. See this thread, which talks about the very simple fix: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1229870415

Thank you for your reply flyboy.
That code worked flawlessly...

... and so did the other code once I realized my +5V was going to the wrong row on my breadboard. :smiley: :smiley: :smiley:
Damn these old eyes. Can I get an upgrade?

It's not my code, just code that I found and then used for myself. Just want to make sure I don't get credit for it. I'm not that good.

@flyboy : I used the library you proposed (and afterwards the new one) and did the changes as described at the link, but unfortunately I still get:

Temperature: 0.0 C, Humidity: 0.0 %, Dewpoint: 0.0 C

A picture[1] of how I assembled Sensirion and Arduino. 4 consecutive cables as described at the datasheet.

Data pin(red) and Sck(black) are on Digital 2 and 3. I use GND(green) and 5V(white)

[1] http://bit.ly/dgjV9y

I don't get it. It has worked for everyone and not for me.

hey constanton, be sure to use the datasheet from parallax and not the sensirion one. the parallax board swaps pins a bit and you need to connect data,clk,gnd on one side and V on the other. good luck.

www.parallax.com/dl/docs/prod/acc/SensirionDocs.pdf

dbye...Yeap that's the kind of difference I was expecting. Glad you pointed that out. Now everything works fine. :slight_smile:

glad to hear it. now how did you do that cool thing to post the image you posted?