Another Thermometer

This project was developed to replace an old indoor/outdoor thermometer that was becoming erratic. It is derived from my Temperature + Humidity Meter project, with a few enhancements. I use an ATmega164P, which has lots of I/O and memory.

the project

My requirements were first to read only outdoor temperature, which simplifies the project, and to run continuously from a battery, requiring low current consumption. I'm not sure how well I succeeded with the latter; my project draws 0.75 mA, and using 4 AA batteries should hopefully run for 1/2 year.

schematic diagram


The circuit is similar to the earlier project, since I use the same LCD display, the Lumex LCD-S301C31TR 3 digit unit (DigiKey 67-1788-ND) with no controller or backlight. It is a static LCD which requires some work in software to support it. In addition to encoding the data into 7-segment format, the signal polarity must be reversed constantly, or else the display fades out after a while. (A very good write-up on the subject can be found here.) However it is cheap (<C$2) and uses little power.

circuit board bottomcircuit board top


The most interesting feature of this project is the power-saving software design. The LCD needs periodic polarity reversal , and the ADC needs to be read to get the temperature. Timer2 is used to generate 200ms interrupts, which then signal events for the mainline to process. Between interrupts the processor is placed in power-saving sleep mode. In this mode, everything is shut down except for timer2. I found that this reduces the power consumption from 1.8mA to 0.75 mA. I also power down the ADC but the gain from that is small.

Accuracy is always a concern in a sensor-based project like this. On my first reading from this project, the temperature seemed to be quite high. I looked into this further, and there are two areas that need to be considered:

1. The accuracy of the A/D reference voltage. It is supposed to be 1.1V but may be different, which can have a significant effect on the readings. The A/D reference can be easily measured with a good DVM at pin 32 (Aref), and you can change #define AREF_1P1_MV in the code to correspond. But first you have to disable the ADC power saving, which means temporarily changing  #define ADC_POWERSAVE to #undef ADC_POWERSAVE, to get a stable Aref to measure.

2. The accuracy of the TC1047 sensor. The spec sheet states the accuracy is + or - 2 degrees C. That's 4 degrees of uncertainty! So even after correcting for Aref, I still thought that the thermometer read too high. Unfortunately in spite of having built several thermometers, I don't have an accurate one, so I can only give it my best guess. I added a define (#define TEMP_CF_1000s) for correcting the temperature. The nominal value is 1000, which results in multiplying the ADC output by 1000/1000 which is unity, or no correction. In my case I specified 990, giving me a slightly lower temperature, which seems close enough for me.

Note that there is a jumper, JP1, when shorted makes the project read out in degrees Fahrenheit. The LED D2 and R8 are only there for development and may be omitted. The power supply is 4 AA or AAA batteries. There is no voltage regulator, only a diode to drop the voltage to near 5V, and provide reverse-polarity protection as well. As the batteries age the voltage will drop, but the project should work well until the batteries are nearly exhausted.


Download C source code for the project

Back to VE3LNY's AVR Project Page