# Calculating actual humidity using sy-hs 220 humidity sensor

I am getting following output from sy-hs 220 humidity sensor.

466
466
467
466
466


i.e. approximate 466. How would I convert it to actual humidity? As from datasheet I came to know that this sensor outputs DC voltage. Some calculations are given in datasheet, but I am unable to calculate it. Link to datasheet Source. (Please see the standard characteristic in datasheet) I am new to this field please help.

• What are you measuring from the humidity sensor ,voltage ? can you provide the schematic ? Feb 11 '16 at 9:52
• I just want to measure actual humidity. What ever analog values I got that I have posted. Not sure how to calculate Feb 11 '16 at 15:42
• The answer to the linked question has a python equivalent to the Arduino map() function @DaveTweed mentioned below. stackoverflow.com/questions/1969240/… May 22 '18 at 15:26

It is unclear what hardware you are using. Let's assume that you're using an Arduino.

• Arduino returns ADC values from 0 to 1024 for 0 to 5V.
• The humidity sensor returns from 1 to 3V which is 205 to 614 in ADC values.

So using an inbuilt function map(), we get this code:

    int val = analogRead(0);
val = map(val, 205, 614, 30, 90);

• actually I am not using arduino. I have xbee which is sensing the values after interval of 10 sec and giving to serial port of debian and using pythonXbee library i am extracting the values. I didn't got the use of map() Feb 11 '16 at 15:45
• I will try with arduino and let you know the results. :) Feb 11 '16 at 15:54

According to the datasheet, the humidity sensor is linear & operates between 30-90%RH.

Hence as long as the humidity value is between 30-90%RH, this formula is applied:

Humidity = (ADC Voltage in mV) * (330)


In order to convert the ADC value it into the actual humidity value

Humidity = (ADC Value - Minimum ADC Value) * (Maximum Humidity Value - Minimum Humidity Value) / (Maximum ADC Value - Minimum ADC Value) + Minimum Humidity Value


You can find the Arduino Example Code for SY-HS-220/SL-HS-220 in the link below: https://github.com/jonathanrjpereira/SY-HS-220-Humidity-Temperature-Sensor