#7756
Hai,

I have a problem with the gps location. I want to get GPS location when I send a message to the module v3.0.
step that i've done so far and is successful:
#send sms from module v3 to my mobile phone.
#get the GPS location and send it to my mobile phone(without sending sms to activate it)
#control arduino via sms

anyone have solutions or suggestion? thanks
#7762
Hi, thanks for replying.
This is all my code to get the gps location by sending sms to the module :
Code: Select all
#include "gps_gsm_sim908Serial0.h"

const int SensorINPUT=8;
int Buzzer1 = 9;
char inchar;

void setup()
{   
  gps_init ();    //init GPS pin
  Serial.begin (9600);    //serial0 connect computer
  pinMode(SensorINPUT, INPUT);
  pinMode(Buzzer1, OUTPUT);
  digitalWrite (5, HIGH);
  delay (1500);
  digitalWrite (5, LOW);
  delay (1500);
 
  gsm_enable ();
  gps_disable ();
  delay(5000);
 
  Serial.println("AT+CMGD=1,4");                           //Delete all SMS in box
}
 
void loop()

  if(Serial.available()>0)
  {
    inchar=Serial.read();
    if(inchar=='T')
    {
      delay(10);
      inchar=Serial.read();
      if (inchar=='I')                                      //When the GSM module get the message, it will display the sign '+CMTI "SM", 1' in the serial port
      {     
        delay(10);
        Serial.println("AT+CMGR=1");                       //When Arduino read the sign, send the "read" AT command to the module
        delay(10);
      }
    }
    else if (inchar=='L')
    {
      Serial.println("AT+CMGD=1,4");                   //Delete all message
      delay(500);
      delay(10);
      inchar=Serial.read();
      if (inchar=='H')                                     //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it.
      {
        delay(10);
        for(int x=0;x<80;x++)
        {
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            digitalWrite(Buzzer1,LOW);
            delay(100);
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            digitalWrite(Buzzer1,LOW);
            delay(100);
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            digitalWrite(Buzzer1,LOW);
            delay(100);
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            digitalWrite(Buzzer1,LOW);
            delay(100);
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            digitalWrite(Buzzer1,LOW);
            delay(100);
        }       
        Serial.println("AT+CMGD=1,4");                    //Delete all message
        delay(500);
      }
      if (inchar=='L')                                    //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it.
      {
        delay(10);
        start_gps();
        int stat = gps_get_gga ();  // read data from GPS, return 0 is ok
       
        if (stat == 0 || stat == 1)
        {
          if (gps_gga_is_fix ())
          {    //true if fix
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            gsm_set_numble ("0123456789"); // change it to your receiver phone number
            gsm_send_message ("Latitude in Deg/Min  :");
            gsm_send_message (gps_gga_lat_s ());
            gsm_send_message ("Longgitude in Deg/Min :");
            gsm_send_message (gps_gga_long_s ());
            gsm_send_message ("#You can view your loacation on map at http://www.geoplaner.com/");
            gsm_end_send ();
           
          }
        }
        delay(1000);
        Serial.println("AT+CMGD=1,4");
      }
    }
  }
}


The problem is in this part (I sent "LL" to ask the GPS location from the module but the module does not replying anything)
Code: Select all
 if (inchar=='L')                                    //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it.
      {
        delay(10);
        start_gps();
        int stat = gps_get_gga ();  // read data from GPS, return 0 is ok
       
        if (stat == 0 || stat == 1)
        {
          if (gps_gga_is_fix ())
          {    //true if fix
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            gsm_set_numble ("0123456789"); // change it to your receiver phone number
            gsm_send_message ("Latitude in Deg/Min  :");
            gsm_send_message (gps_gga_lat_s ());
            gsm_send_message ("Longgitude in Deg/Min :");
            gsm_send_message (gps_gga_long_s ());
            gsm_send_message ("#You can view your loacation on map at http://www.geoplaner.com/");
            gsm_end_send ();
           
          }
        }


But if i use this code to get the gps location manually (not by sms) it works.
Code: Select all
#include "gps_gsm_sim908Serial0.h"
int Buzzer1 = 9;
void setup () {
  gps_init ();    //init GPS pin
  pinMode(Buzzer1, OUTPUT);
  Serial.begin (9600);    //serial0 connect computer
  digitalWrite (5, HIGH);
  delay (1500);
  digitalWrite (5, LOW);
  delay (1500);
 
  gsm_enable ();
  gps_disable ();
  delay(5000);
}
 
void loop () {
  start_gps();
  int stat = gps_get_gga ();  // read data from GPS, return 0 is ok

  if (stat == 0 || stat == 1) {
    if (gps_gga_is_fix ()) {    //true if fix

      gsm_set_numble ("01234567890"); // change it to your receiver phone number
      gsm_send_message ("Latitude in Deg/Min  :");
      gsm_send_message (gps_gga_lat_s ());
      gsm_send_message ("Longgitude in Deg/Min :");
      gsm_send_message (gps_gga_long_s ());
      gsm_send_message ("#You can view your loacation on map at http://www.geoplaner.com/");
      gsm_end_send ();
      //while (1);
    }
  }
}


Sorry for my english as its not my native language. Hope you can help me. Thanks. :)
#7769
I've tried the library you share, it's very similar to one I shared before, but it's different. However, with the library and your sketch, I could not even start up my module properly, the net LED are flashing again and again, I think it's the problem of the library. Would you mind try again using this one from TEL0051 wiki? Click to download.
#7771
TQ for helping me leff :) ,

