Electronic Design

Low-Cost Digital Thermometer Uses Single-Chip Microcontroller

In many applications, the ability to read and display temperature is either desirable or an absolute requirement. Some of these applications include temperature probes, thermostats, CPU monitors, and process-control equipment. The figure illustrates a simple system for reading and displaying the temperature. This circuit requires only one microcontroller (MCU), as opposed to other solutions that need separate power management and analog converter chips. Moreover, the circuit doesn't require any special treatment of the reset pin because the MCU used incorporates brown-out detection.

The MSP430F412 MCU from Texas Instruments executes the code from flash memory while being clocked from a high-speed internal oscillator. First, the code reads the resistive sensor using the single-slope analog conversion technique. Then, the reading is converted to a BCD value and displayed on the LCD. The LCD doesn't re-quire a separate driver chip; it's directly driven by the MCU. Also, the LCD displays a flashing "F" to indicate that the reading is in degrees Fahrenheit, and that the circuit is actively reading the temperature.

Once the display is updated, the MCU enters low-power standby mode. During this time, only an internal timer is active and being incremented by the 32-kHz crystal. This timer controls the framing frequency of the LCD so that it remains on, displaying the last temperature reading. After a software selectable time delay, the same timer generates an interrupt. The interrupt then restarts the CPU and internal high-speed oscillator, and the whole process repeats. Each cycle of the interrupt either clears or writes the "F" to the display, causing it to flash.

The MSP430F412 is specifically designed for low-power battery-based applications. As a result, while the MCU is in standby mode with the LCD on, the entire circuit only draws about 1.5 µA. Because the MCU has extremely fast startup and shutdown times, it can spend more than 97% of its time in standby mode. When the circuit is in active mode or measuring the sensor, it draws only an average current of 110 µA. Combining the long standby time and the short active time results in an overall average current of under 5 µA for the circuit. If the circuit were powered from a 220-mAh, 2032-type coin cell, it could operate continuously for up to five years between battery changes.

The digital thermometer task re-quires only a small fraction of the MCU's resources. The program uses less than 17% of the flash memory. There are 21 I/O lines available for other uses, and the CPU is off at most times. With these facts in mind, it's easy to see how the digital thermometer could be just a small part of a more complex application implemented on the same MCU. The thermometer could be a subfunction of a circuit that controls production equipment, changing the speed and power based on the temperature reading.

Or instead, it could be the heart of a digital thermostat that also reacts to the time of day, as the 32-kHz input directly divides down to provide a real-time clock. The thermometer could even be part of a datalogging system that uses the MCU to store the data and run the code. This is possible because the MSP430F412 can write to its own flash memory.

Download the Code.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.