# humidity sensor calculation

Status
Not open for further replies.

#### gopi the king

##### Junior Member level 2
i get the value from adc but i don't kown how to convert that value into humidity %rh ... i need the calculation and formula . i hope u will reply .. i attach the data sheet of my humidity sensor View attachment sy-hs-220.pdf

#### internetuser2k12

##### Banned
dip your sensor in water for max humidity and then note down the max raw adc value it is giving. If you are using 10 bit adc the raw adc value of sensor should be in the range 0 to 1023. Check that and reply.

if you get raw adc value 1023 for RH 90 i.e., 2970 mV

then 1023 = 90

1023 * x = 90

x = 0.0879765395894428

eg: if raw_adc_value = 920 then 920 * 0.0879765395894428 = 80.93841642228739 RH

Last edited:

#### FvM

##### Super Moderator
Staff member
dip your sensor in water for max humidity
Only few electronic humidity sensors will tolerate this procedure. It's also questionable that they give good results above 90% rH. Calculating a linear transfer characteristic based on the datasheet should work as a first guess. For an accurate (two-point) calibration use the vapour phase over saturated salt solutions.

https://www.omega.com/temperature/z/pdf/z103.pdf

#### Tahmid

Page 2 of the attached datasheet (post 1) shows a straight-line graph. By eye, it looks quite straight, with a little deviation at some points.
Assuming that it is a completely straight line, the gradient is constant and equal to (Δy/Δx) = (2.970-0.990)/(90-30) = 0.033.

A straight line has equation y=mx+c. m=0.033

At (30,0.990):
0.990=(0.033)(30)+c
c = 0

So, it goes through the origin.

You can take another point:
At (90,2.970):
2.970=(0.033)(90)+c
c = 0

So, it goes through the origin.

Thus, the formula for output voltage (in Volts) is V = 0.033 (RH). Expressed in mV, it is V = 33 (RH).

Now, to calculate relationship between ADC result and relative humidity, you need to know the reference voltage.

Hope this helps.
Tahmid.

Last edited:
cg.gisha

### cg.gisha

Points: 2

#### ameyakale

##### Newbie level 3
Page 2 of the attached datasheet (post 1) shows a straight-line graph. By eye, it looks quite straight, with a little deviation at some points.
Assuming that it is a completely straight line, the gradient is constant and equal to (Δy/Δx) = (2.970-0.990)/(90-30) = 0.033.

A straight line has equation y=mx+c. m=0.033

At (30,0.990):
0.990=(0.033)(30)+c
c = 0

So, it goes through the origin.

You can take another point:
At (90,2.970):
2.970=(0.033)(90)+c
c = 0

So, it goes through the origin.

Thus, the formula for output voltage (in Volts) is V = 0.033 (RH). Expressed in mV, it is V = 33 (RH).

Now, to calculate relationship between ADC result and relative humidity, you need to know the reference voltage.

Hope this helps.
Tahmid.

Do this sensor require temperature compensation? If yes can you post formula?