I have try this code:
Code: Select all
//#include <gps_gsm_sim908.h>
#include <gps_gsm_sim908Serial0.h>



const int SensorINPUT=8;
int Buzzer1 = 9;
char inchar;

void setup()
{   
  gps_init ();    //init GPS pin
  Serial.begin (9600);    //serial0 connect computer
  pinMode(SensorINPUT, INPUT);
  pinMode(Buzzer1, OUTPUT);
  digitalWrite (5, HIGH);
  delay (1500);
  digitalWrite (5, LOW);
  delay (1500);
 
  gsm_enable ();
  gps_disable ();
  delay(5000);
 
  Serial.println("AT+CMGD=1,4");                           //Delete all SMS in box
}
 
void loop()

  if(Serial.available()>0)
  {
    inchar=Serial.read();
    if(inchar=='T')
    {
      delay(10);
      inchar=Serial.read();
      if (inchar=='I')                                      //When the GSM module get the message, it will display the sign '+CMTI "SM", 1' in the serial port
      {     
        delay(10);
        Serial.println("AT+CMGR=1");                       //When Arduino read the sign, send the "read" AT command to the module
        delay(10);
      }
    }
    else if (inchar=='L')
    {
      Serial.println("AT+CMGD=1,4");                   //Delete all message
      delay(500);
      delay(10);
      inchar=Serial.read();
      if (inchar=='H')                                     //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it.
      {
        delay(10);
        for(int x=0;x<80;x++)
        {
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            digitalWrite(Buzzer1,LOW);
            delay(100);
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            digitalWrite(Buzzer1,LOW);
            delay(100);
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            digitalWrite(Buzzer1,LOW);
            delay(100);
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            digitalWrite(Buzzer1,LOW);
            delay(100);
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            digitalWrite(Buzzer1,LOW);
            delay(100);
        }       
        Serial.println("AT+CMGD=1,4");                    //Delete all message
        delay(500);
      }
      if (inchar=='L')                                    //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it.
      {
        delay(10);
        start_gps();
        int stat = gps_get_gga ();  // read data from GPS, return 0 is ok
       
        if (stat == 0 || stat == 1)
        {
          if (gps_gga_is_fix ())
          {    //true if fix
            digitalWrite(Buzzer1,HIGH);
            delay(100);
            gsm_set_numble ("0173082726"); // change it to your receiver phone number
            gsm_send_message ("Latitude in Deg/Min  :");
            gsm_send_message (gps_gga_lat_s ());
            gsm_send_message ("Longgitude in Deg/Min :");
            gsm_send_message (gps_gga_long_s ());
            gsm_send_message ("#You can view your loacation on map at http://www.geoplaner.com/");
            gsm_end_send ();
           
          }
        }
        delay(1000);
        Serial.println("AT+CMGD=1,4");
      }
    }
  }
}


I tried with the library that you give me.
It can activate the buzzer when I send the "LH" message to the module
but, when I send "LL" that is to get the GPS coordinate, there is noting happen.
and also the network and status indicator is turn off.
#7811
Hai leff,

TQ leff. My problem is not yet solving. I'm try many time to make it reality but it doesn't happen.
I send the 'LL' message to activate the GPS location but it do noting. When I send 'LH' it can activate the buzzer base on the code that I have post at Wed Oct 21, 2015 12:11 pm.

I really want to solve this problem because this function is the most important part in my project.
#7824
aliabulolipop123 wrote:Hai leff,

TQ leff. My problem is not yet solving. I'm try many time to make it reality but it doesn't happen.
I send the 'LL' message to activate the GPS location but it do noting. When I send 'LH' it can activate the buzzer base on the code that I have post at Wed Oct 21, 2015 12:11 pm.

I really want to solve this problem because this function is the most important part in my project.


Yes, I also tried to combine the two sample sketches together, the SMS control LED on the wiki, and the send GPS info by SMS sharing sketch.

But I also made several attampt, still failed. Never mind, I will work on it till it be done.
#7866
Hi,

It's been so long, I did it once I send a message "HH" to the module, I will receive its GPS location after several minutes in outside.

But it's not stable, sometimes, i need to send 4 messages to it to get one reply, I will go on it and keep updating. ;)