Temperature and Humidity Meter (version 2)

This project is a combined temperature and humidity meter. It is a replacement for the original meter here, using a HDC1080 I2C humidity/temperature sensor instead of the HS1101 humidity and TC1046 temperature sensors.

The HDC1080 sensor is made by Texas Instruments (p/n HDC1080DMBT) and available from Digikey (296-43864-1-ND) for around C$7. It combined the humidity and temperature sensors into one tiny package, using the AVR 2-wire serial interface. All the analog processing is done inside the sensor, removing some amount of inaccuracy of the previous design.

I wanted to try using an I2C device in a project, and this was ideal. I tried coding the I2C interface myself, but I found the technical description in the AVR spec sheets lacked conciseness, which is a kind way to say it was incomprehensible, at least for me anyway. However Peter Fleury to the rescue, his I2C Master support code worked perfectly and is incorporated into the project.

At the top of the unit you can see the HDC1080 sensor. It is mounted on a surface-mount adapter, which really helps dealing with this kind of part. There are 4 wires going to the CPU board inside the case.

The LCD display is a Lumex
LCD-S301C31TR 3 digit unit (DigiKey 67-1788-ND) with no controller or backlight. I must admit that this LCD display is a pain to use. You need 24 connections to the CPU (hence the large ribbon cable), and the program must drive each segment to make up the display. However it is cheap (~C$3.40), and uses little power. I just wish there was provision for a backlight. I also want to note that this display is a static LCD, and normally requires an AC signal to drive the segments. A write-up on the subject can be found here. However I did not implement this, as I find that the Lumex display maintains its contrast for some time after power-up. I never leave the unit on for more than a few minutes at a time, so this is not a problem for me.

When you switch the unit on, the battery voltage is sampled via R5 and R6 and ADC7. For 2 or 3 seconds, the battery voltage is displayed. Then the display changes to temperature or humidity, depending on the setting of SW2. I have implemented Celsius, which is what the sensor emits, so a calculation must be added to display Fahrenheit

A digital median filter is used to smooth out the temperature display. I wsh this were not necessary, but I found with two HDC1080 devices that the temperature jumps around by up to 1.5 degrees from one reading to the next. A search on the internet suggested "bad part" but I'm not so sure. Anyway if you know anything about this, please let me know. The humidity reading is steady.

The I2C interface routines can produce some errors, which must be captured but are hard to deal with. Especially since I have worked on this project, I have not seen any I2C errors! Anyway what I do is to display two numbers, like N M, where N is 1, 2 or 3, indicating which I2C routine was called, which you can find in main.c, and M is the I2C error code, which can be found in the corresponding routine in hdc1080.c. The program then hangs. I'm not sure how useful this might be, but in any case a power reset will clear any error.

Download C source code for the project

Back to VE3LNY's AVR Project Page