0 Replies Latest reply on Sep 12, 2014 10:09 PM by RGee

    Using an HIH-5030 humidity sensor


      Here are my experiences interfacing the Honeywell HIH-5030 humidity sensor to the Galileo Generation 1 board.

      Sensor.jpgThis is a surface mount device. That makes it a bit of challenge, at least for me. It is, however, inexpensive at less than $8 US. A similar sensor, the HIH-4020 is available in an SIP, through hole package, but it is almost 3X the cost.


      Board.jpgSo, I laid down some traces - basically eyeballing the fit. Slapped on some header pins and some solder and I'm ready to go. No, it's not neat and sweet, but it gets the job done.




      One little mod...I want to keep dust and other particulate matter out of the sensor, so I gave it a little hat made from a beveled nylon washer with a non-metallic gauze cover. Hey, it's not like my artistic flare is going to make this prototype any uglier ... and yes, I tested it with and without the hat and it does not have any effect on functioning that I can see.


      HIH5030c.jpgInterfacing it to my Galileo Generation 1 board is simple. +5, GND, and A0. Added a 100K resistor between OUT and GND as per the data sheet - which actually says a minimum of 68K. Programming is equally easy. The short sketch is attached. A couple of points are worth noting if you are thinking about using this sensor.


      First off, it has a voltage output. That makes it very well suited for the Galileo. If you have tracked some of the posts on humidity sensors, including my own, concerning the DHT devices and the like - you will find this sensor much easier to use.


      Next, you will want to get the data sheet, of course. There is lots of good information there and you will need that to understand the sketch or write your own.


      The data sheet shows two voltage by RH functions and it also gives you the information on how to use temperature to correct the humidity value. In the sketch, I am using an LM35 temperature sensor. These are simple to use and I posted on this previously (there are also many other examples around). So, these lines:


      // first get the temperature from the LM35


      TemperatureC=LM35DZpin * ((GalVout * ConMV / A2Dsteps) / Voltsteps);

      TemperatureF=((TemperatureC * 9.0) / 5.0 )+32.0;


      simply get the temperature from the LM35. You can test the device without a temperature sensor by skipping the correction or by setting the variable TemperatureC to some reasonable value.


      To get the humidity, you read the analog port and do a couple of simple conversions:


      // now get the HH voltage


      HH5030V=HH5030pin * (GalVout/A2Dsteps);


      // and the RH



      Then use the temperature compensation formula as per the data sheet.


      // correct it for the temperature

      HumC=Hum / (HHCom1constant - (HHCom2constant * TemperatureC));


      The constants appear as global variables in the sketch and their values come right out of the data sheet.


      float HHconstant=0.1515;      // from HIH5030 data sheet

      float HHCom1constant=1.0546;  // from HIH5030 data sheet to compensate for temperature

      float HHCom2constant=0.00216; // from HIH5030 data sheet to compensate for temperature


      That's it, that's all there is...well, except for the obligatory screen shot.

      Screen Cap HIH5030.jpg





      Message was edited by: Had to fix an errant code line.