problems reading SH15

Hi,

I have a SH15 component from Sparkfun.

I wired it following the SH1x library from arduino webpage: GND to GND, +5V to +5V, Data to DP 2 and Clock to DP 3. I compiled the SH1x read values example sketck, and it runs, although i observed that the values changes a little bit: temperature decrease meanwhile the humidity increase. In few minutes, it could change about 1-2ºC and 1-2%, respectively.
here is an example:

Starting up
Temperature: 24.22C Humidity: 44.81%
Temperature: 24.23C Humidity: 44.84%
Temperature: 24.21C Humidity: 44.85%
Temperature: 24.22C Humidity: 44.85%
Temperature: 24.22C Humidity: 44.85%
Temperature: 24.22C Humidity: 44.85%
Temperature: 24.21C Humidity: 44.85%
Temperature: 24.19C Humidity: 44.84%
Temperature: 24.20C Humidity: 44.84%
Temperature: 24.18C Humidity: 44.88%
Temperature: 24.17C Humidity: 44.88%
Temperature: 24.17C Humidity: 44.88%
Temperature: 24.16C Humidity: 44.87%
Temperature: 24.15C Humidity: 44.91%
Temperature: 24.14C Humidity: 44.91%

So my first question is if that variation is normal.

On the other hand, and this is really what i would like to understand, i changed a little bit the wiring of the component. Now, +5V goes to DP 4 of my duemilanove. This is because i want to save something of battery for my project. Then i made some modifications in the example code, and now it looks like this:

/**
 * ReadSHT1xValues
 *
 * Read temperature and humidity values from an SHT1x-series (SHT10,
 * SHT11, SHT15) sensor.
 *
 * Copyright 2009 Jonathan Oxer <jon@oxer.com.au>
 * www.practicalarduino.com
 */

#include <SHT1x.h>

// Specify data and clock connections and instantiate SHT1x object
#define dataPin  5
#define clockPin 6
const int corriente=4;
SHT1x sht1x(dataPin, clockPin);

void setup()
{
  pinMode(corriente, OUTPUT); 
  Serial.begin(9600); // Open serial connection to report values to host
  Serial.println("Starting up");
}

void loop()
{
  digitalWrite(corriente, HIGH);
  float temp_c;
  float humidity;

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

  // Print the values to the serial port
  Serial.print("Temperature: ");
  Serial.print(temp_c);
  Serial.print("C");
  Serial.print("   ");
  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.println("%");
  digitalWrite(corriente, LOW);
  delay(1000);
}

Not the results do not have sense. Temperature is so high, and the pressure is quite low. And they also change along the time: humidity decrease and temperature increase. Here is an example:

Starting up
Temperature: 27.32C Humidity: 37.87%
Temperature: 32.15C Humidity: 36.89%
Temperature: 33.21C Humidity: 34.73%
Temperature: 33.84C Humidity: 32.84%
Temperature: 34.28C Humidity: 31.43%
Temperature: 34.64C Humidity: 30.34%
Temperature: 34.91C Humidity: 29.56%
Temperature: 35.14C Humidity: 28.88%
Temperature: 35.36C Humidity: 28.39%
Temperature: 35.48C Humidity: 27.97%
Temperature: 35.62C Humidity: 27.67%
Temperature: 35.82C Humidity: 27.37%
Temperature: 35.91C Humidity: 27.15%
Temperature: 36.05C Humidity: 26.96%
Temperature: 36.16C Humidity: 26.78%

The real values are more or less those showed in the first quote above.

So, my question is now related to the reason why the readings are so rare. Is it not a good idea to provide the power by a digital pin and taking it high and low for measure those parameters when i need to measure (ones per hour or something lie that)?

Thanks a lot!!

It's not a good idea to supply power via a digital pin. It is a logic level, not a power source so even though you are only pulling a few milliamps you are not really supplying a regulated power source.

So, power the SHT device from +5V... The sensor is probably having difficulty figuring out which supply voltage to accept since it knows how to deal with 3.3V and 5.0V supplies automatically.

I really can't quite figure out your reasoning here... sorry.

Now, +5V goes to DP 4 of my duemilanove. This is because i want to save something of battery for my project.

The chip has a very low power sleep mode... and that would be preferred to turning it on and off the way you intended. once it figures out what supply voltage is being used... it should not be changed... and power supplied by an output pin may mess with that.

Thanks so much,

I wiring the sensors in a espetial way, and one of them neew not to receive voltage except in the moment of the measurement. On the other way, i saw that some components runs perfectly receiving the voltage through a digital pin. Taka a look to the microSD compoenent from libelium, that works perfectly with filelogger library. In the example code, the microSD depends of a digital pin and not of +5V pin.

So i deduced that it was possible to use other sensors in the same way... now i see that my deduction was wrong!

Thanks a lot!