Whilst having automatic lights in my bathrooms is great, having to manually turn on the fan is less than ideal. This article describes how I am interfacing a humidity sensor with a Homevision Pro automation controller to automatically turn on the exhaust fans when humidity reaches a per-defined level. It does not cover all of the programming and smarts around the installation and this this article will provide guidance for any automation system. This is probably one of the easiest tasks I have performed at our house.
Bill of Materials
– 1 x Honeywell HIH-4030 humidity sensor ($19 AUD)
– 1 x Length of heat shrink ($3 AUD)
– 1 x 20m (enough cable to run between automation controller and sensor) of cable. ($10 AUD)
– 1 x automation module to control exhaust fan ($27 AUD)
Total Cost = $59 AUD
– Soldering Iron
– Screw Driver
Step 1: Figure Out How The Sensor Works
Probably the most obvious step here for any automation task. Before we can start controlling the exhaust fan we need to figure out how this sensor works. This sensor was the first analogue sensor I had dealt with and to be honest they are very simple. The HIH-4030 measures relative humidity (%RH) and delivers it as an analog output voltage in near linear form. More details can be found here and if you don’t have time to read this this document it can be summarised with the following image.
This sensor has three pins.
5V – 5V DC
GND – Ground for 5V DC
OUT – A return voltage (DC) which will be relative to the humidity it is reading.
To test how the sensor operates you will need your multimeter and a DC power supply. Supply power to the sensor by connecting 5V and GND to the sensor. Now setting your multimeter to DC volts measure between GND and OUT. The reading you receive will now be relative to the humidity. As humidity changes so will be the voltage detected.
Step 2: Make The Connections
Now since I have tested this it is time to connect to the Homevision Pro. When I built this house I ran an overkill of Ethernet throughout the house. Rather than running a new cable I decided to use CAT 6 as my transport medium. As Cat 6 has 8 cores I have used 2 cores for GND, 3 cores for 5V and 3 cores for OUT. The Honeywell HIH-4030 will require you to solder your cable to the sensor.
Step 3: Program And Test
With everything physically connected it is now time to program, tune and test. The sensor has an operating range which required me to set a gain and offset value.
From the datasheet’s graph(above), it shows that at 0% RH you get a voltage of around 0.8V, at 100% RH you get 3.8V, and there is a near linear relationship between relative humidity and voltage. The Homevision Pro can apply a gain and offset value to the analog values it measures which works well for a linear relationship. According to my calculations, using a gain of 0.65 and offset to -26, the analog port value you obtain via the “VAR = Value of analog input” command will be a pretty good approximation of the relative humidity.
This equation could be expressed via the following
255 * 0.8 / 5 * 0.65 – 26 = 0.52
Testing is accomplished by turning on the hot water in the shower and waiting. I have the exhaust fans controlled by an X10 appliance module. I again use a multimeter to tune. For my needs I turn on the fan when the relative humidity reaches 70% and off again when the relative humidity stays below 70% for more than 5 minutes.