Reception problems in the GPS module signal

Asked

Viewed 217 times

1

I am trying to develop a program to capture coordinates by the GPS module and send the information to a server concatenated in url form, which will handle the information and display my location through the Google Maps API, but at first, I’m testing the sending of the coordinates by SMS, to a specific number, only I’m having a problem receiving the GPS signal, where the coordinates are coming zeroed, and it’s not capturing my real location. It is worth mentioning that I have done individual tests both in the GPS module and in the GSM Shield, and all the two work independently, the problem appears when trying to join the two components. Follows code below:

void setup()
{
  // Serial PC <-> Arduino
  Serial.begin(19200);
  // GsM Arduino <-> GSM
  GsM.begin(19200);
  // GpS Arduino <-> GPS
  GpS.begin(9600);
}

void loop()
{
  envia_sms_gps();
}// end loop

// Funções Gerais

// Envia SMS com link google maps de localização e avisa a tentativa  de furto
void envia_sms_gps()
{
  displayGPSInfo();

// Envia SMS https://maps.google.com/maps?q=(LAT),(LON)
  delay(300);
  GsM.print("AT+CMGF=1"); //mandando SMS em modo texto
  delay(1000);
  GsM.print("AT + CMGS = \"" + num +"\""); // numero que vamos mandar o SMS
  delay(1000);
  GsM.println(data);
  Serial.println(data);
  delay(1000);
  GsM.write(0x1A);
  data="";
  delay(300);
}

// Faz leitura do GPS e pega as coordenadas lat e long, converte os valores float para string e concatena com link do google maps
void displayGPSInfo()
{
  if(gps.location.isValid())
{    
  dado_lat=gps.location.lat();
  dado_lng=gps.location.lng();
  dtostrf(dado_lat,4,4,lat_aux);
  latParaString = String(lat_aux);
  dtostrf(dado_lng,4,4,lng_aux);
  lngParaString = String(lng_aux);
  data+=(server);
  data+=(latParaString);
  data+=",";
  data+=(lngParaString);
}
  delay(300);
}

Below is the output of the program in the Serial Monitor:

inserir a descrição da imagem aqui

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.