• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Relative humidity sensor

Status
Not open for further replies.

hash

New Member
Hello,

I need your assistance in a project that I'm trying to do for school. It's a weather station and it involves, among other things, a relative humidity sensor. I have chosen a cheap resistive one for this matter but I can't figure out how to use it :) It will have to be read by the ADC from a microcontroller and then the value sent to a computer.

What I’m not certain about:

The datasheet says the resistance is from about 100ohms to 1kohm, rising with the humidity. This is waaay smaller than any other RHS I’ve read about (typically the resistance _decreases_ with humidity from about 4Mohms to hundreds of kohms). I've measured it with a DC ohmmeter (at the time I didn't know about the electrolysis thing... I think it's fried now but I'll get another one) and with a RLC meter @ 1KHz and they both read a couple of Mohms.

Some datasheets (for other RHSs) say that the AC can be a square wave with 0 DC, 1KHz frequency and 50% pulse width (symmetrical). Can I do the same with my sensor? It would really simplify things (I won’t have to build a sine wave generator for that matter).

Reading the voltage can't be very hard, just pass the output through a superdiode rectifier then smooth/convert. It's just not clear how to do that with the schematic from the datasheet: both the RHS and the thermistor for temperature compensation are in the same resistive divider - varying with humidity and temperature. On the other hand I could just bypass the thermistor and use a precision resistor and find out the resistance of the RHS from the output DC since I already have a digital thermometer in the weather station...

Oh well, maybe you can shine some light on this :)

Hash.
 

Attachments

crutschow

Well-Known Member
Most Helpful Member
Certainly you can use a square-wave source. No advantage to using a sine-wave. To get 0 DC you can run the square-wave through a capacitor at the input to the sensor circuit.

What is a "superdiode rectifier". Do you mean an ideal rectifier using diodes and an op amp?

Since you already know the temperature, you don't need a thermistor, as you noted. You can just use a look-up table in the computer to correct the humidity readings based upon the correction graph in the data sheet.
 

Sceadwian

Banned
hash, can you provide a PDF link for the sensor you're using?
 

Mikebits

Well-Known Member
It seems you just use the sensor in a voltage divider and read the dc voltage.
 

ccurtis

Well-Known Member
That data sheet leaves a lot to be desired. How do you have any idea what pins to connect to?
 

Mikebits

Well-Known Member
I think the outer two pins are just for mechanical support. The two inside pins are non polar.
 

hash

New Member
Thanks for the replies!

@crutschow: Yes, the ideal diode rectifier made with opamps, in my analog design course it was called a superdiode :)

if you can't access the pdf I've attached, here's a link:
http://www.samyoungsnc.com/pdf/humidity_sensor/SYH-2T.pdf

The outer 2 pins are the thermistor leads, if I hadn't pried the thing apart I would have never known that, it's not in the datasheet.

I'll try putting it in a simple voltage divider to find out the resistance, but there is still the issue with its huge measured resistance vs what the datasheet tells me.

Thanks again for the replies
--Hash.
 

ccurtis

Well-Known Member
I doubt you fried it by putting a DC ohmmeter on it. Chemical polarization effects take time to occur from what I found out, and they are reversible to some extent, at least. With only a little research, I found the resistance of this type of sensor can range to as high as 100 MΩ. Maybe whoever made the data sheet was just as careless with the graph as he was with defining the pinout.

And, yes, a square wave should be fine, but you want to avoid any DC bias on the sensor.

From what I learned, resistive humidity sensors have significant temperature dependencies when installed in an environment with large (>10°F) temperature fluctuations. That's probably why the thermistor is in there. The graph in the data sheet is given for only one temperature, but will be different for other temperatures, another deficiency of the data sheet.
 

crutschow

Well-Known Member
Most Helpful Member
The graph in the data sheet is given for only one temperature, but will be different for other temperatures, another deficiency of the data sheet.
The pdf data sheet he posted has a graph and table that shows the humidity vs. resistance fore three different temperatures. You can extrapolate between these points for temperatures in between.
 

ccurtis

Well-Known Member
The pdf data sheet he posted has a graph and table that shows the humidity vs. resistance fore three different temperatures. You can extrapolate between these points for temperatures in between.
Yes, I see that now. I saw that only after looking at the single temperature right at the very top of the graph. Clear as mud.
 

hash

New Member
I've tried running some simulations on PSpice but I'm stuck at generating a good (conditioned) signal for the sensor. The problem is the coupling capacitor which is blocking DC but at the same time it distorts the square wave signal. If the cap value is small then it distorts more and if it's large the time constant becomes large itself and hundreds of miliseconds pass before it becomes stabilized at 0DC - the sensor doesn't want that. Even so there's some distortion and the signal itself isn't symmetrical (there are a few tens of millivolts difference between the peaks). Is there a specific method for removing the DC component of digital (square wave) signals without any losses to the signal itself?

