Wednesday, 14 November 2012

SYSTEM PROGRAMMING FOR FLOOD MONITORING SYSTEM USING GSM


#include <GSM_Shield.h>
# define LED 13
# define BUTTON 7
# define BUTTON1 6
# define BUTTON2 12

//**************************************************************************
char number[]="+60194253272";  //Destination number
char text1[]="FIRST WARNING-level 1-!!!!!!!!";  //SMS to send
char text2[]="SECOND WARNING-level 2-!!!!!!!!";  //SMS to send
char text3[]="LAST WARNING-level 3-!!!!!!!!";  //SMS to send

//**************************************************************************

GSM gsm;
int error;
int sensor1 = 0;
int sensor2 = 0;
int sensor3 = 0;
int state_new = 0;
int state_old = 0;
void setup()
{
  pinMode (LED, OUTPUT);
  pinMode(BUTTON, INPUT);
  pinMode(BUTTON1, INPUT);
  pinMode(BUTTON2, INPUT);

  Serial.begin(9600);
  Serial.println("system startup");
  Serial.println("waiting");


  gsm.TurnOn(9600);          //module power on
  gsm.InitParam(PARAM_SET_1);//configure the module
  gsm.Echo(0);               //enable AT echo
}
void loop()
{
 Serial.println("ready to sent sms");

status_update:
if (state_new - state_old == 0)// no update in sensor status
{
   goto update_sensor;
}
else if (state_new - state_old < 0 || state_new - state_old > 0) // changes in status
{
   goto texting;
}
status_update1:
if (state_new - state_old == 0)// no update in sensor status
{
   goto update_sensor;
}
else if (state_new - state_old < 0 || state_new - state_old > 0) // changes in status
{
   goto texting2;
}
status_update2:
if (state_new - state_old == 0)// no update in sensor status
{
   goto update_sensor;
}
else if (state_new - state_old < 0 || state_new - state_old > 0) // changes in status
{
   goto texting3;
}


update_sensor:
sensor1 = digitalRead (BUTTON);   //sensor1
sensor2 = digitalRead (BUTTON1);  //sensor2
sensor3 = digitalRead (BUTTON2);  //sensor3
if (sensor1 == LOW)
   {
     if (sensor2 == LOW)
     {
        if (sensor3 == LOW)
        {
         text3;
         state_new = 3;
         goto status_update2;
        }
        text2;
        state_new = 2;
        goto status_update1;
     }
    text1;
     state_new = 1;
     goto status_update;
   }
else
    {
    state_new = 0;
    }
goto update_sensor;

texting:
        digitalWrite(LED, HIGH);
        Serial.print("Send SMS to ");
        Serial.println(number);
        error=gsm.SendSMS(number,text1);
        Serial.println("SMS sent \n");
        state_old = state_new;
        goto update_sensor;

texting2:
        digitalWrite(LED, HIGH);
        Serial.print("Send SMS to ");
        Serial.println(number);
        error=gsm.SendSMS(number,text2);
        Serial.println("SMS sent \n");
        state_old = state_new;
        goto update_sensor;

texting3:
        digitalWrite(LED, HIGH);
        Serial.print("Send SMS to ");
        Serial.println(number);
        error=gsm.SendSMS(number,text3);
        Serial.println("SMS sent \n");
        state_old = state_new;
        goto update_sensor;

}


        -- below the program in arduino software
     
}

15 comments:

  1. where did you get GSM_Shield.h

    did create your own library?

    ReplyDelete
  2. here.... http://www.myduino.com/index.php?route=product/search&keyword=GSM......

    ReplyDelete
    Replies
    1. I can't seem to find the library that you used. Also, in the images you uploaded, it doesn't look like your IDE recognizes the library you included ...Hmnnnn. The link you shared here goes nowhere either. Could you please share with us how you managed to work the library?

      Delete
  3. the coding.. did you create it by your own?
    actually i'm doing my final year project this semester. would you help me with the coding programming?

    ReplyDelete
  4. hi there,

    can i get this project circuit. i want do this project for this semester..

    u can email me at syam1809@gmail.com..

    kindly appreciate your cooperation.

    ReplyDelete
  5. salam..did you delete the library that already in arduino and then replace with new library. if yes can you give me the lin you download new library for gsm

    ReplyDelete
  6. salam.maaf ganggu..boleh saya dapatkan full litar tuk sistem nie?/
    nie de gunakan siren x??

    ReplyDelete
  7. Can you please give me the schematic design of this project. Im planning to do this in my thesis project. kindly email me at jheniee01@yahoo.com THANK YOU SIR.

    ReplyDelete
  8. can you help me also.im planning to do this also with a little twist on it...can you email me :abellera.vonoliver@yahoo.com

    ReplyDelete
  9. can you help me also.im planning to do this also with a little twist on it...can you email me :abellera.vonoliver@yahoo.com

    ReplyDelete
  10. can you help me also.im planning to do this also with a little twist on it...can you email me :abellera.vonoliver@yahoo.com

    ReplyDelete
  11. Can you please give me the schematic design of this project. raja_buah91@yahoo.com

    ReplyDelete
  12. Hi, I am also doing similar project. Can send me the circuit drawing and other information to endless.star@hotmail.com. Thanks in advance.

    ReplyDelete
  13. Can you please give me the schematic diagram of this project. Im planning to do this in my thesis project. kindly email me at erving.gutib016@yahoo.com THANK YOU SIR.

    ReplyDelete
  14. Can you please give me the schematic design of this project. Im planning to do this in my thesis hobby
    . kindly email me at ranjanapre@gmail.com THANK YOU SIR.

    ReplyDelete