Temperature and Humidity Meter (version 3)

This project is a combined temperature and humidity meter. It is a replacement for the original meters here and here using a SHT30 I2C humidity/temperature sensor. 


The SHT30 sensor is made by Sensirion (p/n SHT3x-ARP). It is mounted into a nice ventilated package and available from Adafruit (product 5064) and Digikey (1528-5064-ND) for around C$12. It combined the humidity and temperature sensors into one package, using the AVR 2-wire (TWI, aka I2C) serial interface. All the analog processing is done inside the sensor, removing some amount of inaccuracy of the previous designs.

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 to 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 SHT30 sensor -- at least the vented package with the SHT30 inside. 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 (bummer - link broken.) 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. By default I have implemented Celsius, but a conversion to Fahrenheit will happen if PB3 is grounded.

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 sht30.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. (Actually once I did see an error in another project, when a wire to the sensor broke, and the i2c_start function failed.)


Download C source code for the project

Back to VE3LNY's AVR Project Page