Time, Temperature and Relative Humidity Project

I wanted to add a Relative Humidity sensor to my list of projects but most seemed to be somewhat complex to implement.  The Honeywell sensor that I decided to use has a linear voltage output with RH; you just have to take into account the offset and slope.  The sensor is rated at 5 Volts so I used my 9S08SH8 board.  Since the board is already laid out for a real time clock and I already had the software for the DS1307 I included that in the program.  I was going to add a DS18B20 temperature sensor which I had used for a number of other projects but a friend suggested that it is too expensive and I should try the Microchip MCP9700A so I did so for this project.  The MC9S08SH8 has only 10 bits resolution so I can't get tenth of a degree Fahrenheit, that I like, but otherwise it seems to be OK.  As a studied the datasheet I realized that the MCP9701A would have been a better choice with the 5 Volt board but I had already ordered the former.  
Click for a high res view


In the photo to the left I have added on the prototype area of the MC9S08SH8 Project Board a MCP9700A temperature sensor and a Honeywell HIH-4030 Humidity Sensor (mounted on a breakout board from Sparkfun Electronics).


Set your terminal to 9600 baud and power up.  You should get a screen something like to the left.  Enter the command TIME and the DS1307 will give it to you.  Likewise DATE.  The commands TEMP and HUMIDITY will give the results as shown.

The data is also sent to a LCD via a SPI to LCD interface although that is not required for the project to work with the terminal.


Here is the assembly language software

The formula for RH:

Vout=(Vsupply)(0.0062(sensor RH)+0.16)

Take both sides of the equation with a large number, like 10000, do a little algebra, use a 32-bit math package and you get RH.

For BDM's

  Lowest cost.

The 9S08 family is programmed using a Background Debug Module and Code Warrior.  CW can be downloaded from the Freescale website.


Roger's Embedded Microcontrollers Home Page     

This page written by Roger Schaefer. Last updated October 8, 2011