PIC16484A Temperature Controller
Ever needed to measure temperature and display it? This project details measuring temperature using a temperature sensor ,an ADC and a Microcontroller PIC16f84a with schematics,codes and illustrations. This project was done fairly long ago, so please excuse the quality of the pictures.

Overview
The Temperature control module was a part of my Final year undergraduate project,which consisted of transmitting data wirelessly.
The module uses an inexpensive 8 bit Temperature Sensor the TMP37 from Analog Devices.
Since the data was analog and the PIC16f84 does not have an analog input,an external ADC had to be used.
Texas Instruments’ TLC549 was chosen for this.The advantage of this ADC was that it could communicate with the microcontroller serially.You may also use similar ADCs from Maxim-IC.
The LCD is a normal 16×2 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 of the system:
-Show Current Temperature,Set temperature and Alarm Display.
-Go into Set Mode.
-Increment/Decrement Set Point.
-Enter Set point.
Here’s a snap of the module :

The project is divided into the following 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 project 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]
Description : 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 for serial interface with a microprocessor or peripheral.
Pinouts:

Signals:
The TLC549 has two control lines and one data output line.
They are as follows:
-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.
-Data Out :: Output signal.The data out signal clocks out bits into the PIC microcontroller.
ADC TLC549 on the circuit :

Working:
Sequence of events:See also datasheet page 8/10
- -CS is brought low The most significant bit (MSB) of the previous conversion result initially appears on DATA OUT when CS goes low.
- -The falling edges of the first four I/O CLOCK cycles shift out the second, third, fourth, and fifth most significant bits of the previous conversion result.
- -Three more I/O CLOCK cycles are then applied to the I/O CLOCK terminal and the sixth, seventh, and eighth conversion bits are shifted out.
- -The final (the eighth) clock cycle is applied to I/O CLOCK. After the eighth I/O CLOCK cycle, CS must go high or the I/O clock must remain low.
Resources:
Device Manufacturer :: Texas instruments
TLC549 Datasheet :: pdf
The Temperature Sensor TMP37
Description:
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 of ±1°C at +25°C and ±2°C over the –40°C to +125°C temperature range. It is intended for applications over the range 5°C to 100°C and provides an output scale factor of 20 mV/°C.
Calculation:
If the Temperature is around 28 Degree Celsius. The TMP37 would be giving out a voltage of around 560mV
[.02*28=0.56V ie 560mV]
Pinouts:

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

Resources:
Device Manufacturer :: Analog devices
TMP37 Datasheet :: pdf
The PIC16F84 / PIC16F84a Microcontroller
There are two PIC16f84 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 of them and distribute the peripherals among them and also since I had a bunch of 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 following way:
-PIC-1 Handles the ADC TLC549 and Temperature Sensor TMP35
-PIC-2 Handles the LCD and the four Input Switches/Buttons to control the menu on the LCD
PIC-1
The first PIC16F84a ie PIC-1 collects data from the ADC and transmits them serially to the second PIC16F84a ie PIC-2.
The connection between the PIC-1,ADC and Temperature Sensor TMP37 is shown below:
![]()
PIC-1 with ADC and TLC549 on the circuit :

PIC-2
The PIC-2 handles all the LCD 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 LCD and Input buttons is shown below:
![]()
PIC-2 with the LCD and Input buttons :

Resources:
Device Manufacturer : Microchip
PIC16F84a Datasheet : pdf
Codes:
The code for both the PICs are given at the end of the page.
I’ve also used subroutines from 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 if you are planning to use the codes.
The Input Buttons
There are four input buttons for controlling the menu on the LCD.
-Button1 : Enter Set Mode
-Button2 : Decrement till released
-Button3 : Increment till released
-Button4 : Enter the desired set point
If the button is not pressed ,the PIC always gets a high.
If the button is pressed, the respective PIC pin goes low.
All the four buttons are connected to PortA of PIC-2
The input buttons on the circuit:

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

References:
You may learn more about interfacing the LCD using the following links
Beginners Guide To LCD Interfacing :: RoboticsIndia.com
PIC Tutorial – LCD Board :: Nigel Goodwin
LCD Interfacing Reference Page :: Myke Predko
Build your own printer cable LCD Display :: Overclockers Australia
Resources:
Device Manufacturer : Hitachi Semiconductor
HD44780 Datasheet : pdf
Temperature Control
Temperature control is achieved using a simple on/off algorithm
Example :
If the desired Set Point is 29 Degree C.
The Alarm will activate if the tremperaturre >= 29 Degree C.
Sequence of events:
Initial display:

Display after 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 after inserting the setpoint:

SET point exceeded..Alarm ON:

Codes:
ASM Code for PIC-1
ASM Code for PIC-2
Links for constructing your own PIC programmer
El Cheapo PICmicro Programmer :: Myke Predko
Pony Prog serial device programmer :: Claudio Lanconelli
Classic PIC Programmer :: bobblick.com
WinPic – A PIC Programmer for Windows
PICLIST.com :: A Heavy PIC resource

12 Responses to “PIC16484A Temperature Controller”
By JC on Apr 13, 2009 | Reply
There are no code for the call radio_init and the call radio.
can you please help
By bluehash on Apr 13, 2009 | Reply
Those function calls are not being used. They are commented out by the semi colons.
By JD on May 22, 2009 | Reply
Could you please post the pic1 and pic2 schematics using a better resolution?
Regards,
JD
By bluehash on May 26, 2009 | Reply
@JD, I wish I could. I made that circuit way back in 2003. If there is anything you need to confirm, let me know, I’ll try to answer.
By Binu on May 29, 2009 | Reply
Is the TLC549 chip available in india, so you have any address.
By bluehash on May 30, 2009 | Reply
@Binu, If you are in Mumbai, try Lamington Road. Also this was way back in 2003. You get much better serial ADCs now. You can try TI.com or analog.com to select an ADC.
By Binu on Jun 1, 2009 | Reply
Thanks for your info
By AD on Nov 10, 2009 | Reply
I am unable to convert your asm code to hex, pls convert and email it to me. Thanks loads.
By Optimus on Nov 10, 2009 | Reply
hello sir, i tried compiling ur assembly code in order to obtain the hex file. unfortunately, there were a lot errors in the code.
can u pls post or email me the hex files
thanks
By goran on Jan 27, 2010 | Reply
please send me hexa and circuit schematic:gorans@usa.com Thanks very mich
Best regard
By harish on Feb 21, 2010 | Reply
hello sir..
would you please let me know how to make the modification on this project. basically i want to make it work wirelessly as such placeing the sensor at the place of measurement and accessing its temperature at a far away place.
By bluehash on Feb 21, 2010 | Reply
You could use tiny zigbee radios.