Sensing Humidity With The HIH-4030 + Arduino

Discussions area for bildr's blog posts.
From: http://bildr.org/2012/11/hih4030-arduino/

Humidity is weird. Even though we experience it all the time, it's not something we can normally guess with any accuracy. This is probably because when we talk about humidity, we are talking about relative humidity. Relative humidity is relative to temperature, so a change in temperature alone is enough to change the relative humidity. This makes guessing the humidity extremely hard.

Well luckily measuring relative humidity is pretty simple ...
ameyer
Founder
 
Posts: 2981
Joined: Thu Jan 21, 2010 11:59 pm
Location: The Bay Area

I recently hooked one of these humidity sensors up to a raspberry pi through an ADS1115 16 bit a-to-d converter. I also have a thermistor hooked up to one of the other ADC channels. On successive reads of the sensor, I was getting about +/- 0.5% RH readings. This seemed pretty noisy to me. I tried taking 10 samples and averaging them, and that still didn't help much. I hooked a scope up to the sensor output and saw a lot of spikes in the output trace with a peak-to-peak of about 300mv at a frequency around 1 - 5khz. I thought maybe this could be noise coming from somewhere, but my thermistor channel was much quieter. I also noticed that in the datasheet for the HIH-4030, they show an 80k load resistor hanging off the output. I tried adding this, and on the scope there wasn't much effect. So what I finally did was instead of 10, I took 1,000 samples and averaged them. That made the result appear to be much more stable, maybe +/- .1% RH over a short period, and +/- .3%RH over a few minutes, which I think could just be changes in the actual humidity. Just thought I'd share in case anyone had similar problems.

wm
w1ntermute0
 
Posts: 1
Joined: Fri Feb 08, 2013 11:52 am

Hello,

I am new to coding and Arduino. I was reviewing the code for the HIH-4030 and had a question.

Original code:
float sensorRH = 161.0 * voltage / supplyVolt - 25.8;
float trueRH = sensorRH / (1.0546 - 0.0026 * degreesCelsius); //temperature adjustment

In checking the data sheet for the sensor I came up with a different way of determining the sensorRH using an example Vout of 3.268 V which is calculated in the datasheet chart at 75.3% RH:
float sensorRH = (voltage - 0.958) / 0.0307; // 3.268 - 0.958 = 2.31 2.31 / 0.0307 = 75.24 sensorRH

The float trueRH just seems to have a typo of 0.0026 vs 0.00216.
float trueRH = sensorRH / (1.0546 - 0.00216 * degreesCelsius; // 75.24 / (1.0546 - 0.00216 * 25) = 75.20 trueRH


Oringinal code with calculations:
float sensorRH = 161.0 * voltage / supplyVolt - 25.8; // 161 * 3.268 = 526.148 526.148 / 5 = 105.2296 105.2296 - 25.8 = 79.4296 sensorRH

float trueRH = sensorRH / (1.0546 - 0.0026 * degreesCelsius); // 79.4296 / (1.0546 - 0.0026 * 25) = 79.4296 / .991 = 80.151% trueRH

The calculations would be approximately 5% off.

Since I am new to all of this I don't know if I am on the right track or not?

Thanks much for your help,

Bill
wmorris
 
Posts: 1
Joined: Thu Mar 21, 2013 9:32 pm

The code is based off of sparkfun's example code. So Im not 100%.
It is very possible that they were wrong.



wmorris wrote:Hello,

I am new to coding and Arduino. I was reviewing the code for the HIH-4030 and had a question.

Original code:
float sensorRH = 161.0 * voltage / supplyVolt - 25.8;
float trueRH = sensorRH / (1.0546 - 0.0026 * degreesCelsius); //temperature adjustment

In checking the data sheet for the sensor I came up with a different way of determining the sensorRH using an example Vout of 3.268 V which is calculated in the datasheet chart at 75.3% RH:
float sensorRH = (voltage - 0.958) / 0.0307; // 3.268 - 0.958 = 2.31 2.31 / 0.0307 = 75.24 sensorRH

The float trueRH just seems to have a typo of 0.0026 vs 0.00216.
float trueRH = sensorRH / (1.0546 - 0.00216 * degreesCelsius; // 75.24 / (1.0546 - 0.00216 * 25) = 75.20 trueRH


Oringinal code with calculations:
float sensorRH = 161.0 * voltage / supplyVolt - 25.8; // 161 * 3.268 = 526.148 526.148 / 5 = 105.2296 105.2296 - 25.8 = 79.4296 sensorRH

float trueRH = sensorRH / (1.0546 - 0.0026 * degreesCelsius); // 79.4296 / (1.0546 - 0.0026 * 25) = 79.4296 / .991 = 80.151% trueRH

The calculations would be approximately 5% off.

Since I am new to all of this I don't know if I am on the right track or not?

Thanks much for your help,

Bill
ameyer
Founder
 
Posts: 2981
Joined: Thu Jan 21, 2010 11:59 pm
Location: The Bay Area


Return to Blog Posts

Who is online

Users browsing this forum: Google [Bot] and 0 guests