HIH-4030/31 Humidity Sensor Example Code/Circuit

I thought I'd start a new thread since the last one from 2010 is locked (read only) http://forum.arduino.cc/index.php/topic,19961.0.html

I've been playing with a Sparkfun HIH-4030 to use as a humidstat. I see lots of different functions but not sure where the numbers are coming from. I'm using the following formula, directly from the spec sheet https://www.sparkfun.com/datasheets/Sensors/Weather/SEN-09569-HIH-4030-datasheet.pdf

float voltage = (5.0 * analog0) / 1023.0;
float rh = (voltage - 0.958) / 0.03068;

of course this could be rewritten as

float rh = (voltage - 0.958) * 32.5945;

This seems to be working but the RH values are about 2-3 % below what my desktop digital temp/humidity sensors read.
This seems reasonable as each sensor is different and may require calibration. What I have not done is account for temperature.

I put a 100K resistor across VO and GND per the spec recommendation. I also tried some capacitors 10uF on 5V and VO but they did not seem to help much.

I tried the formula on http://bildr.org/2012/11/hih4030-arduino/ and I get about +4% higher than my reference humidity readings.

The current issue I have is the relay I'm using throws off my RH reading

Any ideas on how to get more accuracy and or improvements would be nice

The current issue I have is the relay I'm using throws off my RH reading

Does the relay has a separate power supply as probably the voltage drops due to the relay.
The analogRead uses the 5V as reference for its logic so if the voltage dropt to 4.75V you get a 5% misread.

this sensor is ± 8% RH so your fine by that one.
you will have to callibrate the sensor if needed better accuracy
even then this sensor is only ± 3.5% straight.
and yes as it is a analog sensor you will have to have a stable power supply.
a small voltage source of 4 volts could help here, or a separate one and a monitor on the arduino of this voltage.
the slope is only 3 volts so you have only 500 points so maxreadout is about 0.2 % this is very good as the accuracy is only 3.5%
No worries.