Pages: [1]   Go Down
Author Topic: GPS help, please  (Read 431 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi guy, im having a problem with my gps tracking decive.im using Icomsat v1.1 and arduino gps shield.i want to receive a gps coordinate to my mobile phone using this code.

#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
#include "call.h"
#include <SoftwareSerial.h>
#include <TinyGPS.h>
CallGSM call;
SMSGSM sms;
TinyGPS gps;
SoftwareSerial ss(4, 5);


char number[20];
byte stat=0;
int value=0;
int pin=1;
char value_str[5];

void setup()
{
  pinMode(pin,INPUT);
  Serial.begin(115200);
  ss.begin(9600);
  Serial.println("GSM Shield testing.");
  if (gsm.begin(2400))
 
  Serial.println("\nstatus=READY");
  else Serial.println("\nstatus=IDLE");
};

void loop()
{

  stat=call.CallStatusWithAuth(number,0,0);
 
   if(stat==CALL_INCOM_VOICE_AUTH)
   {
    call.HangUp();
   
    delay(2000);
   
    value=digitalRead(1);

    itoa(value,value_str,10);
  
    sms.SendSMS("+60134440132","Device Coordinate is :");
   }
  delay(1000);
 
  bool newData = false;
  for (unsigned long start = millis(); millis() - start < 1000;)
  {
    while (ss.available())
    {
      char c = ss.read();
    
      if (gps.encode(c))
        newData = true;
    }
  }

  if (newData)
  {
    float flat, flon;
    gps.f_get_position(&flat, &flon);
    Serial.print("LAT=");
    Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(" LON=");
    Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    Serial.println();
  }
};
 

but i did not receive the gps coordinate coordinate.please help me..
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 240
Posts: 24462
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but i did not receive the gps coordinate coordinate.
Where is your GPS test code?

Where are your [code] [/code] tags?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this code im use for gsm shield for itead studio:

#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
#include "call.h"

CallGSM call;
SMSGSM sms;

char number[20];
byte stat=0;
int value=0;
int pin=1;
char value_str[5];

void setup()
{
  pinMode(pin,INPUT);
 
  Serial.begin(9600);
  Serial.println("GSM Shield testing.");
 
  if (gsm.begin(2400))
  Serial.println("\nstatus=READY");
  else
  Serial.println("\nstatus=IDLE");
};

void loop()
{

  stat=call.CallStatusWithAuth(number,0,0);

  if(stat==CALL_INCOM_VOICE_AUTH){
   
    call.HangUp();
    delay(2000);
   
    value=digitalRead(1);
   
    itoa(value,value_str,10);
 
    sms.SendSMS("+60134440132","Device Coordinate is :");
  }
  delay(1000);
};


and this is code for my gps arduino shield:

#include <SoftwareSerial.h>
#include <TinyGPS.h>
TinyGPS gps;
SoftwareSerial ss(4, 5);

void setup()
{
  Serial.begin(115200);
  ss.begin(9600);
}

void loop()
{
  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;
 
  for (unsigned long start = millis(); millis() - start < 1000;)
  {
    while (ss.available())
    {
      char c = ss.read();

      if (gps.encode(c))
      newData = true;
    }
  }

  if (newData)
  {
    float flat, flon;
    gps.f_get_position(&flat, &flon);
    Serial.print("LAT=");
    Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(" LON=");
    Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);

  }
 
  gps.stats(&chars, &sentences, &failed);
  Serial.print(" CHARS=");
  Serial.print(chars);
  Serial.print(" SENTENCES=");
  Serial.print(sentences);
  Serial.print(" CSUM ERR=");
  Serial.println(failed);
}

my project is about gps tracking device using gps and gsm module.my gsm shield will sending sms having the current coordinate of the gps device.both code works, however i dont know how to combine them both and receive the gps coordinate(lat and lon).please someone help me...

Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 551
Posts: 46265
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You want to get GPS data. You want to send SMSs. You want to send an SMS that contains GPS data, The correct place to start is generally not step 3.

