Microcontroller › PIC › Microcontroller GSM Irrigation Water Supply Monitoring Control
- This topic has 1 reply, 2 voices, and was last updated 11 years, 8 months ago by AJISH ALFRED.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
March 16, 2013 at 6:06 am #4803NitinParticipant#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 storagebyte 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 ONfprintf(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 OFFfprintf(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 smsdata = get_gsm_sms_text(); //get sms message contentfprintf(GSM,"AT+CMGD=1rn"); //delete messagedelay_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 WaterSystem.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 projectThis is the ckt diagram of the projectMarch 17, 2013 at 5:01 pm #9336AJISH ALFREDParticipant
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
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.