Documentation by Andrew Samuels
Description
Honeywell HIH-4030 - Humidity Sensor- Factory Calibrated
- Insulating Film in a Capacitor System
- Voltage Difference
- 5 V
- OUT
- Analog Voltage input to digital voltage output
- GND
Goals
Measure the humidity of the environment using the HIH-4030.
Results
The HIH-4030 humidity sensor has been tested and is working as anticipated. Documentation on the HIH-4030 can be found on Bildr: Sensing Humidity With The HIH-4030 + Arduino. We connected the HIH-4030 to the arduino pins specified, uploaded the code, and took video of the results.
The code
/* HIH-4030 humidity sensor UVC PHY420 */ int HIH4030_Pin = A0; //analog pin 0 void setup(){ Serial.begin(9600); } void loop(){ //To properly calculate relative humidity, we need the temperature. float temperature = 25; //replace with a thermometer reading if you have it float relativeHumidity = getHumidity(temperature); Serial.println(relativeHumidity); delay(100); //just here to slow it down so you can read it } float getHumidity(float degreesCelsius){ //caculate relative humidity float supplyVolt = 5.0; // read the value from the sensor: int HIH4030_Value = analogRead(HIH4030_Pin); float voltage = HIH4030_Value/1023. * supplyVolt; // convert to voltage value // convert the voltage to a relative humidity // - the equation is derived from the HIH-4030/31 datasheet // - it is not calibrated to your individual sensor // Table 2 of the sheet shows the may deviate from this line float sensorRH = 161.0 * voltage / supplyVolt - 25.8; float trueRH = sensorRH / (1.0546 - 0.0026 * degreesCelsius); //temperature adjustment return trueRH; }