| PIC 16F84A Temperature Controller |
| Sunday, 05 December 2004 | |
![]() 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 16x2 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:
Here's a snap of the module : ![]() The project is divided into the following subparts :
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:
ADC TLC549 on the circuit : ![]() Working: Sequence of events See also datasheet page 8/10
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
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 The first PIC16F84a ie PIC-1 collects data from the ADC and transmits them serially to the second PIC16F84a ie PIC-2 The connections between the PIC-1,ADC and Temperature Sensor TMP37 is shown below (click for a larger image) : 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 :
The connections between the PIC-2 ,the LCD and Input buttons is shown below (click for a larger image): 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.
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 16x2 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 16x2 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 HEX Code for PIC-1 ASM Code for PIC-2 HEX 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 Qusetions?If you got any questions.please feel free to message me.You may click here or mail me at gerryseq(at)rediffmail.com Recommend this page to a friend {moscomment} ![]() |
| < Prev |
|---|
PIC Temperature Controller 















