Go Down

Topic: Using an HS1101 humidity sensor (Read 11 times) previous topic - next topic

wildbill

I have an Arduino sampling temperature(DS18B20) in my house & sending it to a web server so I can graph it. I thought it would be nice to get humidity too, so I needed a sensor. Unfortunately, I went cheap and didn't research this enough: I bought a couple of Parallax HS1101 sensors. I was expecting to just read an analog pin, do a bit of computation & be done. Instead, it looks like I need to add a 555 and ancillary circuitry, which I could do, but do I have to? Writing the code is no issue - I wrote C for a living for a while, but the electronics? That's the dark side.

However, looking at the Parallax circuit for the stamp, it looks like this thing is just a variable capacitance device affected by humidity. Can I connect it's output to an analog pin with a large pulldown on it, set an analog pin to digital out, set it high, set it back to analog read and record the decay? What of the 220 ohm resistor the Parallax circuit uses between the arduino pin & the device? I sincerely don't know enough to decide whether this is feasible so advice or abuse would be equally welcome.

WillR

Maybe you could provide us with a direct link to the data sheet.

Have you tried searching for an Arduino library for a similar device?
Just another Hacker

pwillard

#2
Mar 21, 2011, 02:30 pm Last Edit: Mar 21, 2011, 02:33 pm by pwillard Reason: 1
Somewhere in Arduino land... somebody created some code to emulate the BASIC STAMP RCTIME function.

AHA  found it:  http://www.arduino.cc/en/Tutorial/RCtime

You can probably use this tutorial above and reference the SAMPLE PARALLAX code to get it working.

It clearly relies on STAMP processor speed (the RHCONSTANT value) so you will need to experiment...   :-(

wildbill

Perfect, got it working with that exact sketch. Thanks for your help.

robtillaart

COuld you please post the final sketch ? (HW & Software)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

wildbill

#5
Mar 21, 2011, 04:38 pm Last Edit: Mar 21, 2011, 07:50 pm by wildbill Reason: 1
It really is the literal code given in the example sketch pwillard linked, with a longer delay in loop i.e.:
Code: [Select]
int sensorPin = 4;              // 220 or 1k resistor connected to this pin
long result = 0;
void setup()                    // run once, when the sketch starts
{
  Serial.begin(9600);
  Serial.println("start");      // a personal quirk
}
void loop()                     // run over and over again
{

  Serial.println( RCtime(sensorPin) );
  delay(1000);

}

long RCtime(int sensPin){
  long result = 0;
  pinMode(sensPin, OUTPUT);       // make pin OUTPUT
  digitalWrite(sensPin, HIGH);    // make pin HIGH to discharge capacitor - study the schematic
  delay(1);                       // wait a  ms to make sure cap is discharged

  pinMode(sensPin, INPUT);        // turn pin into an input and time till pin goes low
  digitalWrite(sensPin, LOW);     // turn pullups off - or it won't work
  while(digitalRead(sensPin)){    // wait for pin to go low
     result++;
  }

  return result;                   // report results  
}  


The circuit diagram is attached.

pwillard

Glad to help out. 

I actually have one of these sensors as well... but I opted to use the SHT-11 instead.

I think we need to talk to mr WildBill... we need to urge you into using a freebie drawing tool or using IRFANVIEW to crop your hand sketches.  Way to much blank space in that schematic, sir.

wildbill

Trimmed it a little bit  ;) Also took the opportunity to correct it. That's a 1M resistor, not a 1K - d'oh!

hotshotharry

So i have recently begun working with this sensor as well, however i have been having some trouble getting readings from outside the house to make any sense. Have you guys have good results? If anyone who has got this to work has any tips i'd love to hear them!

Basically i built the 555 timer circuit as indicated in the data sheet http://www.datasheetcatalog.com/datasheets_pdf/H/S/1/1/HS1101.shtml and it works very well using the frequency counter library. After several different attempts of trying salt solution calibrations etc ... i calibrated it with a wetbulb/drybulb at approx 87% ( bathroom after a shower with no exhaust fan) and 28% ( outlet of a dehumidifier ) and the readings seem to be very accurate and consistent. The problem is i tried it outside this morning, where I am it was below 0C and there was frost so the humidity should have been very high,(weather center said 85%) but the sensor read 32%!

So my question is does this sensor actually read RH like it claims, or absolute humidity? Does it need thermometer correction? Or maybe the temp compensation curve for the 555 is not proper? if thats the case i could just correct it with software ?

Eventually i'd like to use one of these sensors outside but so far i can only get good readings at 22C ...!

wahib

hello everyone
  I want to use the HS1101 humidity sensor, and I do not know if I should use the ne555 or to connect directly to an Arduino analog input
thank you

Vahan

Well, in my experience capacitative humidity sensors require extra calibration and fine tuning.

I currently have both DHT11 and HS1101 (actually a HTF3223 module), and I have the following readings at the moment. Both sensors are on my computer desk, temperature is 26C. DHT11: 27%, HTF3223: 45.16%. I'm using the interrupt-based frequency counting method for the latter.

Without a calibrated humidity meter, what are the choices to get these right?

wahib

hello and thank you  ...
So I can directly connect the sensor Arduino

wahib

hello,
how to get results is given by Ardu-ion on a PC network
thank you.

wildbill

While I was trying to figure the HS1101 out, I ordered a Honeywell sensor: http://sensing.honeywell.com/index.cfm/ci_id/142959/la_id/1/document/1/re_id/0. Yesterday, I decided to hook it up. It's very simple, 5V in, voltage pretty much in proportion to humidity out. So I stuck it on the breadboard, wrote a few lines of code and fired it up. It just worked. Curiously, I'm not elated, in fact I feel a little bit cheated; just worked? Where's the fun in that?

Code: [Select]

const float Vsupply=1024.0;
const int   analogHumidityPin = 0;

void setup()
{
Serial.begin(9600);
}

void loop()
{
float Vout = analogRead(analogHumidityPin);
float RelativeHumidity=(Vout/Vsupply)*100.0;
Serial.print((int)Vout);
Serial.print(" ");
Serial.print(RelativeHumidity);
Serial.println("%");
delay(500);
}

showup

Hey wildbill:

How does your HS1101 sensors results compare to Honeywell sensor HIH-4000?
Any input on this will help.

Thank you.

Go Up