You are on page 1of 11

PIC16484A Temperature Controller

Written on December 31, 2008 12:13 pm , by bluehash ,


Ever needed to measure temperature and display it? This project details measuring temperature
using a temperature sensor ,an ADC and a Microcontroller PIC16I84a with schematics,codes and
illustrations. You can also get the Iollowing kit, although not based on the pic, which would
make your liIe easier Ior your Iuture projects.

This project was done Iairly long ago, so please excuse the quality oI the pictures.

Overview
The Temperature control module was a part oI my Final year undergraduate project,which
consisted oI transmitting data wirelessly.
The module uses an inexpensive 8 bit Temperature Sensor the TMP37 Irom Analog Devices.
Since the data was analog and the PIC16I84 does not have an analog input,an external ADC had
to be used.
Texas Instruments` TLC549 was chosen Ior this.The advantage oI this ADC was that it could
communicate with the microcontroller serially.You may also use similar ADCs Irom Maxim-IC.
The LCD is a normal 162 display which uses the Hitachi Controller HD44780.
The module is breadboarded and not done on a PCB.Schematics are included in appropriate
places below.
This site was a great help in building the project.
Mark S. Csele`s PIC Temperature Controller Page
Capabilities oI the system:
-Show Current Temperature,Set temperature and Alarm Display.
-Go into Set Mode.
-Increment/Decrement Set Point.
-Enter Set point.
eres a snap of the module .

The project is divided into the Iollowing subparts:
-The Analog to Digital converter TLC 549 |8 bit|
-The Temperature Sensor TMP37
-The PIC16F84 / PIC16F84a Microcontroller
-Input Buttons
-The Liquid Crystal Display |LCD|
-Temperature Control
-Codes
Note.To follow this profect you may need to know to program a PIC,there are some helpful links
at the bottom of the page if you are not familiar with it.
The Analog to Digital converter TLC 549 8 bit]
escription : The TLC549 is an analog-to-digital converter (ADC) integrated circuit built around
an 8-bit switched-capacitor successive-approximation ADC. This device is designed Ior serial
interIace with a microprocessor or peripheral.
Pinouts.

Signals.
The TLC549 has two control lines and one data output line.
They are as Iollows:
-CS[bar] :: Input signal.The Chip Select signal.When low it selects/activates the chip.When high
it disables the chip
-I/O clock :: Input signal.The input/output clock line is used to clock the ADC.
-ata Out :: Output signal.The data out signal clocks out bits into the PIC microcontroller.
AC TLC549 on the circuit .

Working.
Sequence oI events:See also datasheet page 8/10
O -CS is brought low The most signiIicant bit (MSB) oI the previous conversion result
initially appears on DATA OUT when CS goes low.
O -The Ialling edges oI the Iirst Iour I/O CLOCK cycles shiIt out the second, third, Iourth,
and IiIth most signiIicant bits oI the previous conversion result.
O -Three more I/O CLOCK cycles are then applied to the I/O CLOCK terminal and the
sixth, seventh, and eighth conversion bits are shiIted out.
O -The Iinal (the eighth) clock cycle is applied to I/O CLOCK. AIter the eighth I/O
CLOCK cycle, CS must go high or the I/O clock must remain low.
#esources.
Device ManuIacturer :: Texas instruments
TLC549 Datasheet :: pdI
The Temperature Sensor TMP37
escription.
The TMP37 is a low voltage, precision centigrade temperature sensor. It provides a voltage
output
that is linearly proportional to the Celsius (Centigrade) temperature. The TMP37 does not
require any external calibration to provide typical accuracies oI 1C at 25C and 2C over
the 40C to 125C temperature range. It is intended Ior applications over the range 5C to
100C and provides an output scale Iactor oI 20 mV/C.
Calculation:
II the Temperature is around 28 Degree Celsius. The TMP37 would be giving out a voltage oI
around 560mV
|.02*280.56V ie 560mV|
Pinouts:

Signals/Pins
-The Middle Pin |pin2|ie the Vout is directly connected to pin no 2 oI the ADC TLC549.
-The rest oI the 2 pins are the supply voltage oI 5.0V and GND
TMP37 on the circuit .

#esources.
Device ManuIacturer :: Analog devices
TMP37 Datasheet :: pdI
The PIC16F84 / PIC16F84a Microcontroller
There are two PIC16I84 microcontrollers handling the ADC/Temperature sensor/LCD and the
input buttons.
The reason is that there weren`t enough pins on one PIC to control all the peripherals.So i had to
use 2 oI them and distribute the peripherals among them and also since I had a bunch oI the same
model.The two controllers communicate with each other serially.
Note : You may even use the PIC16f877 /A or the PIC17F874 /A microcontrollers from
Microchip.They have alot more pinouts and the whole module can be controlled by a single
controller.
The peripherals are distributed among the two microcontrollers in the Iollowing way:
-PIC-1 Handles the ADC TLC549 and Temperature Sensor TMP35
-PIC-2 Handles the LCD and the Iour Input Switches/Buttons to control the menu on the LCD
PIC-1
The Iirst PIC16F84a ie PIC-1 collects data Irom the ADC and transmits them serially to the
second PIC16F84a ie PIC-2.
The connection between the PIC-1,AC and Temperature Sensor TMP37 is shown below.

PIC-1 with AC and TLC549 on the circuit .

PIC-2
The PIC-2 handles all the LC control signals ,the Temperature control and the Input buttons
Using the Input Buttons ,you can :
-Go into the Set Temperature Menu
-Increment the Set Point
-Decrement the Set Point
-Enter the Set point
The connections between the PIC-2 ,the LC and Input buttons is shown below:

PIC-2 with the LCD and Input buttons :

#esources.
Device ManuIacturer : Microchip
PIC16F84a Datasheet : pdI
Codes:
The code Ior both the PICs are given at the end oI the page.
I`ve also used subroutines Irom other programs on the net and the author names are also
mentioned in the included codes. Please give them credit and leave the names intact iI you are
planning to use the codes.
The Input Buttons
There are Iour input buttons Ior controlling the menu on the LCD.
-Button1 : Enter Set Mode
-Button2 : Decrement till released
-Button3 : Increment till released
-Button4 : Enter the desired set point
II the button is not pressed ,the PIC always gets a high.
II the button is pressed, the respective PIC pin goes low.
All the Iour buttons are connected to PortA oI PIC-2
The input buttons on the circuit.

The Liquid Crystal Display LCD]:
The LCD is a normal 162 Line display using the Hitachi controller HD44780. The LCD works
in a 4 bit nibble mode,which means that the PIC Iirst sends the lower bits oI a byte and then the
upper bits.
The connections to the 162 LCD are shown above under PIC-2 connections.
The LC on the circuit.

#eferences.
You may learn more about interIacing the LCD using the Iollowing links
Beginners Guide To LCD InterIacing :: RoboticsIndia.com
PIC Tutorial LCD Board :: Nigel Goodwin
LCD InterIacing ReIerence Page :: Myke Predko
Build your own printer cable LCD Display :: Overclockers Australia
#esources.
Device ManuIacturer : Hitachi Semiconductor
HD44780 Datasheet : pdI
Temperature Control
Temperature control is achieved using a simple on/oII algorithm
Example :
II the desired Set Point is 29 Degree C.
The Alarm will activate iI the tremperaturre ~ 29 Degree C.
Sequence of events.
Initial display:

Display aIter initialisation:

Display on pressing the SET Button:

Deciding the Set point using the Increment /Decrement buttons:

Entering the Set Point at 29 Deg C |Enter button|:

Main Display aIter inserting the setpoint:

SET point exceeded..Alarm ON:

You might also like