HIH-4000 Humidty Sensor and Voltage Issues

The HIH-4000 is a analog humidity sensor. I chose it specifically for its durability in cold weather. The problem is I can’t get the voltage to read right.

the whole system is fed 5v from a regulated power source.

If i read the voltage off the HIH with a multi meter (fluke 87) the voltages are right, but the arduino (micro clone) reads high.

measuring the voltage on the arudino it is 4.35v from the voltage drop from the on board regulator so I changed my calculation from the analog read to match that but it wasn’t enough. I suspect I need a smaller resistor (tutorials say to use an 80kohm to 100kohm), but i don’t know how low I can go before that start to artificially lower the readings.


An example of what I’m doing: http://www.instructables.com/id/HIH4000-Humidity-Hygrometer-Sensor-Tutorial/

float HIHgetHumidity(float degreesCelsius = 25) {
  //caculate relative humidity
  float HIHReading = analogRead(HIH4000_Pin);
  float voltage = HIHReading * (4.32 / 1023.0);
  //sensor calibration
  //  zero offset = 0.851777 V
  //  slope = 30.379308 mV/%RH
  float sensorRH = (voltage - 0.852) / 0.030;
  float trueRH = sensorRH / (1.0546 - (0.00216 * degreesCelsius)); //temperature adjustment
  if (trueRH > 100) trueRH = 100; //sometimes give a number alightly above 100
  return trueRH;

The V-in pin of the Micro needs at least 6volt for it's onboard regulator to make a stable 5volt.
If you have a reliable 5volt source, then connect it directly to the 5volt pin.

You currently power the (unknown) ethernet module from/through the onboard 5volt regulator of the Micro.
That will overload/overheat that tiny regulator.
You should also power the ethernet module directly from the 5volt supply.

The sensor is ratiometric. That means you must power it from the 5volt pin of the Micro (same voltage).

my mistake i over simplified the drawing, the ethernet module is also powered by the 5v psu.

I will try powering the micro with the +5v pin instead of the Vin pin and see what happens (and fix the code to use a 5v reference). thanks.

This is a ratiometric sensor. You should not use it as a voltmeter.
The datasheet states 0% as 0.1652VCC, or 0.16521024 = 169 as 0% offset,
and 100% as 0.7952VCC, or 0.79521024 = 814 as 100%. Assuming you use a 10-bit A/D.
Going directly from ratio to A/D value makes outcome independent of MCU voltage.
See (untested) example sketch.

const byte HIH4000_Pin = A0;
const int minimum = 169; // 0% calibration
const int maximum = 814; // 100% calibration
int HIHReading;
int trueRH;

void setup() {

void loop() {
  HIHReading = analogRead(HIH4000_Pin);
  Serial.print("RAW HIHReading: ");
  // temp correction here
  HIHReading = constrain(HIHReading, minimum, maximum);
  trueRH = map(HIHReading, minimum, maximum, 0, 100);
  Serial.print("Sensor RH: ");
  delay(1000); // use millis() timing in final code


thanks. feeding my voltage directly to the +5v pin and bypassing the regulator put my values in the right range.

I like the code, that makes more sense than what I was doing, i didn't know you could map from one range to another like that, definitely something I will work into my code shortly. i like that it is independent of voltage so any minor fluctuations won't matter.

You do not need a resistor with the HIH-4000 series sensors to get accurate readings. What the datasheet actually means is that the sensor needs to see a high impedance input and the Arduino analogue input pins already provide this. By adding a resistor, you are actually making the situation worse. I just use a 0.1uF capacitor and these sense work fine.