Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Industrial Temperature Controller

By Ashutosh Bhatt

In most of the manufacturing industries like chemical, petrochemical, food processing, pharmaceutical etc temperature is one of the main parameter to be control. Because in these kind of industries some product need the required temperature to be maintained at highest priority otherwise the product will fail (in case of preparing any medicine in pharmaceutical company the temperature pays vital role. If it is not maintained then medicine may become poison.). So the temperature controller is most widely used in almost all the industries. 

It’s basically close loop control system. It may be simply ON-OFF type or continuous type system.

ON-OFF type: – 

It continuously senses temperature, displays it, compares it with set value. If its greater, then it switch off heating element and if its very less, then switch on heating element. 

Continuous type:- 

It continuously senses temperature, displays it, compares it with set value. If its greater / less, then control the heat produce by heating element by changing its supplied current.

Here I have given an example of ON-OFF type close loop control system. Here the set value can be externally set by user for the temperature. Then the actual temperature is sensed by sensor, indicated on display with set value. If it exceeds set value then the heater is turned OFF. After then when temp falls bellow the specified limit again heater is turned ON. Also if there is failure in turning ON / OFF heater there is an alarm system. If the turning off heater failed and temperature goes on increasing then immediately the cooler/fan/AC is turned on and alarm sounds. 

 

The figure given in circuit diagram tab shows actual schematic diagram of the temperature control system.

The major components are micro controller 89C51, ADC 0848 and LCD. Other required components are temperature sensor LM35, relay driver chip ULN2003A and C/O relays.  

Connections: – 

o/p of temperature sensor is connected with channel 1 i/p of ADC. Slider of 10K pot is connected as i/p to channel 2. The data bus (DB0-DB7) is connected with port P1. Control pins RD, WR, CS & INTR of ADC are connected with port P3 pins as shown. The data pins of LCD are connected with port P0 and control pins R/W, RS & EN are connected with port P2 pins as shown in figure. Pins P2.0 & P2.1 drives two relays through ULN chip one two switch on/off cooler and other to switch on/off heater. 

 

Operation: –

Complete operation depends upon the software loaded in 89C51.

1)        Controller selects 2nd channel and receives data on P1 through ADC

2)        It displays this data on LCD as set value of temperature or reference temperature

3)        After 2 to 3 seconds, controller selects 1st channel and get the data on P1 and display it on LCD as current temperature

4)        Then it compares current temperature with set or reference temperature

5)        If current temperature is lower, then heater is ON but if its higher then heater is turned off and cooler is turned on.

6)        Now after every 2 / 3 sec of time controller takes the input from 1st channel,  display it on LCD and compare it with set value and based on that either switch on cooler or heater 

 

Software and logic: – 

The software loaded in 89C51 has to handle ADC, LCD and also has to switch ON / OFF cooler or heater depending upon set and current temperature value. To handle the ADC

A)         First we have to apply active low signal to CS and WR signal and then latch the desired address of channel on MA0 to MA4                through P1

B)         Then we have to wait for INTR signal to be low. When it is low it means that conversion is over.

C)         When INTR becomes we have to apply CS and RD signal to read digital data from ADC on port P1

To handle the LCD

  • The digital equivalent o/p that is received on P1 from ADC is in HEX format and to display it on LCD we have to convert it in ASCII
  • So we shall separate lower nibble and upper nibble of received data byte. Convert them in to ASCII and then display them on LCD screen

Complete software is written in embedded C language and compiled using microvision Keil (IDE). 

Project Source Code

###


#include<reg51.h>                                //include file for 8051 registers

#include <string.h>

sbit en = P2^7;                                     // define en, rs & rw pins for LCD

sbit rs = P2^5;

sbit rw = P2^6;

sbit b = P0^7;                                      // define b as busy flag

sbit cs = P3^0;                                     // define cs, wr, rd & intr as pins for

sbit wr = P3^1;                                    // ADC

sbit rd = P3^2;

sbit intr = P3^3;

sbit heater = P2^0;                               // define P2.0 & P2.1 as pins to on/off

sbit cooler = P2^1;                               // heater and cooler

unsigned char data1,data2;

int c=0;                                               // initialize counter

void writecmd(unsigned char a);          //function that writes command on LCD

void writedat(unsigned char b);            // function that sends data to LCD

void busy(void);                                  // function to check LCD busy

void writestr(unsigned char *s);            // function that writes string on LCD

void delay(void);                                 // to generate delay

void display(unsigned char z);               //converts hex in to ASCII and display it

 

