EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • 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
  • Advertise
You are here: Home / Topics / SMS based HOME AUTOMATION

SMS based HOME AUTOMATION

|

Projects › Projects › SMS based HOME AUTOMATION

  • This topic has 24 replies, 20 voices, and was last updated 9 years, 10 months ago by Julie Ann Diesta.
Viewing 15 posts - 1 through 15 (of 25 total)
1 2 →
  • Author
    Posts
  • January 12, 2013 at 5:42 am #2063
    M.Khalil Anwar Nizami
    Participant

    HI sir…

     

    Hope you will be fine.I am new commer in your profile.

    I want to make this project,would you give me complete circuit diagram and guide me to finish it?

    Please sir.

     

    BYE

     

    January 14, 2013 at 5:57 pm #8958
    AJISH ALFRED
    Participant

    Surely we can guide you to create your own circuit diagram and complete your project. Please share the details.

    January 16, 2013 at 1:51 pm #8966
    Amy
    Participant

    Hi sir, i somehow have a similar project. we are planning to use GSM and pic16f877a… our problem is the program in interfacing the gsm with the PIC.. thank you very much :)

    January 19, 2013 at 4:35 am #8981
    nidhin.k
    Participant

    this is the code for sms based home automation. in this code i can control 4 appliances….

     

    SMS COMMANDS

     

    *a ( – appliance 1- ON)

    *b ( – appliance 2- ON)

    *c ( – appliance 3- ON)

    *d ( – appliance 4- ON)

    *e (- appliance 1- OFF)

    *f  (-  appliance 2- OFF)

    *g  (- appliance 3-OFF)

    *h (-  appliance 4-OFF)

     

     

     

    #include<pic.h>
     
    #define First_Line 0x80
    #define Second_Line 0xc0
    #define Curser_On  0x0f
    #define Curser_Off 0x0c
    #define Clear_Display 0x01
    #define Data_Port PORTD
     
    static bit   Lcd_rs  @((unsigned) &PORTC*8+4); 
    static bit   Lcd_en  @((unsigned) &PORTC*8+5);
     
    #define appl1 RB7
    #define appl2 RB6
    #define appl3 RB5
    #define appl4 RB4
     
    void gsm_init();
    void Lcd8_Init();
    void Lcd8_Command(unsigned char);
    void Lcd8_Write(unsigned char,unsigned char);
    void Lcd8_Display(unsigned char,const unsigned char*,unsigned int);
    void Delay(unsigned int);
     
    void Serial_Init(unsigned long int);
    void Serial_Out(unsigned char);
    void Serial_Conout(const unsigned char *,unsigned char);
    void Baudrate(unsigned long int);
    void Receive(unsigned char);
     
    unsigned char c[5],j;
    void main()
    {
    TRISB=0x00;
    TRISC=0xC0;
    TRISD=0x00;
    appl1=appl2=appl3=appl4=1;
    Lcd8_Init();
    Lcd8_Display(0x80,”HOME APPLIANCES:”,16);
    Lcd8_Display(0xC0,”    CONTROL:    “,16);
    Delay(65000);Delay(65000);
    Lcd8_Display(0xC0,”                “,16);
    Serial_Init(9600);
    gsm_init();
    Receive(1);
    while(1)
    {
    if(j>=2)
    {
    Receive(0);
    if(c[1]==’a’){appl1=0;Lcd8_Display(0xC0,”APPLIANCES 1:ON “,16);}
    if(c[1]==’b’){appl2=0;Lcd8_Display(0xC0,”APPLIANCES 2:ON “,16);}
    if(c[1]==’c’){appl3=0;Lcd8_Display(0xC0,”APPLIANCES 3:ON “,16);}
    if(c[1]==’d’){appl4=0;Lcd8_Display(0xC0,”APPLIANCES 4:ON “,16);}
    if(c[1]==’e’){appl1=1;Lcd8_Display(0xC0,”APPLIANCES 1:OFF”,16);}
    if(c[1]==’f’){appl2=1;Lcd8_Display(0xC0,”APPLIANCES 2:OFF”,16);}
    if(c[1]==’g’){appl3=1;Lcd8_Display(0xC0,”APPLIANCES 3:OFF”,16);}
    if(c[1]==’h’){appl4=1;Lcd8_Display(0xC0,”APPLIANCES 4:OFF”,16);}
    j=0;
    Receive(1);
    }
    }
    }
     
    void interrupt  timer1(void)
    {
     if(RCIF)
     {
    RCIF=0;
    c[j]=RCREG;
    if(c[0]==’*’)j++;
    else j=0;
     }
    }
    void gsm_init()
    {
    Serial_Conout(“AT”,2);
    Serial_Out(0x0d);Serial_Out(0x0a);
    Delay(65000);Delay(65000);
    Serial_Conout(“AT+CMGF=1”,9);  
    Serial_Out(0x0d);Serial_Out(0x0a);
    Delay(65000);Delay(65000);
    Serial_Conout(“AT+CNMI=2,2,0,0,0”,17);  
    Serial_Out(0x0d);Serial_Out(0x0a);
    Delay(65000);Delay(65000);
    }
     
    void Lcd8_Init()
    {
    Lcd8_Command(0x38); //to select function set
    Lcd8_Command(0x06); //entry mode set
    Lcd8_Command(0x0c); //display on
    Lcd8_Command(0x01); //clear display
    }
     
    void Lcd8_Command(unsigned char com)
    {
    Data_Port=com;
    Lcd_en=1;
    Lcd_rs=0;
    Delay(125);
    Lcd_en=0;
    Delay(125);
    }
     
    void Lcd8_Write(unsigned char com,unsigned char lr)
    {
    Lcd8_Command(com);
     
    Data_Port=lr; // Data 
    Lcd_en=1;
    Lcd_rs=1;
    Delay(125);
    Lcd_en=0;
    Delay(125);
    }
     
    void Lcd8_Display(unsigned char com,const unsigned char *word,unsigned int n)
    {
    unsigned char Lcd_i;
     
    for(Lcd_i=0;Lcd_i<n;Lcd_i++)
    { 
    Lcd8_Write(com+Lcd_i,word[Lcd_i]);
      }
    }
     
    void Delay(unsigned int del)
    {
    while(del–);
    }     
     
    void Serial_Init(unsigned long int baud)
    {  
    Baudrate(baud);
    SYNC = 0;     // asynchronous mode
    SPEN = 1;     // serial port enable
    TXEN = 1;     // tx enable
    GIE=1;
    PEIE=1;
    RCIE = 1; // interrupt set
    CREN = 1;     // rx enable
    }
     
    void Serial_Out(unsigned char val)
    {
    TXREG =val;
    while(!TXIF);
    TXIF = 0;
    }
     
     
    void Serial_Conout(const unsigned char *data,unsigned char n)
    {
    unsigned char ser_j;
    for(ser_j=0;ser_j<n;ser_j++)
    {
    Serial_Out(data[ser_j]);
    }
    }
     
    void Baudrate(unsigned long int baud)
    {
    if(baud==110) //Crystal Freq 1 Mhz
    {
    SPBRG = 141;          // for 110 baud rate
    BRGH = 0;     // baud rate low
    }
    else if(baud==1200) //Crystal Freq 4 Mhz
    {
    SPBRG = 51;          // for 1200 baud rate
    BRGH = 0;     // baud rate high
    }
    else if(baud==2400)
    {
    SPBRG = 25;          // for 2400 baud rate
    BRGH = 0;     // baud rate high
    }
    else if(baud==4800)
    {
    SPBRG = 12;          // for 4800 baud rate
    BRGH = 0;     // baud rate high
    }
    else if(baud==9600)
    {
    SPBRG = 25;          // for 9600 baud rate
    BRGH = 1;     // baud rate high
    }
    else if(baud==57600)
    {
    SPBRG = 20;          // for 57600 baud rate
    BRGH = 1;     // baud rate high
    }
    else if(baud==115200)
    {
    SPBRG = 10;          // for 115200 baud rate
    BRGH = 1;     // baud rate high
    }
    }
     
     
    void Receive(unsigned char rece)
    {
    if(rece==1)
    {
    RCIE = 1; // interrupt set
    CREN = 1;     // rx enable
    }
    else
    {
    RCIE = 0; // interrupt set
    CREN = 0;     // rx enable
    }
    }
     
    January 19, 2013 at 1:37 pm #8986
    M.Khalil Anwar Nizami
    Participant

    hi nidhin.k,

     

    thanks alot…

    but confusio is there which circuit or hardware i will use for that code?can you give me a link of SMS BASED AUTOMATION?

    pleasse,i am very thankful

    January 23, 2013 at 8:25 am #9035
    nidhin.k
    Participant

    hai khalil….

     

     

    first of all.. u try this in proteus…..

     

    if can problem share….. 

    February 19, 2013 at 8:43 am #9157
    dolly.com
    Participant

    sms based home automation

     

    Hello sir,

     

     

                       Hope you will be fine.  I want to make this project,would you give me complete circuit diagram , code  and guide me to finish it. my id [email protected]

                       please  :) :)

                

    February 19, 2013 at 5:10 pm #9162
    M.Khalil Anwar Nizami
    Participant

     

    hi nidhin.k,

     

    hope you will b fine,

     

    Brother how to write this code in proteous?its is in hex file code,would you send me a .c file

     

    and its for pic based?

     

    and 2nd whom you used pic?

     

    i will try you given code .c file test it on mikroC software,after givin.please send me.

     

    thanks alot

    February 20, 2013 at 3:46 am #9163
    mahesh
    Participant

    hi..

    it will be very thankful if u send me circuit diagram and programming of sms based home appliance control system

     

    March 19, 2013 at 1:55 am #9341
    SALMAN
    Participant

    hii sir,

    i have also work on this project …n have a help in programming with u….

     

    March 19, 2013 at 7:12 am #9343
    M.Khalil Anwar Nizami
    Participant

     

    SMS COMMANDS

     

    *a ( – appliance 1- ON)

    *b ( – appliance 2- ON)

    *c ( – appliance 3- ON)

    *d ( – appliance 4- ON)

    *e (- appliance 1- OFF)

    *f  (-  appliance 2- OFF)

    *g  (- appliance 3-OFF)

    *h (-  appliance 4-OFF)

     

    #include<pic.h>

     

    #define First_Line 0x80

    #define Second_Line 0xc0

    #define Curser_On  0x0f

    #define Curser_Off 0x0c

    #define Clear_Display 0x01

    #define Data_Port PORTD

     

    static bit   Lcd_rs  @((unsigned) &PORTC*8+4); 

    static bit   Lcd_en  @((unsigned) &PORTC*8+5);

     

    #define appl1 RB7

    #define appl2 RB6

    #define appl3 RB5

    #define appl4 RB4

     

    void gsm_init();

    void Lcd8_Init();

    void Lcd8_Command(unsigned char);

    void Lcd8_Write(unsigned char,unsigned char);

    void Lcd8_Display(unsigned char,const unsigned char*,unsigned int);

    void Delay(unsigned int);

     

    void Serial_Init(unsigned long int);

    void Serial_Out(unsigned char);

    void Serial_Conout(const unsigned char *,unsigned char);

    void Baudrate(unsigned long int);

    void Receive(unsigned char);

     

    unsigned char c[5],j;

    void main()

    {

    TRISB=0x00;

    TRISC=0xC0;

    TRISD=0x00;

    appl1=appl2=appl3=appl4=1;

    Lcd8_Init();

    Lcd8_Display(0x80,”HOME APPLIANCES:”,16);

    Lcd8_Display(0xC0,”    CONTROL:    “,16);

    Delay(65000);Delay(65000);

    Lcd8_Display(0xC0,”                “,16);

    Serial_Init(9600);

    gsm_init();

    Receive(1);

    while(1)

    {

    if(j>=2)

    {

    Receive(0);

    if(c[1]==’a’){appl1=0;Lcd8_Display(0xC0,”APPLIANCES 1:ON “,16);}

    if(c[1]==’b’){appl2=0;Lcd8_Display(0xC0,”APPLIANCES 2:ON “,16);}

    if(c[1]==’c’){appl3=0;Lcd8_Display(0xC0,”APPLIANCES 3:ON “,16);}

    if(c[1]==’d’){appl4=0;Lcd8_Display(0xC0,”APPLIANCES 4:ON “,16);}

    if(c[1]==’e’){appl1=1;Lcd8_Display(0xC0,”APPLIANCES 1:OFF”,16);}

    if(c[1]==’f’){appl2=1;Lcd8_Display(0xC0,”APPLIANCES 2:OFF”,16);}

    if(c[1]==’g’){appl3=1;Lcd8_Display(0xC0,”APPLIANCES 3:OFF”,16);}

    if(c[1]==’h’){appl4=1;Lcd8_Display(0xC0,”APPLIANCES 4:OFF”,16);}

    j=0;

    Receive(1);

    }

    }

    }

     

    void interrupt  timer1(void)

    {

     if(RCIF)

     {

    RCIF=0;

    c[j]=RCREG;

    if(c[0]==’*’)j++;

    else j=0;

     }

    }

    void gsm_init()

    {

    Serial_Conout(“AT”,2);

    Serial_Out(0x0d);Serial_Out(0x0a);

    Delay(65000);Delay(65000);

    Serial_Conout(“AT+CMGF=1”,9);  

    Serial_Out(0x0d);Serial_Out(0x0a);

    Delay(65000);Delay(65000);

    Serial_Conout(“AT+CNMI=2,2,0,0,0”,17);  

    Serial_Out(0x0d);Serial_Out(0x0a);

    Delay(65000);Delay(65000);

    }

     

    void Lcd8_Init()

    {

    Lcd8_Command(0x38); //to select function set

    Lcd8_Command(0x06); //entry mode set

    Lcd8_Command(0x0c); //display on

    Lcd8_Command(0x01); //clear display

    }

     

    void Lcd8_Command(unsigned char com)

    {

    Data_Port=com;

    Lcd_en=1;

    Lcd_rs=0;

    Delay(125);

    Lcd_en=0;

    Delay(125);

    }

     

    void Lcd8_Write(unsigned char com,unsigned char lr)

    {

    Lcd8_Command(com);

     

    Data_Port=lr; // Data 

    Lcd_en=1;

    Lcd_rs=1;

    Delay(125);

    Lcd_en=0;

    Delay(125);

    }

     

    void Lcd8_Display(unsigned char com,const unsigned char *word,unsigned int n)

    {

    unsigned char Lcd_i;

     

    for(Lcd_i=0;Lcd_i<n;Lcd_i++)

    { 

    Lcd8_Write(com+Lcd_i,word[Lcd_i]);

      }

    }

     

    void Delay(unsigned int del)

    {

    while(del–);

    }     

     

    void Serial_Init(unsigned long int baud)

    {  

    Baudrate(baud);

    SYNC = 0;     // asynchronous mode

    SPEN = 1;     // serial port enable

    TXEN = 1;     // tx enable

    GIE=1;

    PEIE=1;

    RCIE = 1; // interrupt set

    CREN = 1;     // rx enable

    }

     

    void Serial_Out(unsigned char val)

    {

    TXREG =val;

    while(!TXIF);

    TXIF = 0;

    }

     

     

    void Serial_Conout(const unsigned char *data,unsigned char n)

    {

    unsigned char ser_j;

    for(ser_j=0;ser_j<n;ser_j++)

    {

    Serial_Out(data[ser_j]);

    }

    }

     

    void Baudrate(unsigned long int baud)

    {

    if(baud==110) //Crystal Freq 1 Mhz

    {

    SPBRG = 141;          // for 110 baud rate

    BRGH = 0;     // baud rate low

    }

    else if(baud==1200) //Crystal Freq 4 Mhz

    {

    SPBRG = 51;          // for 1200 baud rate

    BRGH = 0;     // baud rate high

    }

    else if(baud==2400)

    {

    SPBRG = 25;          // for 2400 baud rate

    BRGH = 0;     // baud rate high

    }

    else if(baud==4800)

    {

    SPBRG = 12;          // for 4800 baud rate

    BRGH = 0;     // baud rate high

    }

    else if(baud==9600)

    {

    SPBRG = 25;          // for 9600 baud rate

    BRGH = 1;     // baud rate high

    }

    else if(baud==57600)

    {

    SPBRG = 20;          // for 57600 baud rate

    BRGH = 1;     // baud rate high

    }

    else if(baud==115200)

    {

    SPBRG = 10;          // for 115200 baud rate

    BRGH = 1;     // baud rate high

    }

    }

     

     

    void Receive(unsigned char rece)

    {

    if(rece==1)

    {

    RCIE = 1; // interrupt set

    CREN = 1;     // rx enable

    }

    else

    {

    RCIE = 0; // interrupt set

    CREN = 0;     // rx enable

    }

    }SMS COMMANDS

     

    *a ( – appliance 1- ON)

    *b ( – appliance 2- ON)

    *c ( – appliance 3- ON)

    *d ( – appliance 4- ON)

    *e (- appliance 1- OFF)

    *f  (-  appliance 2- OFF)

    *g  (- appliance 3-OFF)

    *h (-  appliance 4-OFF)

     

    #include<pic.h>

     

    #define First_Line 0x80

    #define Second_Line 0xc0

    #define Curser_On  0x0f

    #define Curser_Off 0x0c

    #define Clear_Display 0x01

    #define Data_Port PORTD

     

    static bit   Lcd_rs  @((unsigned) &PORTC*8+4); 

    static bit   Lcd_en  @((unsigned) &PORTC*8+5);

     

    #define appl1 RB7

    #define appl2 RB6

    #define appl3 RB5

    #define appl4 RB4

     

    void gsm_init();

    void Lcd8_Init();

    void Lcd8_Command(unsigned char);

    void Lcd8_Write(unsigned char,unsigned char);

    void Lcd8_Display(unsigned char,const unsigned char*,unsigned int);

    void Delay(unsigned int);

     

    void Serial_Init(unsigned long int);

    void Serial_Out(unsigned char);

    void Serial_Conout(const unsigned char *,unsigned char);

    void Baudrate(unsigned long int);

    void Receive(unsigned char);

     

    unsigned char c[5],j;

    void main()

    {

    TRISB=0x00;

    TRISC=0xC0;

    TRISD=0x00;

    appl1=appl2=appl3=appl4=1;

    Lcd8_Init();

    Lcd8_Display(0x80,”HOME APPLIANCES:”,16);

    Lcd8_Display(0xC0,”    CONTROL:    “,16);

    Delay(65000);Delay(65000);

    Lcd8_Display(0xC0,”                “,16);

    Serial_Init(9600);

    gsm_init();

    Receive(1);

    while(1)

    {

    if(j>=2)

    {

    Receive(0);

    if(c[1]==’a’){appl1=0;Lcd8_Display(0xC0,”APPLIANCES 1:ON “,16);}

    if(c[1]==’b’){appl2=0;Lcd8_Display(0xC0,”APPLIANCES 2:ON “,16);}

    if(c[1]==’c’){appl3=0;Lcd8_Display(0xC0,”APPLIANCES 3:ON “,16);}

    if(c[1]==’d’){appl4=0;Lcd8_Display(0xC0,”APPLIANCES 4:ON “,16);}

    if(c[1]==’e’){appl1=1;Lcd8_Display(0xC0,”APPLIANCES 1:OFF”,16);}

    if(c[1]==’f’){appl2=1;Lcd8_Display(0xC0,”APPLIANCES 2:OFF”,16);}

    if(c[1]==’g’){appl3=1;Lcd8_Display(0xC0,”APPLIANCES 3:OFF”,16);}

    if(c[1]==’h’){appl4=1;Lcd8_Display(0xC0,”APPLIANCES 4:OFF”,16);}

    j=0;

    Receive(1);

    }

    }

    }

     

    void interrupt  timer1(void)

    {

     if(RCIF)

     {

    RCIF=0;

    c[j]=RCREG;

    if(c[0]==’*’)j++;

    else j=0;

     }

    }

    void gsm_init()

    {

    Serial_Conout(“AT”,2);

    Serial_Out(0x0d);Serial_Out(0x0a);

    Delay(65000);Delay(65000);

    Serial_Conout(“AT+CMGF=1”,9);  

    Serial_Out(0x0d);Serial_Out(0x0a);

    Delay(65000);Delay(65000);

    Serial_Conout(“AT+CNMI=2,2,0,0,0”,17);  

    Serial_Out(0x0d);Serial_Out(0x0a);

    Delay(65000);Delay(65000);

    }

     

    void Lcd8_Init()

    {

    Lcd8_Command(0x38); //to select function set

    Lcd8_Command(0x06); //entry mode set

    Lcd8_Command(0x0c); //display on

    Lcd8_Command(0x01); //clear display

    }

     

    void Lcd8_Command(unsigned char com)

    {

    Data_Port=com;

    Lcd_en=1;

    Lcd_rs=0;

    Delay(125);

    Lcd_en=0;

    Delay(125);

    }

     

    void Lcd8_Write(unsigned char com,unsigned char lr)

    {

    Lcd8_Command(com);

     

    Data_Port=lr; // Data 

    Lcd_en=1;

    Lcd_rs=1;

    Delay(125);

    Lcd_en=0;

    Delay(125);

    }

     

    void Lcd8_Display(unsigned char com,const unsigned char *word,unsigned int n)

    {

    unsigned char Lcd_i;

     

    for(Lcd_i=0;Lcd_i<n;Lcd_i++)

    { 

    Lcd8_Write(com+Lcd_i,word[Lcd_i]);

      }

    }

     

    void Delay(unsigned int del)

    {

    while(del–);

    }     

     

    void Serial_Init(unsigned long int baud)

    {  

    Baudrate(baud);

    SYNC = 0;     // asynchronous mode

    SPEN = 1;     // serial port enable

    TXEN = 1;     // tx enable

    GIE=1;

    PEIE=1;

    RCIE = 1; // interrupt set

    CREN = 1;     // rx enable

    }

     

    void Serial_Out(unsigned char val)

    {

    TXREG =val;

    while(!TXIF);

    TXIF = 0;

    }

     

     

    void Serial_Conout(const unsigned char *data,unsigned char n)

    {

    unsigned char ser_j;

    for(ser_j=0;ser_j<n;ser_j++)

    {

    Serial_Out(data[ser_j]);

    }

    }

     

    void Baudrate(unsigned long int baud)

    {

    if(baud==110) //Crystal Freq 1 Mhz

    {

    SPBRG = 141;          // for 110 baud rate

    BRGH = 0;     // baud rate low

    }

    else if(baud==1200) //Crystal Freq 4 Mhz

    {

    SPBRG = 51;          // for 1200 baud rate

    BRGH = 0;     // baud rate high

    }

    else if(baud==2400)

    {

    SPBRG = 25;          // for 2400 baud rate

    BRGH = 0;     // baud rate high

    }

    else if(baud==4800)

    {

    SPBRG = 12;          // for 4800 baud rate

    BRGH = 0;     // baud rate high

    }

    else if(baud==9600)

    {

    SPBRG = 25;          // for 9600 baud rate

    BRGH = 1;     // baud rate high

    }

    else if(baud==57600)

    {

    SPBRG = 20;          // for 57600 baud rate

    BRGH = 1;     // baud rate high

    }

    else if(baud==115200)

    {

    SPBRG = 10;          // for 115200 baud rate

    BRGH = 1;     // baud rate high

    }

    }

     

     

    void Receive(unsigned char rece)

    {

    if(rece==1)

    {

    RCIE = 1; // interrupt set

    CREN = 1;     // rx enable

    }

    else

    {

    RCIE = 0; // interrupt set

    CREN = 0;     // rx enable

    }

    }SMS COMMANDS

     

    *a ( – appliance 1- ON)

    *b ( – appliance 2- ON)

    *c ( – appliance 3- ON)

    *d ( – appliance 4- ON)

    *e (- appliance 1- OFF)

    *f  (-  appliance 2- OFF)

    *g  (- appliance 3-OFF)

    *h (-  appliance 4-OFF)

     

    #include<pic.h>

     

    #define First_Line 0x80

    #define Second_Line 0xc0

    #define Curser_On  0x0f

    #define Curser_Off 0x0c

    #define Clear_Display 0x01

    #define Data_Port PORTD

     

    static bit   Lcd_rs  @((unsigned) &PORTC*8+4); 

    static bit   Lcd_en  @((unsigned) &PORTC*8+5);

     

    #define appl1 RB7

    #define appl2 RB6

    #define appl3 RB5

    #define appl4 RB4

     

    void gsm_init();

    void Lcd8_Init();

    void Lcd8_Command(unsigned char);

    void Lcd8_Write(unsigned char,unsigned char);

    void Lcd8_Display(unsigned char,const unsigned char*,unsigned int);

    void Delay(unsigned int);

     

    void Serial_Init(unsigned long int);

    void Serial_Out(unsigned char);

    void Serial_Conout(const unsigned char *,unsigned char);

    void Baudrate(unsigned long int);

    void Receive(unsigned char);

     

    unsigned char c[5],j;

    void main()

    {

    TRISB=0x00;

    TRISC=0xC0;

    TRISD=0x00;

    appl1=appl2=appl3=appl4=1;

    Lcd8_Init();

    Lcd8_Display(0x80,”HOME APPLIANCES:”,16);

    Lcd8_Display(0xC0,”    CONTROL:    “,16);

    Delay(65000);Delay(65000);

    Lcd8_Display(0xC0,”                “,16);

    Serial_Init(9600);

    gsm_init();

    Receive(1);

    while(1)

    {

    if(j>=2)

    {

    Receive(0);

    if(c[1]==’a’){appl1=0;Lcd8_Display(0xC0,”APPLIANCES 1:ON “,16);}

    if(c[1]==’b’){appl2=0;Lcd8_Display(0xC0,”APPLIANCES 2:ON “,16);}

    if(c[1]==’c’){appl3=0;Lcd8_Display(0xC0,”APPLIANCES 3:ON “,16);}

    if(c[1]==’d’){appl4=0;Lcd8_Display(0xC0,”APPLIANCES 4:ON “,16);}

    if(c[1]==’e’){appl1=1;Lcd8_Display(0xC0,”APPLIANCES 1:OFF”,16);}

    if(c[1]==’f’){appl2=1;Lcd8_Display(0xC0,”APPLIANCES 2:OFF”,16);}

    if(c[1]==’g’){appl3=1;Lcd8_Display(0xC0,”APPLIANCES 3:OFF”,16);}

    if(c[1]==’h’){appl4=1;Lcd8_Display(0xC0,”APPLIANCES 4:OFF”,16);}

    j=0;

    Receive(1);

    }

    }

    }

     

    void interrupt  timer1(void)

    {

     if(RCIF)

     {

    RCIF=0;

    c[j]=RCREG;

    if(c[0]==’*’)j++;

    else j=0;

     }

    }

    void gsm_init()

    {

    Serial_Conout(“AT”,2);

    Serial_Out(0x0d);Serial_Out(0x0a);

    Delay(65000);Delay(65000);

    Serial_Conout(“AT+CMGF=1”,9);  

    Serial_Out(0x0d);Serial_Out(0x0a);

    Delay(65000);Delay(65000);

    Serial_Conout(“AT+CNMI=2,2,0,0,0”,17);  

    Serial_Out(0x0d);Serial_Out(0x0a);

    Delay(65000);Delay(65000);

    }

     

    void Lcd8_Init()

    {

    Lcd8_Command(0x38); //to select function set

    Lcd8_Command(0x06); //entry mode set

    Lcd8_Command(0x0c); //display on

    Lcd8_Command(0x01); //clear display

    }

     

    void Lcd8_Command(unsigned char com)

    {

    Data_Port=com;

    Lcd_en=1;

    Lcd_rs=0;

    Delay(125);

    Lcd_en=0;

    Delay(125);

    }

     

    void Lcd8_Write(unsigned char com,unsigned char lr)

    {

    Lcd8_Command(com);

     

    Data_Port=lr; // Data 

    Lcd_en=1;

    Lcd_rs=1;

    Delay(125);

    Lcd_en=0;

    Delay(125);

    }

     

    void Lcd8_Display(unsigned char com,const unsigned char *word,unsigned int n)

    {

    unsigned char Lcd_i;

     

    for(Lcd_i=0;Lcd_i<n;Lcd_i++)

    { 

    Lcd8_Write(com+Lcd_i,word[Lcd_i]);

      }

    }

     

    void Delay(unsigned int del)

    {

    while(del–);

    }     

     

    void Serial_Init(unsigned long int baud)

    {  

    Baudrate(baud);

    SYNC = 0;     // asynchronous mode

    SPEN = 1;     // serial port enable

    TXEN = 1;     // tx enable

    GIE=1;

    PEIE=1;

    RCIE = 1; // interrupt set

    CREN = 1;     // rx enable

    }

     

    void Serial_Out(unsigned char val)

    {

    TXREG =val;

    while(!TXIF);

    TXIF = 0;

    }

     

     

    void Serial_Conout(const unsigned char *data,unsigned char n)

    {

    unsigned char ser_j;

    for(ser_j=0;ser_j<n;ser_j++)

    {

    Serial_Out(data[ser_j]);

    }

    }

     

    void Baudrate(unsigned long int baud)

    {

    if(baud==110) //Crystal Freq 1 Mhz

    {

    SPBRG = 141;          // for 110 baud rate

    BRGH = 0;     // baud rate low

    }

    else if(baud==1200) //Crystal Freq 4 Mhz

    {

    SPBRG = 51;          // for 1200 baud rate

    BRGH = 0;     // baud rate high

    }

    else if(baud==2400)

    {

    SPBRG = 25;          // for 2400 baud rate

    BRGH = 0;     // baud rate high

    }

    else if(baud==4800)

    {

    SPBRG = 12;          // for 4800 baud rate

    BRGH = 0;     // baud rate high

    }

    else if(baud==9600)

    {

    SPBRG = 25;          // for 9600 baud rate

    BRGH = 1;     // baud rate high

    }

    else if(baud==57600)

    {

    SPBRG = 20;          // for 57600 baud rate

    BRGH = 1;     // baud rate high

    }

    else if(baud==115200)

    {

    SPBRG = 10;          // for 115200 baud rate

    BRGH = 1;     // baud rate high

    }

    }

     

     

    void Receive(unsigned char rece)

    {

    if(rece==1)

    {

    RCIE = 1; // interrupt set

    CREN = 1;     // rx enable

    }

    else

    {

    RCIE = 0; // interrupt set

    CREN = 0;     // rx enable

    }

    }

    April 5, 2013 at 7:16 pm #9434
    SALMAN
    Participant

    hello sir…..

      i have try ur above program in keil uvision4 …but it has some error so  plzz…try ur self n solve thats problem…

    n i have also try on it…

    May 8, 2013 at 6:56 am #9669
    Dwi Octaviano
    Participant

    I want to make this project, would you give me complete circuit diagram , code, simulation on proteus  and guide me to finish it. please send me email [email protected]

    please…smiley

    May 10, 2013 at 8:07 pm #9707
    yasir
    Participant

    hello sir , i am designing a project to control the home appliances through SMS using 89c51. i am using SIM900 D module and i want to add some features in this project the feature is the real time monitering that the module  can automatically give the feed back to the user after 15 minutes that which appliance is in which state ON/OFF but i need the C Program can any body help in solving this problem? 

                                                   Thanks

    May 14, 2013 at 10:55 am #9745
    Shashank Rao.C
    Participant

    any one can u send me schematic for this project plz…

     

     

  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 25 total)
1 2 →
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • How to make string LEDs? July 11, 2025
  • PIC KIT 3 not able to program dsPIC July 11, 2025
  • Display TFT ST7789 (OshonSoft Basic). July 10, 2025
  • Remote Control By Location Part 2 July 10, 2025
  • Raise your hand if your car had one of these: July 10, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 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

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • 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
  • Advertise