Create a sketch that gets GPS data. Do NOT go on to step 2 until that sketch works.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

gps sketch>>

#include <SoftwareSerial.h>
#include <TinyGPS.h>
TinyGPS gps;
SoftwareSerial ss(4, 5);

void setup()
{
  Serial.begin(115200);
  ss.begin(9600);
}

void loop()
{
  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;
 
  for (unsigned long start = millis(); millis() - start < 1000;)
  {
    while (ss.available())
    {
      char c = ss.read();

      if (gps.encode(c))
      newData = true;
    }
  }

  if (newData)
  {
    float flat, flon;
    gps.f_get_position(&flat, &flon);
    Serial.print("LAT=");
    Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(" LON=");
    Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);

  }
 
  gps.stats(&chars, &sentences, &failed);
  Serial.print(" CHARS=");
  Serial.print(chars);
  Serial.print(" SENTENCES=");
  Serial.print(sentences);
  Serial.print(" CSUM ERR=");
  Serial.println(failed);
}

output>>

LAT=3.089210 LON=101.506263 CHARS=268 SENTENCES=2 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=536 SENTENCES=4 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=804 SENTENCES=6 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=1072 SENTENCES=8 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=1538 SENTENCES=10 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=1806 SENTENCES=12 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=2074 SENTENCES=14 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=2342 SENTENCES=16 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=2610 SENTENCES=18 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=3076 SENTENCES=20 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=3344 SENTENCES=22 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=3612 SENTENCES=24 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=3880 SENTENCES=26 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=4148 SENTENCES=28 CSUM ERR=0
LAT=3.089210 LON=101.506263 CHARS=4614 SENTENCES=30 CSUM ERR=0
LAT=3.089220 LON=101.506317 CHARS=4892 SENTENCES=32 CSUM ERR=0
LAT=3.089220 LON=101.506340 CHARS=5170 SENTENCES=34 CSUM ERR=0
LAT=3.089230 LON=101.506347 CHARS=5448 SENTENCES=36 CSUM ERR=0
LAT=3.089230 LON=101.506362 CHARS=5726 SENTENCES=38 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=6192 SENTENCES=40 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=6460 SENTENCES=42 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=6728 SENTENCES=44 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=6996 SENTENCES=46 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=7264 SENTENCES=48 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=7730 SENTENCES=50 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=7998 SENTENCES=52 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=8266 SENTENCES=54 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=8534 SENTENCES=56 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=8802 SENTENCES=58 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=9268 SENTENCES=60 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=9536 SENTENCES=62 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=9804 SENTENCES=64 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=10072 SENTENCES=66 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=10340 SENTENCES=68 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=10806 SENTENCES=70 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=11074 SENTENCES=72 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=11342 SENTENCES=74 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=11610 SENTENCES=76 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=11878 SENTENCES=78 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=12344 SENTENCES=80 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=12610 SENTENCES=82 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=12878 SENTENCES=84 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=13144 SENTENCES=86 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=13410 SENTENCES=88 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=13876 SENTENCES=90 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=14144 SENTENCES=92 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=14412 SENTENCES=94 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=14680 SENTENCES=96 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=14948 SENTENCES=98 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=15414 SENTENCES=100 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=15682 SENTENCES=102 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=15950 SENTENCES=104 CSUM ERR=0
LAT=3.089220 LON=101.506332 CHARS=16218 SENTENCES=106 CSUM ERR=0
LAT=3.089220 LON=101.506401 CHARS=16496 SENTENCES=108 CSUM ERR=0

thx PaulS..
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 551
Posts: 46265
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK. That's step one. Do you also have a sketch that sends SMSs? Yes or no. No need to post it.

If so, what have you tried in terms of combining them, and what happens when you execute it?
Logged

Offline Offline
Edison Member
*
Karma: 35
Posts: 1429
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You still need to DO THIS

Pete
Logged

Where are the Nick Gammons of yesteryear?

Pages: [1]   Go Up
Jump to: