Sensor Value Changes As I Move Near Arduino

Hi, I am having an issue wiring up a humidity sensor (HIH-4030, bought from Sparkfun) to a Duemilanov.

When I first start up the board, the sensor reads a value which is far too high (around 70% RH), which slowly drops to around 33%, which is probably accurate. So odd, but not too big of an issue there.

The really strange thing is that once the sensor settles around 33%, if I get up from my chair, the value shoots up to 100 or so, then drops back down to 20, and eventually (after about 30 seconds) settles again. Same thing happens if I wave my hand over the sensor, but with a smaller spike and shorter time to settle.

I'm powering this over USB, with a direct connection from OUT on the sensor to analog pin 0 on Arduino. The value returned by the sensor is linear, so I'm just using map() to get the RH. The sensor itself seems fine, too; a voltmeter connected directly reads 1.5ish volts, and that rating doesn't change when i move :slight_smile:

Could this be something to do with noise in the power supply? Or something weird on the board itself? Any other ideas?


From the datasheet...

Sensor is light sensitive. For best performance, shield sensor from bright light.

I wouldn't expect the dramatic swings you're seeing but, putting the sensor in a dark place is a simple test.

I'm powering this over USB, with a direct connection from OUT on the sensor to analog pin 0 on Arduino

Does the sensor and Arduino share ground?

Thanks for the light levels tip; I read the data sheet and didn't catch that! I'll make sure to shield the sensor in the final project.

The sensor and Arduino do share a common ground.

This morning, though, I started playing around with the setup, and noticed something even stranger. When I remove the wire from OUT to PIN 0 completely and read from PIN 0, I still get an analog value of around 300. Going from PIN 0 to GROUND brings it down to 0. Going from OUT to PIN 0 with a 10k pulldown resistor from OUT on the sensor to GROUND drops the reading from PIN 0 to the 100 range.

Is this evidence for some kind of noise in my circuit? Or is there some newbie-ish quirk of the ADC that I'm totally missing here?


I think your problem is noise due to too high an input impedance from the Arduino analog input pin. The data sheet from spark gap shows in figure 9 that there is a minimum load impedance required of 80k. Why don't you wire a pull-down resistor of 50k-80k to see if that settles down the readings.