Honeywell HIH 4030 Humidity Sensor Library

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.

hih4030.h (785 Bytes)

hih4030.cpp (1.61 KB)

i recently got some HIH-4602-A and C sensors as samples from honeywell. ( ). which is awesome of honeywell as the sensors are around $80 each.

ill need to compare datasheets, but it looks like they work in a similar manner to the 4030s. if i need to extend your library, are you down? or you think just use it as a template and make a separate one? thoughts? comments?

You should definitely extend this library if its practical to do so. Let me know if you have any questions. Cheers!