Spanish Italian
17156 Users    

How to design a thermostat using Freescale's MCU

  Download PDF version of the Article

A thermostat regulates the temperature of a system, room, or building, keeping the temperature at a desired setpoint. There are different ways to get the temperature measurement in an electronic system, for example the use of a thermistor, thermocouples, and in some cases integrated circuits that provide either an analog voltage, current, or even a digital proportional to the temperature. To control the temperature a digital thermostat is typically connected to an HVAC unit. The thermostat provides voltage to the heater, venting, and air conditioning (HVAC) terminals indicating to the HVAC system, what should be turned on based on the current system temperature.

The thermostat reference design is an example of how a thermostat can be built taking advantage of the MC9S08LL16 features. The main features of this microcontroller that make it ideal for low-power LCD applications are:

    • Low power consumption with LCD configurations that support operation in low power micro-amperes range, as low as 1.5 µA in the thermostat.
    • 32-LCD pins, up to 196 segments with eight backplanes and 18 LCD-pins multiplexed with GPIO giving this module a lot of flexibility.
    • Any LCD pin can be frontplane or backplane, simplifying the hardware routing and allowing to use different LCDs with the same board
    • Time of day (TOD) module with quarter to second and second interrupt. It also has a comparator module that allows to wake the MCU up to every 64 seconds
    • Low power blinking model enables an LCD blink without waking the controller that can save power consumption
    • 12-bit ADC that can be triggered by the TOD module
    • Wake from stop, based on time or keyboard event

Thermostat Block Diagram

Low-End and High-End Thermostat

low-end-high-end-thermostat

Features and Advantages

The Thermostat Reference Design has the following features:

    • Accuracy of 0.1°C
    • Day of the week, hours, and minutes calendar for the low-end version, and date, hours, and minutes for the high-end version
    • Temperature display in °C or °F
    • Programmable set points for heating and cooling
    • Programmable run and hold mode
    • Fan on and auto mode
    • Standard HVAC connections
    • Current sensing switch and screw-terminals to measure power consumption
    • HVAC LED indicators
    • Contrast control for the high-end version.

Main features of the MC9S08LL family used in this reference design are:

    • 2x28 (low-end) and 8x24 (high-end) LCD display to show the temperature, date, and time. Any LCD pin can be used either as frontplane or backplane simplifing the layout work.
    • An LCD blink mode to display different messages without waking the MCU using a one second blink period
    • 12-bit ADC that gives more accuracy to the temperature measurement using a thermistor
    • Time of day module (TOD) capable of waking up the MCU from every quarter second up to every
    64 seconds.
    • Hardware triggered ADC to start the conversion after the TOD module wakes up the MCU
    • Stop 3 mode that can keep the TOD and the LCD working using a typical 6 µA current
    consumption for the high-end and 1.5 µA for the low end
    • An very low power external oscillator that can be used in stop2 or stop3 modes to provide and
    accurate clock source to the TOD. The external 32.768 KHz crystal does not need resistors or
    capacitors to work.

The MC9S08LL16 is connected to the following hardware:

    • Temperature sensor
    • Two different LCDs
    • Five push buttons
    • Four switches
    • HVAC outputs

The reference design works with an external 32.768 KHz crystal. One of the advantages of the MC9S08LL family is, no external components are needed for this crystal configuration. The standard BDM connector is also available in the PCB to program any project.This reference design uses a common +24 V AC circuit found in other thermostats. It also has screw terminals for easy integration with HVAC equipment.

The code for the thermostat is built in such a way, the software modules that talk to the MCU peripherals are independent from those modules intended to process the information. The modules used as an interface with the MCU peripherals are known as hardware abstraction layer (HAL) while the modules talking to HAL and passing the information to main.c are known as a hardware independent layer (HIL).

High Level Flow Diagram
High Level Flow Diagram

This diagram shows, the thermostat begins by configuring all the peripherals and variables to start working. After they are configured, an initial temperature measurement is performed to have the first value to display. After it enters the infinite loop that sends the microcontroller into stop mode where it spends most of the time.

Schematic

themostat-schematic

To start using the thermostat use either two AA batteries or connect an external power supply. The external power supply can go from 6 to 12 volts DC. The LCD shows the current temperature, day of the week, hours and minutes, heating, cooling, and hold modes.

thermostat_lcd_details

A — Temperature
B — Hour
C — Heating
D — Cooling
E — Battery Level
F — Day of the Week
G — Hold Mode

Source: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=S08LL&fsr...

CONTACT REQUEST
If you want to know more about this Freescale product, please submit your request to Arrow Italy using this form.

NOTE: this form is valid ONLY for Companies or Customers based in Italy and working in the Italian area.

Read the Italian version: Come progettare un termostato utilizzando un microcontrollore Freescale

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
11 + 6 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Who's new

  • pppp
  • leonart
  • bilalbinrais
  • laulau
  • RiyasAhammed
  • ah2003
  • ronne
  • stomodot
  • mbowien
  • rsilva

Who's online

There are currently 0 users and 60 guests online.