PIC Humidity Meter

Recently while browsing the Digikey Canada web site, I typed "humidity" into the search box and was rewarded with a list of humidity sensors. I was delighted to see one sensor, the Humirel HS1101 capacitive sensor, for C$11 in single unit quantities. (Update: it was up in the C$17 range recently.) This sensor acts like a variable capacitor, and in an oscillator circuit will generate a signal whose frequency is a function of the relative humidity. Since the frequency is around 7000 Hz, it is a simple matter to measure it directly using Timer1 as a counter with the signal as an external clock.

The HS1101 technical sheet on Digikey (here), dated 7 June 2002 is a bit different from the sheet on the Humirel web site (above), which is dated September 2004. The earlier sheet shows an example circuit with values for 4 different types of 555 cmos chips, and I chose the LMC555. The later sheet only shows values for the TLC555.

The 3 resistors in the 555 circuit have unusual values. I make up these resistors by using two resistors in series, measured with a digital ohmmeter to be as close as possible to the published value.

This project uses a PIC16F684, one of my favorite PICs, since it has an internal clock that runs up to 8 MHz, and is cheaper than the 16F84A. A 2 digit LED display is perfect for displaying relative humidity up to 99%.  Timer1 runs as a 16-bit counter, externally clocked by the 555 timer oscillator, which conveniently outputs a TTL-compatible square wave.. Timer0 is set up to measure one-second intervals, and every second it grabs the Timer1 counter and resets it to zero. Consequently the Timer1 counter outputs the frequency in Hertz. Then the frequency is transformed to relative humidity using a look-up table and linear interpolation, and displayed on the LED.

One word of caution, the leads from the circuit to the HS1101 must be kept short and direct. First, the leads add capacitance which leads to error, as noted in the technical sheet. Also, any noise picked up by the leads may result in erratic readings, and digital citcuits have lots of noise. If I were building another of these units, I would mount the 555 IC together with the HS1101, to keep the lead length near zero, such as in this implementation. (Update: I did build another unit, here.)

The following photos show the project. You can see the header in the middle of the board where I connect the programmer during development.


Download C source code for LED humidity meter ( SourceBoost BoostC)

I was asked to produce a PIC16F628A version of this project. The code for it is here (untested).

Back to VE3LNY's PIC Project Page