HR202 Humidity Sensor

Hello,

I got a HR202 humidity sensor and I have no idea how to convert the analog result to HR%. I haven't found any exemple code at internet.

If someone have a example, please send to me. I apreciate.

the datasheet is here: ftp://imall.iteadstudio.com/Sensor/IM120712018/DS_IM120712018.pdf

int analogPin = 0;

void setup()
{
Serial.begin(9600); // setup serial
}

void loop()
{
Serial.print("Analog: ");
Serial.print(getValue());
Serial.print(" Digital: ");
Serial.println(digitalRead(digitalPin));
delay(1000);
}

float getValue() {
val = analogRead(analogPin);
// need some calca to HR%
return val;
}

The link does not work.

fixed. tks

rudmac:
Hello,

I got a HR202 humidity sensor and I have no idea how to convert the analog result to HR%. I haven't found any exemple code at internet.

If someone have a example, please send to me. I apreciate.

the datasheet is here: ftp://imall.iteadstudio.com/Sensor/IM120712018/DS_IM120712018.pdf

The datasheet you provided contains a chart which converts resistance of the sensor to humidity at a given temperature. You could put that table an array, and then look up and interpolate values based on the value from the temperature sensor which it appears you are missing.
Alternatively, you could generate a function from the values in the table. Spreadsheets graphs and trend lines are helpful for that.

kuhntucker:
Alternatively, you could generate a function from the values in the table. Spreadsheets graphs and trend lines are helpful for that.

I plotted the 25C results against the log of the resistance and found that a 4th order polynomial function fits the data quite well, with an R^2 value of 1. Personally, I'd probably go with the function approach, since I find it more aesthetically pleasing.

ok, tks.

I will figure out to transform it into a formula using also the ambient temperature matter.

tks

hello, I just bought the sensor of HR202.
By the way have anyone had been successful how to get the reading in RH%? I had tried to search from the other sources, but it seems that not many info could get about this sensor.

You could put that table an array, and then look up and interpolate values based on the value from the temperature sensor which it appears you are missing.

you can use - Arduino Playground - MultiMap - for non-linear mapping (it mixes lookup & interpolation)

I am trying to get this sensor to work , but with out much luck, does anybody got the correct formula / calculation.

This looks like a horrible sensor :wink:
First of all - Relative Humidity is, by name, relative to the air temerature.
The reading from this sensor is therefore incomplete, and cannot be used unless you already know the air temperature.
.. And if I read the documentation right, you will have to create a 500-2000 Hz frequenzy at 1.5 volt. And then messure the inductance.
It will cost you about $10 in parts. ...and half the hair on your head :wink:

Can I recomend a completely difrent approach to your project?
Alternative 1 : "DHT11 Digital Temperature and Humidity Sensor"
It is close to the range of HR202. It messures temp. and RH. It will give you the calculated RH digitaly over the serial port. It costs about $1.50 on eBay
Alternative 2 : "DHT22/AM2302 Digital Temperature Humidity Sensor"
The same as DHT11. A bit more expensive, but it has a wider range and has better precision. If you want precision, it is worth the extra money.

I got same problem.there is no related information in web.
So that,I did humidity experiment & got convert function as following.

Voltage: 4.01-4.20-4.32-4.36-4.48-4.52-4.63-4.78
Humidity: 99 -90 -86 -82 -80 -74 -70 -62

Slope:-47.65 intercept:290.63 R-square:0.9863

Humidity=-47.65*(Voltage)+290.63

and me also no idea about this sensor in internet about the code

Hi,
the HR202 sheet says.

(1) Avoid polarization, driving voltage or current should be 100% alternative.
(2) Please measure the sensor with LCR alternative-current bridge, don't use multimeter.

This is the naked sensor, you need to build the AC supply, recommend 1.5Vac at 1Khz, and conversion hardware before feeding a signal suitable for the Arduino, eg DC level.

Tom..... :slight_smile:

Hi all,

This is my function to use HR202.

I use datasheet to determine HR.

Sorry for my English.

/**

  • LA HUMEDAD A TRAVES DE HR202
  • /
    int oms0G[] = { 10000, 10000, 6400, 2900, 1400, 700, 370, 190, 105, 62, 38, 23,
    15, 10, 7 };
    int oms5G[] = { 10000, 10000, 4600, 2100, 1000, 500,260, 140, 80, 48, 30, 18,
    12, 8, 5 };
    int oms10G[] = { 10000, 7000, 3200, 1500, 750, 380, 200, 110, 62, 37, 24, 15,
    10, 7, 5 };
    int oms15G[] = { 10000, 5000, 2300, 1100, 540, 280, 150, 84, 50, 30, 19, 12, 8,
    6, 4 };
    int oms20G[] = { 6700, 3400, 1750, 850, 420, 210, 115, 64, 39, 24, 15, 10, 7, 5,
    3 };
    int oms25G[] =
    { 5000, 2600, 1300, 630, 310, 160, 87, 49, 31, 19, 13, 8, 6, 4, 3 };
    int oms30G[] =
    { 3900, 1900, 970, 460, 235, 125, 69, 39, 25, 16, 10, 7, 5, 3, 2 };
    int oms35G[] = { 3000, 1500, 740, 380, 190, 100, 56, 33, 20, 13, 9, 6, 4, 3, 2 };
    int humedad[] = { 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90 };
    float getHumidity(float degreesCelsius) {
    // read the value from the sensor:
    int HIH4030_Value = analogRead(HUMEDAD);
    float trueRH = 0;
    int
    arrayOMS;
    if (degreesCelsius >= 35) {
    arrayOMS = oms35G;
    } else if (degreesCelsius >= 30) {
    arrayOMS = oms30G;
    } else if (degreesCelsius >= 25) {
    arrayOMS = oms25G;
    } else if (degreesCelsius >= 20) {
    arrayOMS = oms20G;
    } else if (degreesCelsius >= 15) {
    arrayOMS = oms15G;
    } else if (degreesCelsius >= 10) {
    arrayOMS = oms10G;
    } else if (degreesCelsius >= 5) {
    arrayOMS = oms5G;
    } else if (degreesCelsius >= 0) {
    arrayOMS = oms0G;
    }
    for (int i = 0; i < 15; i++) {
    if (HIH4030_Value > arrayOMS*) {*
  • if (i > 0) { //Aproximamos el resultado (Si no es ni el primero, ni el Ășltimo)*
  • //HIH4030_Value //Ohmios actuales*
  • int ohmsRM = arrayOMS[i - 1];*
  • int humRM = humedad[i - 1];*
    _ int ohmsRm = arrayOMS*;_
    _ int humRm = humedad;
    int intervaloOHMS = ohmsRM - ohmsRm;_
    int valIOMS = HIH4030_Value - ohmsRm;
    _ float mult = (float) valIOMS * 100;
    float porcOhms = ((float) mult) / intervaloOHMS; //Porcentaje del rango de ohms;
    int intervaloR = humRM - humRm;
    trueRH = ((porcOhms * intervaloR) / 100) + humRm;
    } else {
    int ohmsRM = arrayOMS;
    int humRM = humedad;
    int ohmsRm = arrayOMS[i + 1];
    int humRm = humedad[i + 1];
    int intervaloOHMS = ohmsRM - ohmsRm;_

    int valIOMS = HIH4030_Value - ohmsRm;
    _ float mult = (float) valIOMS * 100;
    float porcOhms = ((float) mult) / intervaloOHMS; //Porcentaje del rango de ohms;
    int intervaloR = humRM - humRm;
    trueRH = ((porcOhms * intervaloR) / 100) + humRm;
    }
    break;
    }
    }
    return trueRH;
    }*_