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 / Microcontroller GSM Irrigation Water Supply Monitoring Control

Microcontroller GSM Irrigation Water Supply Monitoring Control

|

Microcontroller › PIC › Microcontroller GSM Irrigation Water Supply Monitoring Control

  • This topic has 1 reply, 2 voices, and was last updated 12 years, 4 months ago by AJISH ALFRED.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • March 16, 2013 at 6:06 am #4803
    Nitin
    Participant

     

    #include <16F877A.h>
    #include <string.h>
    #include <gsm.h>
    #use        delay (clock=20000000)
    #use        rs232 (baud = 9600, xmit=PIN_B0,rcv=PIN_B1,stream=GSM)
    byte ch = 0;
    int count = 0;
    byte data[150];          //For SMS storage
    byte on[] = {"on"};
    byte off[] = {"off"};
    byte about[] = {"about"};
    byte help[] = {"help"};
    byte num[12];
    void init_gsm()
    {
    fprintf(GSM,"ATrn");
    delay_ms(1500);
    fprintf(GSM,"AT+CMGF=1rn");
    delay_ms(1500);
    }
    void WRITE_TO_EEPROM(int tdata, int location)  //write data to eprom at location
    {
    write_eeprom(location,tdata);
    }
    int READ_FROM_EEPROM(int location)          //read eeprom data strored location
    {
    int tdata;
    tdata = read_eeprom(location);
    return(tdata);
    }
    void main()
    {
    int i = 0;
    int j = 0;
    int system_on_flag = 0;
    int pump_on_flag = 0;
    output_high(PIN_D2);
    output_high(PIN_D3);
    delay_ms(1000);
    output_low(PIN_D2);
    output_low(PIN_D3);
    delay_ms(1000);
    output_high(PIN_D2);
    output_high(PIN_D3);
    delay_ms(1000);
    output_low(PIN_D2);
    output_low(PIN_D3);
    init_gsm();
    while (1)
    {
    output_toggle(PIN_D2);
    delay_ms(1000);
    system_on_flag = READ_FROM_EEPROM(0);
    if(system_on_flag == 1)
    {
    output_high(PIN_D3);
    if((pump_on_flag == 0) && (input(PIN_B6)))     //PIN_B6 is from soil sensor output
    {
    pump_on_flag = 1;
    output_high(PIN_D7);          //Relay ON
    fprintf(GSM,"AT+CMGS="%s"rn",num);
    delay_ms(1000);
    fprintf(GSM,"*** ALERT ***Irrigation Water Pump got Switched ONrn");
    delay_ms(1000);
    fputc(0x1A,GSM);
    delay_ms(2000);
    }
    if((pump_on_flag == 1) && (!input(PIN_B6))) //PIN_B6 is from soil sensor output
    {
    pump_on_flag = 0;
    output_low(PIN_D7); //Relay OFF
    fprintf(GSM,"AT+CMGS="%s"rn",num);
    delay_ms(1000);
    fprintf(GSM,"*** ALERT ***Irrigation Water Pump got Switched OFFrn");
    delay_ms(1000);
    fputc(0x1A,GSM);
    delay_ms(2000);
    }}
    count = 0;
    fprintf(GSM,"AT+CMGR=1rn");
    num = get_gsm_sms_number();          //get the phone number from sms
    data = get_gsm_sms_text();          //get sms message content
    fprintf(GSM,"AT+CMGD=1rn");      //delete message
    delay_ms(2000);
    if(strstr(data,on))               //check if the message got on
    {
    WRITE_TO_EEPROM(1,0);           //data, location (address)
    output_high(PIN_D3);
    fprintf(GSM,"AT+CMGS="%s"rn",num);
    delay_ms(1000);
    fprintf(GSM,"Irrigation Water Sensing System got switched ONrn");
    delay_ms(1000);
    fputc(0x1A,GSM);
    fgetc(GSM);
    delay_ms(2000);
    }
    else if(strstr(data,off))
    {
    WRITE_TO_EEPROM(0,0); //data, location (address)
    output_low(PIN_D3);
    output_low(PIN_D7);
    fprintf(GSM,"AT+CMGS="%s"rn",num);
    delay_ms(1000);
    fprintf(GSM,"Irrigation Water Sensing System got switched OFFrn");
    delay_ms(1000);
    fputc(0x1A,GSM);
    fgetc(GSM);
    delay_ms(2000);
    }
    else if(strstr(data,about))
    {
    fprintf(GSM,"AT+CMGS="%s"rn",num);
    delay_ms(1000);
    output_high(PIN_D2);
    fprintf(GSM,"B.Tech Final Year(2012-2013) Project.rn");
    delay_ms(1000);
    fputc(0x1A,GSM);
    fgetc(GSM);
    delay_ms(2000);
    }
    else if(strstr(data,help))             //check for help message
    {
    fprintf(GSM,"AT+CMGS="%s"rn",num);
    output_high(PIN_D2);
    delay_ms(1000);
    fprintf(GSM,"Send "on" to on OR "off" to off the Automatic Irrigation Water
    System.rn");
    fprintf(GSM,"Send "about" to know about me rn");
    delay_ms(1000);
    fputc(0x1A,GSM);
    fgetc(GSM);
    delay_ms(2000);
    }
    }
    }
     
    Plz Can anybody provide me the GSM.h File for PIC micrcontroller and help me to complete this project it's my final year project
    This is the ckt diagram of the project 

    March 17, 2013 at 5:01 pm #9336
    AJISH ALFRED
    Participant

    Hi Nitin,

    I’m afraid to say that there is no such library file #include <gsm.h> available.

    You have this library file #include <16F877A.h> since the device 16f877a is unique, but gsm modules are not like that. Every GSM module use same set of AT commands, but certain commands support by one module may not be supported by other.

    You can refer this project,

    engineersgarage.com/embedded/pic-microcontroller-projects/interface-gsm-module-call-message-circuit

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

RSS Recent Posts

  • ac current limiting July 13, 2025
  • I Wanna build a robot July 13, 2025
  • using a RTC in SF basic July 13, 2025
  • It's Amazing What A Buck And A Quarter.... July 13, 2025
  • Microinverters and storeage batteries? July 13, 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