void timr1(void) interrupt 3                  //timer 1 overflow interrupt subroutine

  {

           c++;                                         // increase count when interrupt occur

           ET1=0;

           TH1 = 0x3C;                              // load same value again in T1

           TL1 = 0xAF;

           if(c==50)                                  //if count is 50 means 50×50ms=2.5 sec

             {

                             c=0;                       // set counter again to 0

                             EA = 0;                   // disable all interrupts

                             writecmd(0xC0);     // go to next line in LCD

                             writestr("curr temp=");      // write string

                             intr = 1;

                             cs = 0;                   

                             rd = 1;

                             wr = 0;                   // write enable to ADC

                             P1 = 0x01;              // select channel 1

                             while(!intr);           // wait for conversion over

                             rd = 0;                             // read enable

                             wr = 1;

                             data2=P1;               // get the data from P1

                             display(data2);        // display it

                             writestr("'C  ");

                             if(data2>=data1)     // if current temp is higher

                               {

                                       writecmd(0xC0);

                                       writestr("over temperature");     //display message

                                       heater = 0;            // turn off heater

                                       cooler = 1;            // turn on cooler

                                }

                              else

                                {

                                       heater = 1;             // or turn on heater

                                       cooler = 0;            // turn off cooler

                                }

                              EA = 1;                  //enable interrupt before exiting

                   }                                     // loop

   }

void display(unsigned char z)

  {

          unsigned char tmp;                     // define temporary variable

          unsigned char ASCII[2];               // define 2 digit variable

          tmp = z>>4;                               // get upper nibble

          if(tmp <= 0x09)                          // if its less then 9 convert it

                   ASCII[1] = tmp+0x30;         // in ASCII by adding 30

                  

          else

          {

                   ASCII[1] = tmp-0x09;         //otherwise first deduct 9

                   ASCII[1] += 0x40;               // then convert it in ascii

          }

          tmp = (z & 0x0f);                       // get lower nibble and perform

          if(tmp <= 0x09)                          // same operation

                   ASCII[0] = tmp+0x30;

 

          else

          {

                   ASCII[0] = tmp-0x09;

                   ASCII[0] += 0x40;

          }

          writedat(ASCII[1]);

          writedat(ASCII[0]);

  }

void delay(void)

  {

    int x;

    for(x=0;x<10000;x++);

  }     

void writecmd(unsigned char a)

{

          busy();                                      //check if LCD is busy or not

          rs = 0;                                       // select command register

          rw = 0;                                      // write to LCD

          P0 = a;                                      // send byte to LCD

          en = 1;                                      // apply strobe

          en = 0;

}

void writedat(unsigned char b)

{

          busy();                                      //check if LCD is busy or not

          rs = 1;                                       // select data register

          rw = 0;

          P0 = b;                                      // write to LCD

          P0 = a;                                      // send byte to LCD

          en = 1;                                      // apply strobe

          en = 0;        

}

void busy()

{

          en = 0;                                      //disable display

          P0 = 0xFF;                                 // P0 as input port

          rs = 0;                                       // select command register

          rw = 1;                                      // read enable

          while(b==1)                               // wait until busy flag is 1

          {

           en=0;

           en=1;

          }

          en=0;

}

void writestr(unsigned char *s)

{

          unsigned char l,i;

          l = strlen(s);                               //get the length of string

          for(i=1;i<l;i++)                           // send all characters one by one

          {

                   writedat(*s);                    // till the end of string

                   s++;             

          }

}       

 

void main()

  {

          TMOD = 0xA0;         // initialize timer 1 with 16 bit timer

          TH1 = 0x3C;            // load initial count 15,535 = 3CAFh

          TL1 = 0xAF;

          heater = 1;             // initially heater is on

          cooler = 0;

          writecmd(0x3C);     // initialize LCD

          writecmd(0x0E);

          writecmd(0x01);

          writestr("set temp=");       // send string to LCD

          delay();

          intr = 1;

          cs = 0;                    // enable ADC

          rd = 1;

          wr = 0;                   // write enable

          P1 = 0x02;              // select 2nd channel

          while(!intr);           // wait until conversion is over

          rd = 0;                             // read enable

          wr = 1;

          data1=P1;               // get digital data from ADC

          display(data1);        // display it

          writestr("'C   ");

          TR1=1;                   // start timer 1

          IE = 0x88;               // enable timer 1 overflow interrupt

          while(1);                // continuous loop

  }

  

 

###

 


Circuit Diagrams

temp-cont-ckt-1


Filed Under: Electronic Projects
Tagged With: 89c51, adc0408, microcontroller, temprature, temprature control
 

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • Introduction to Brain Waves & its Types (Part 1/13)
  • Understanding NeuroSky EEG Chip in Detail (Part 2/13)
  • Performing Experiments with Brainwaves (Part 3/13)
  • Amplification of EEG Signal and Interfacing with Arduino (Part 4/13)
  • Controlling Led brightness using Meditation and attention level (Part 5/13)
  • Control Motor’s Speed using Meditation and Attention Level of Brain (Part 6/13)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • What are the battery-selection criteria for low-power design?
  • Key factors to optimize power consumption in an embedded device
  • EdgeLock A5000 Secure Authenticator
  • How to interface a DS18B20 temperature sensor with MicroPython’s Onewire driver
  • Introduction to Brain Waves & its Types (Part 1/13)

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Pull up via GPIO
  • Variable Phase shift control circuit for PWM circuit
  • Fpga wake up
  • Vco cadencd
  • Thyristor Gate Drive

RSS Electro-Tech-Online.com Discussions

  • DIY bluetooth speaker
  • Question about ultrasonic mist maker
  • HV Diodes
  • Disabled son needs advice please
  • RF modules which can handle high number of bytes per second
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering