Trouble with Parallax SHT11 Temperature & Humidity

First up I'm new to Arduino, I do however have a good working knowledge of electronics.

I'm using the latest simplesenssirion library. All I have connected is the SHT11, using a pullup resistor, not using the 100nF cap since it's all on the breadboard. I'm getting a constant output to the serial monitor of:

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

It never changes, I have checked and rechecked, there is only 4 pins so it would be hard to wire it incorrectly. Any ideas?

If I use the NonBlocking code, i get a constant:

Temperature = -40.10 C, Humidity = 0.10 %, Dewpoint = -90.17 C

I'm assuming I'm just not reading the sensor at all.

What code are you using?
There are more threads here wrt to your topic e.g.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1179390550

First thing I see is that Parallax suggests a pull down, not a pull up...

Thanks, I've read all of those posts before I posted. It seems to be back and forth with the code, the latest was edited August 4th 2010. So, I've tried all the code examples in those posts and others linked etc. I still cannot get any data from the sensor. All I have connected is ground, to pin 1 of the SHT11, Data via 10K pullup resistor (Parallax datasheet from May 2010 calls for a 10Kohm pullup resistor, not pulldown) to pin 2 on SHT11. VDD of +5vdc from the Arduino. The clk and data pins change in various code so I shift them as needed. I have also tried pullup and no pullup resistor with no change. So, using the simple code below, when viewing the serial monitor I get:

Resetting SHT...

Followed by

Starting Temperature/Humidity reading...

And that's it, never changes, I don't have another sensor to try but is there any way to know if it even works?

/*

*/

int dataPin = 9;
int sckPin = 8;

void resetSHT()
{
pinMode(dataPin,OUTPUT);
pinMode(sckPin,OUTPUT);

shiftOut(dataPin, sckPin, LSBFIRST, 255);
shiftOut(dataPin, sckPin, LSBFIRST, 255);

digitalWrite(dataPin,HIGH);
for(int i = 0; i < 15; i++){
digitalWrite(sckPin, LOW);
digitalWrite(sckPin, HIGH);
}
}

//Specific SHT start command
void startSHT()
{
pinMode(sckPin,OUTPUT);
pinMode(dataPin,OUTPUT);
digitalWrite(dataPin,HIGH);
digitalWrite(sckPin,HIGH);
digitalWrite(dataPin,LOW);
digitalWrite(sckPin,LOW);
digitalWrite(sckPin,HIGH);
digitalWrite(dataPin,HIGH);
digitalWrite(sckPin,LOW);
}

void writeByteSHT(byte data)
{
pinMode(sckPin,OUTPUT);
pinMode(dataPin,OUTPUT);

// digitalWrite(dataPin,LOW);
shiftOut(dataPin,sckPin,MSBFIRST,data);

pinMode(dataPin,INPUT);

//Wait for SHT15 to acknowledge by pulling line low
while(digitalRead(dataPin) == 1);

digitalWrite(sckPin,HIGH);
digitalWrite(sckPin,LOW); //Falling edge of 9th clock

//wait for SHT to release line
while(digitalRead(dataPin) == 0 );

//wait for SHT to pull data line low to signal measurement completion
//This can take up to 210ms for 14 bit measurments
int i = 0;
while(digitalRead(dataPin) == 1 )
{
i++;
if (i == 255) break;

delay(10);
}

//debug
i *= 10;
Serial.print("Response time = ");
Serial.println(i);
}

//Read 16 bits from the SHT sensor
int readByte16SHT()
{
int cwt = 0;
unsigned int bitmask = 32768;
int temp;

pinMode(dataPin,INPUT);
pinMode(sckPin,OUTPUT);

digitalWrite(sckPin,LOW);

for(int i = 0; i < 17; i++) {
if(i != 8) {
digitalWrite(sckPin,HIGH);
temp = digitalRead(dataPin);
// Serial.print(temp,BIN);
cwt = cwt + bitmask * temp;
digitalWrite(sckPin,LOW);
bitmask=bitmask/2;
}
else {
pinMode(dataPin,OUTPUT);
digitalWrite(dataPin,LOW);
digitalWrite(sckPin,HIGH);
digitalWrite(sckPin,LOW);
pinMode(dataPin,INPUT);
}
}

//leave clock high??
digitalWrite(sckPin,HIGH);

// Serial.println();

return cwt;
}

int getTempSHT()
{
startSHT();
writeByteSHT(B0000011);
return readByte16SHT();
}

int getHumidSHT()
{
startSHT();
writeByteSHT(B00000101);
return readByte16SHT();
}

void setup() {
pinMode(dataPin,OUTPUT);
pinMode(sckPin,OUTPUT);

Serial.begin(9600); // connect to the serial port

Serial.println("Resetting SHT...");
resetSHT();
}

void loop () {
delay(2000);
Serial.println("Starting Temperature/Humidity reading...");
int temp = getTempSHT();
Serial.print("Temprature:");
Serial.println(temp);

temp = getHumidSHT();
Serial.print("Humidity:");
Serial.println(temp);
}

Tried another code, same thing with -40-41c and -9 humidity. Thing is if is disconnect clk and data I get the same thing so it is not seeing the sensor at all. This code doesn't check the sensor like some others so it will just spit out constant serial data of the same values. Looks like I have a bad sensor?

/**

#include <SHT1x.h>

// Specify data and clock connections and instantiate SHT1x object
#define dataPin 10
#define clockPin 11
SHT1x sht1x(dataPin, clockPin);

void setup()
{
Serial.begin(38400); // Open serial connection to report values to host
Serial.println("Starting up");
}

void loop()
{
float temp_c;
float temp_f;
float humidity;

// Read values from the sensor
temp_c = sht1x.readTemperatureC();
temp_f = sht1x.readTemperatureF();
humidity = sht1x.readHumidity();

// Print the values to the serial port
Serial.print("Temperature: ");
Serial.print(temp_c, DEC);
Serial.print("C / ");
Serial.print(temp_f, DEC);
Serial.print("F. Humidity: ");
Serial.print(humidity);
Serial.println("%");

delay(2000);
}

Is this the datasheet?
http://www.parallax.com/dl/docs/prod/acc/SensirionDocs.pdf
It says 4k7 pulldown for the clock line, there is no pullup... Nevertheless that should have nothing to do with the case, as you are driving those lines..

DeSilva, thanks, the datasheet was different than the one I was using! Changed connections around and all is well, what a stupid mistake. Thanks for your time. :wink: