Notes About Working with Various Arduino & Netduino Microcontroller Boards

Monday, October 29, 2012

Using the HIH-4030 with an Arduino Uno to Measure Relative Humidity

To use the HIH-4030, you also need to measure the current temperature. To test the HIH-4030, I am using the DHT22 to measure temperature and humidity and the same board to provide a comparison. 

The data line (HIH-4030 center pin) is connected to Arduino analog pin 1.

Use code like this in the loop() to print the reading to the serial console:

 float v = analogRead(1);
 float tmp = DHT22.celcius();
 float RH = ((((v / 1023) * 5) - 0.958) / 0.0307) / (1.0546 - 0.00216 * tmp);
 Serial.print("HIH4030 RH%: ");
 Serial.print(RH);
 Serial.println("% ");


 The value returned by this code is within 2% of the RH% returned by the DHT22.

No comments:

Post a Comment