I've written a small c++ library for the honeywell hih4030 humidity sensor that I figure I'd post for anyone who needs it. I've been using it for a bit now and it does the job. Its very simple. There is a constructor that accepts the pin number, the millivoltage of the power provided to the IC (it accepts 4 - 5.8V), and your ADC resolution. The output is ratiometric to the voltage input hence the requirement to tell the library the mV of the power supply and the ADC resolution. There is one public method "getRh(int)" which accepts a temperature value in celsius (you can just input 25 degrees C if you don't have temperature sensing capability but I recommend it for more accurate readings) and returns the relative humidity as a float.
I instantiate a global var and use it wherever needed in my code but more than one instance can be constructed at a time (there is a copy constructor for convenience):
#include <hih4030.h>
HIH4030 hih(humPin, maxMVolts, adcResolution);
If anyone has questions please let me know.
Honeywell HIH 4030 Humidity Sensor Library
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 8
- Joined: Sun Apr 24, 2011 7:03 pm
- sparky
- Posts: 101
- Joined: Tue May 25, 2010 6:37 pm
Re: Honeywell HIH 4030 Humidity Sensor Library
Thanks, i'm going to give this a try. What is ADC Resolution?
How would you change this for use with 3.3 V instead of 5V?
Sparkfun states 3.3 V works fine.
How would you change this for use with 3.3 V instead of 5V?
Sparkfun states 3.3 V works fine.
Please be positive and constructive with your questions and comments.