Thanks,
Hash
 

ccurtis

Well-Known Member
I've tried running some simulations on PSpice but I'm stuck at generating a good (conditioned) signal for the sensor...
Hi. If you are running your source signal through a capacitor, there can be no DC component on the other side of the capacitor. Your simulation is likely starting off with an initial charge on the capacitor that degenerates in a few milliseconds and would not be there in the real world.

Distortion of the square wave is acceptable. You want to measure the peak voltage. Naturally, the capacitor will distort the square wave because it is acting as a low pass filter in conjunction with the sensor resistance.

If the square wave does not have a 50% duty cycle, there will be a voltage difference between the peaks with respect to 0v. That is what you would expect from a signal with no DC component on it. If the signal is high for x seconds and low for X+1 seconds, the high peak would have to greater in amplitude (with respect to 0V) than the low peak to balance out the longer, low peak.

If you want a square wave with no distortion and no DC component, you would have to generate it directly at the source, but it will get distorted after passing it through the sensor anyway, because the sensor has a quite large internal capacitance. If you fed the sensor with a sine wave, the sine wave would not get distorted. Again, though, you want to measure the peak voltage, so the wave-shape is not critical.
 

hash

New Member
If the square wave does not have a 50% duty cycle, there will be a voltage difference between the peaks with respect to 0v.
It seems the sim isn't aware of that :) Here's my circuit and the results of the simulation (the ideal diode does its job, only problem is the square wave signal). I don't know if 25mV are enough to trigger electrolysis in the sensor but all the datasheets I've read so far seem to emphasize the necessity of a symmetrical input signal.

LE:
Update - it seems that the simulation is at fault, I've played with the parameters (smaller time step) and now it shows an almost symmetrical output. I'll have to check this when I get my hands on an oscilloscope tommorow at school.
 

Attachments

Last edited:

crutschow

Well-Known Member
Most Helpful Member
I've tried running some simulations on PSpice but I'm stuck at generating a good (conditioned) signal for the sensor. The problem is the coupling capacitor which is blocking DC but at the same time it distorts the square wave signal. If the cap value is small then it distorts more and if it's large the time constant becomes large itself and hundreds of miliseconds pass before it becomes stabilized at 0DC - the sensor doesn't want that. Even so there's some distortion and the signal itself isn't symmetrical (there are a few tens of millivolts difference between the peaks). Is there a specific method for removing the DC component of digital (square wave) signals without any losses to the signal itself?
The capacitor in series with the signal is the correct way to remove any dc component. It appears to take a long time to stabilize in PSpice with a larger capacitor, but a few hundred milliseconds is no problem in the real circuit, since that only occurs at start-up and you will likely be applying the signal for many seconds at a time.

A small amount of distortion of the square-wave is not a problem. The high-pass filter formed by the cap and resistance will cause some droop in the flat-portion of square-wave but that won't significantly affect the measurement.

And even if the waveform is not symmetrical, the capacitor insures that the net dc current is zero, as required by the sensor.
 

ccurtis

Well-Known Member
There will be a slight DC offset in the real world with your circuit in the last post at the point where the red probe is because the op amp is not perfect. It has its own offset and input errors. It may be a good idea to put a capacitor after the sensor, as well as before it.
 

crutschow

Well-Known Member
Most Helpful Member
There will be a slight DC offset in the real world with your circuit in the last post at the point where the red probe is because the op amp is not perfect. It has its own offset and input errors. It may be a good idea to put a capacitor after the sensor, as well as before it.
How will a capacitor after the sensor help? It will have no effect on the op amp errors and the dc average voltage at that point is zero.
 

ccurtis

Well-Known Member
How will a capacitor after the sensor help? It will have no effect on the op amp errors and the dc average voltage at that point is zero.
It won't help. The humidity sensor is in the series arm of the device, not the thermistor. Forget what I said about a capacitor after the sensor. It's won't help and is totally unnecessary.

In your simulation, though, you may see an op amp error offset where the red probe is. You can ignore it, but still understand why it is there.
 

hash

New Member
It works! :)
Even with a small capacitor the DC is gone and the square wave isn't distorted at all. Now I'll just have to get another opamp since I fried it (I seem to be doing that a lot lately...) while trying to construct the ideal diode circuit and test it with the sensor.

Thanks a lot for the replies, you're the best!
 

xxcn

New Member
Hi Hash, Guys,

I got the same type of cheap sensor several days ago and have been struggling to find information on interfacing it with a mcu since. I was surprised to find very little information on the topic, and this thread is one of the most useful things I managed to find :) Thanks!

I'm still having trouble putting it all together though. Hash, can you please post a schematic with the sensor in it?

BTW, I found this:
http://www.electro-tech-online.com/custompdfs/2009/09/200965858493943.pdf

It basically states that your ideal diode and smoothing caps are not required?!
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top