Sunday 2 October 2016

AUTO ROOM TEMP CONTROL SYSTEM WITH DISPLAY



The Auto Room Temperature Control System controls the fan when the room temperature is within the range of 28 to 30 degrees Celsius. Once the temperature decreases the fan automatically  switch OFF and remain in the OFF position till the temperature increase again. The circuit do three things:

  1. To monitor the value of temperature within the set range using LM35 temperature sensor.
  2.  Track the changes in temperature in order to control the fan. 
  3. And display the actual room temperature values in degrees Celsius using 16 by 2 LCD.
////////....... ABLE DESIGNS AND CONSTRUCTION COMPANY...//////
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
//..............................................................................//
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;

// Define Messages
char message0[] = "Room Temperature";
char message1[] = "    Control ";
char message2[] = "Designed By";
char message3[] = "Able Designs;
//char message4[] =  "+2348037909203";
//------------------------------------------------------------------------------
unsigned long ADRead; 
unsigned int ableD[3];    
unsigned char Display[7];
//---------------------------------------------------------------
void main() 

{
     PORTA = 0;
     TRISA = 1; 
     PORTB = 0;
     TRISB = 0;  
     PORTC. RC0 = 0;
     TRISC = 0;

     LCD_Init();
     LCD_Cmd(_LCD_CURSOR_OFF);
     LCD_Cmd(_LCD_CLEAR);
     Lcd_Out(1,1,message0);
     Lcd_Out(2,1,message1);
     Delay_ms(2000);     
     LCD_Cmd(_LCD_CURSOR_OFF); //
     LCD_Cmd(_LCD_CLEAR);     
     Lcd_Out(1,1,message2);
     Lcd_Out(2,1,message3);
     Delay_ms(4000);     
     LCD_Cmd(_LCD_CURSOR_OFF); //
     LCD_Cmd(_LCD_CLEAR);   
     Lcd_Out(1,1,message4);
    Delay_ms(5000);      

    LCD_Cmd(_LCD_CURSOR_OFF); //
     LCD_Cmd(_LCD_CLEAR);  
     LCD_Out(1, 1, "Temp:");   
     Display[4] = 39;
     Display[5]= 'C'; 
     LCD_Out(2, 1, "Room Temperature");
     Delay_ms(2000);
   read:       
     ADCON1 = 0x0E;   
     ADC_Init();   

     while (1)
{    
           ADRead = (ADC_Get_Sample(0) * 500) >> 10;
            ableD[0] = ADRead / 100;
           ableD[1] = (ADRead / 10) % 10;
           ableD[2] = ADRead % 10;
          Display[1] = ableD[0] + 48;
           Display[2] = ableD[1] + 48;
           Display[3] = ableD[2] + 48;

           LCD_Chr(1, 8, Display[0]);
           LCD_Chr(1, 9, Display[1]);
           LCD_Chr(1, 10, Display[2]);
           LCD_Chr(1, 11, Display[3]);
           LCD_Chr(1, 12, Display[4]);
         if (ADRead/30)
           { 

delay_ms(5000);
           PORTC. RC0 =  1;
           }
              else
           PORTC. RC0 =  0;
             delay_ms(200);
             goto read;
     }
     }

 

No comments: