Hi,
I'm using an HIH-4030 humidity sensor at 5 V from Sparkfun and it works fine.
I am also using a Series 2 XBee that runs at 3.3 V.
How do I change the code to work at 3.3 V instead of 5?
//#define ZeroPercentVoltage 0.8;
float val = 0;
float RH = 0;
float my_room_temperature = 70; //in degrees f !
float max_voltage = 3.27;
void setup()
{
Serial.begin(9600);
}
void loop()
{
val = analogRead(0);
Serial.println(val);
my_room_temperature = 70; // If you have temperature reading, put it here (farenhit!)
max_voltage = (3.27-(0.00372549*my_room_temperature)); // The max voltage value drops down 0.00372549 for each degree F over 32F. The voltage at 32F is 3.27 (corrected for zero precent voltage)
RH = ((((val/1023)*5) - 0.8)/max_voltage)*100;
Serial.print("Relative humididty = ");
Serial.println(RH);
delay(100);
}
Code from previous forum. http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267245927
Any help is appreciated. Thanks.