Digital Indoor & Outdoor Thermometer

by Andrew F.

Introduction

This thermometer is capable of measuring the air temperature in degrees Fahrenheit and degrees Celsius with a displayed accuracy of 0.1° and accuracy of 0.03125 °C provided by the SE95 temperature sensor. The temperature readings on the display are updated every second and are displayed in an alternating sequence of indoor and outdoor readings. When the displayed temperature switches between indoor and outdoor a bicolor led is toggled between green and red. The thermometer is equipped with two sensors, the first of which is attached to the exterior of the housing and provides a temperature reading for indoor temperature display. Similarly, the second sensor allows for outdoor temperature display and is connected via a cable.

Assembled unit Assembled PCB

Hardware

The thermometer consists of a display, button, bicolor led, and two sensors connected to the microcontroller. The SE95 temperature sensors use I2C interface and the display module uses the SPI interface. The pull-up resistor of 10K is needed for implementation of the I2C interface with the sensors. Since each work only in slave mode, no pull-up resistor is needed at the SCK pins. The button is used to change the temperature conversion from Celsius to Fahrenheit and visa versa.

The unit is powered from a 6V external power supply. The MIC5209-3.6 voltage regulator converts it into the 3.6V needed for the microcontroller. The 47K resistor along with the 0.01μF capacitor are needed for keeping the microcontroller in reset during power-up. The remaining capacitors are for decoupling.

Schematic FrontView Back View Board Layout

The used microcontroller supports both Bi-wire and JTAG interfaces for programming. It turned out that the RST pin must be connected to the programmer if the JTAG interface is used. This is not needed for other MSP430 microcontrollers that support just one programming interface. Therefore, an 8-pin header should be installed for programming on the PCB instead of a 7-pin one that we used. We resolved the problem by temporary soldering a wire between the RST pin and the programmer. The supplied PCB layout is free of this design flow.

Software

The program is written on assembly language and is intended for usage with the IAR Embedded Workbench IDE.

After the initialization of the circular buffers the program falls into the main loop. At each iteration of this loop we first use a one-shot request for the temperature from the sensor for the indoor reading by calling getTemp1(). The sensor is configured to work in 12-bit resolution and one-shot mode. This means that it goes into sleep mode upon completing the temperature conversion. The conversion takes about 250msec and we read it after 500msec at the next timestamp event by calling getTemp2(). This way the new data must be ready in the sensor. This procedure is then repeated by using the outdoor sensor to gather readings. Throughout the iterations of the loop, the led is toggled between red and green to signify outdoor and indoor temperatures respectively. The microcontroller runs at 1 MHz from internal DCO.

The displayed temperature is displayed in the appropriate units depending on the state of the button. The first three digits of the display are used for the temperature reading and the fourth digit displays the units. In addition the degree symbol is also used on the display. For temperatures below 100°, the temperature is displayed to an accuracy of 0.1°. For temperatures above 100° and below -10°, the decimal point is omitted.

The formula to convert from Celsius to Fahrenheit is F = (9/5)·C + 32. The reverse conversion is as follows: C = (5/9)·(F - 32). For our purposes it is more convenient to compute 10·F = 18·C + 320 and 10·C. This way we know for sure that the decimal point must be placed right before the last decimal digit. The conversions are used separately and are chosen based on a flag that is updated each time the button is pressed. In addition, a circular buffer is used to get the average of the previous 8 temperatures so that the average can be displayed between temperature readings to prevent flickering of the rightmost digit. The display refresh frequency is about 100 Hz.

Acknowledgments

At the time of assembling the unit we had a problem to find the microcontroller, as none of known to us distributors had them in stock. We thank Texas Instruments for providing us samples.

Downloads


Last modified:Mon, Jan 23, 2023.

01537