Humirel HS1101 Help

I have an HS1101 humidity sensor and am trying to get it to work. I did some searching and I'd rather not go the 555 timer circuit route.

I found this code:

Arduino Forum (scroll to bottom)

I built a circuit as shown in the HS1101 data sheet:

  • sensor ground pin to ground
  • 10 mega ohm pullup resistor between ground and sensor pin
  • 220 ohm resistor between sensor pin and digital pin 4 of my Arduino Uno

I'm getting readings of -35 give or take 2-3 using that code. If I breathe on the sensor a few times, the readings jump to -62 give or take 2-3.

So obviously I have a sign issue. Also am off by a factor of just under 2 it would seem. Ambient temp in my room is 70F, so temp correction shouldn't be a big deal as it's close to std.

Any ideas?

I noticed the author of that code mentioned using a 2 mega ohm resistor instead of the 10M speced in the data sheet. I just swapped that and get readings of around -41.

Here's where it gets interesting. I dug up an old Radio Shack temp/humidity gauge I had buried with my beer brewing equipment. It's reading 36% sitting on my desk, which is pretty dam close to what the Humirel is saying (after ignoring the sign issue). If I breathe into it a few times it jumps to around 84% which is a little more than the Humirel jumped but still in the ballpark.

Not sure if I should leave his formula as is and experiment with different resistor values (not the pulldown, the RC) or tweak his formula:
#define RH1(time) ((.1667*time)-67)
...based on some extrapolation. Or maybe try to mess around with the formula in the data sheet instead: (Time - RHConstant) / 24 where RHConstant is 12169 (though not sure what that is based on and may be different for Arduino).

Don't want to talk to myself, but:

I don't think the code in that link is correct. Good approach, but there are problems with the implementation - should not use the same pin to charge, discharge, and measure; also should not be using a digital pin to measure the decay rate (HIGH is 5V, but LOW could really be anything below 5V).

I have some code I'm testing now, using separate pins to charge and discharge and an analog pin to measure the time. I started with the code in the capacitance meter example:

This code works very well. I was able to accurately measure some caps I have from 100 uf down to 2 nf. It's spot on.

But I have run into a few issues using this with the sensor. The capacitance of the sensor is very low, regardless of humidity. But the biggest problem is I simply can't get the capacitor to charge to 5V no matter how long I keep the chargepin on. It will charge to around 1.61V and if I breathe heavily onto it I can get it to charge to 1.78V.

Nothing I've found really works well, so I started from scratch.

/*
Wiring Instructions: Sensor ground to ground.  Digital pin 13 to 10k ohm resistor to sensor input (series).  Sensor input to 220 ohm resistor to digital pin 11 (series).  Analog pin 0 to sesnsor input.
Future enhancements: 1) Find a way to more fully charge before discharging.  2) take average of several readings before displaying value as in previous code.  3) tweak the relHum calculation.
*/
int analogPin = 0;
int chargePin = 13;
int dischargePin = 11;
unsigned long startTime;
unsigned long elapsedTime;
float relHum;                

void setup(){
  pinMode(chargePin, OUTPUT);     
  digitalWrite(chargePin, LOW);  
  Serial.begin(9600);             
}

void loop(){
  digitalWrite(chargePin, HIGH);  // charge capacitor
  while(analogRead(analogPin) < 300){ 
  //A full 5V should be a value of 1023, but I can only get it to vary from 330-365
  }
  digitalWrite(chargePin, LOW);             // turn off charge pin 
  startTime = micros();
  pinMode(dischargePin, OUTPUT);            // set discharge pin to output 
  digitalWrite(dischargePin, LOW);          // discharge capacitor 
  while(analogRead(analogPin) > 0){         // wait until capacitor is fully discharged
  }
  elapsedTime = micros() - startTime;       // calculate decay time
  relHum = ((elapsedTime * 0.2143) + 9.43); //simple algebra from a few known values with another humidity meter
  Serial.println(relHum);                   // print the value to serial monitor
  pinMode(dischargePin, INPUT);             // reset discharge pin
  delay(1000);                              // let it settle
}

I wouldn't rely on this, but it's in the ballpark, giving values within 5% or so of my Radio Shack humidity meter. It's a little slow to react sometimes and tends to randomly bounce around a bit though.

After trying some other different approach to get HS1101 working without 555 I found your post.
I followed your wiring tips and uploaded the sketch but i can't get a realistic value...

I found that th HS1101 is discharging always in approx. 120 us.

I'm starting thinking that my sensor is broken :~