Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Calculating the humidity from a (resistive) sensor

Status
Not open for further replies.

padi

Newbie level 3
Joined
Mar 26, 2016
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
37
Hello. I am using a SYH-2R humidity sensor. It is connected to a Raspberry Pi using a MCP3008 ADC.
I successfully connected the sensor and i can get realtime readings, but i have no ideea how con convert those information to relative humidity.
This is the datasheet: **broken link removed**
I will upload a .txt with the values that i get from the sensor.

It is possible to find the RH ? Or i need to buy a calibrated sensor ?

View attachment file.txt
 

Did you read the datasheet and understand that no DC voltage must be applied to the sensor?

The datasheet specifies a typical ´characteristic of sensor resistance versus RH and temperature. It should be sufficient to calculate RH for basic measurements. Did you notice the sensor temperature dependency? It must be either corrected by an additional temperature measurement going into the RH calculation or by using a NTC in the measurement circuit as suggested in the datasheet.
 
  • Like
Reactions: padi

    padi

    Points: 2
    Helpful Answer Positive Rating
Oh, i made a terrible mistake.
So i made new measurements (every 3 seconds), without the 5V wire.


53 0.2587890625
30 0.146484375
87 0.4248046875
60 0.29296875
51 0.2490234375
45 0.2197265625
0 0.0
0 0.0
0 0.0
0 0.0
40 0.1953125
83 0.4052734375
147 0.7177734375
133 0.6494140625
99 0.4833984375
31 0.1513671875
7 0.0341796875
0 0.0
0 0.0
26 0.126953125
43 0.2099609375
73 0.3564453125
76 0.37109375
57 0.2783203125
44 0.21484375

I got 0 values because i had approach some wet paper near the sensor. In datasheet i see that 1 = 100 % humidity, so my readings kinda correct right ?

But i see that the values fluctuate a lot ? What can i do to fix this ?
 

Have you studied fig 3 in the data sheet? It shows how the resistance changes with temperature and humidity. So you need to use a second temperature only sensor, then you can knock out the temperature variations from fig 3. Leaving you able to calculate the humidity value.
Frank
 
  • Like
Reactions: padi

    padi

    Points: 2
    Helpful Answer Positive Rating
OK, thanks. I have a calibrated temperature sensor, and i will write a program so i can have reliable data.
You guys, helped me a lot, i am kinda noob with this kind of stuff.

I have run the program again (without temperature variations [the temperature in my room is ~24 degrees Celsius]) and the average value is 290. If it's correct the humidity according to fig. 3 is ~40%, right ?

I have made another longer reading and the average is still 290. [First reading (22 values) 290.2727. Second reading (42 values) 290.2727].
 
Last edited:

For an accurate calibration you can use constant humidity solutions, e.g. saturated NaCl solution 75 % rH, NaOH 6% rH.
 

Attachments

  • Constant Humidity Solutions.pdf
    10.4 KB · Views: 179
  • Like
Reactions: padi

    padi

    Points: 2
    Helpful Answer Positive Rating
Thank you for advices. Now i need to write a program that calculates the humidity using the equation of a line from 2 points. For example i get the reading 150 which is between (270, 40) and (81, 50). The math formula is [x2*y1 - x1*y2 + x*(y2 - y1)] / (x2 - x1), where x is a reading from my sensor.
y = [81 * 40 - 270 * 50 + 150*(50 - 40)] / (81 - 270) ~= 46.35. So for 150 the humidity is ~46.35.
Will my results be reliable ?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top