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


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.

  • \$\begingroup\$ What are you measuring from the humidity sensor ,voltage ? can you provide the schematic ? \$\endgroup\$
    – R Djorane
    Feb 11 '16 at 9:52
  • \$\begingroup\$ I just want to measure actual humidity. What ever analog values I got that I have posted. Not sure how to calculate \$\endgroup\$ Feb 11 '16 at 15:42
  • \$\begingroup\$ The answer to the linked question has a python equivalent to the Arduino map() function @DaveTweed mentioned below. stackoverflow.com/questions/1969240/… \$\endgroup\$ 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);
  • \$\begingroup\$ 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() \$\endgroup\$ Feb 11 '16 at 15:45
  • \$\begingroup\$ I will try with arduino and let you know the results. :) \$\endgroup\$ 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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.