GPS receiver project

Hello everyone,

I am building a GPS receiver for an existing project. The functionality of the receiver would be, to store the data/map of my school's campus. Then, I would like to be able to display the location(change from coordinates) of the building on the lcd display. As the user is carrying the gps receiver,it locates the coordinates to the specific building and displays the name of it within a certain distance. The will receive audible feedback of the location.

I looked up a tutorial from Jeremy Blum, Tutorial 15 for Arduino: GPS Tracking - YouTube . Due to time I am not able to order any parts online. Going by his tutorial, the main parts that are needed are, a gps module, gps shield, micro sd shield, and a arduino mega.

The parts(Sparkfun) that I reserved from Micro Center are below:

http://www.microcenter.com/product/389895/66_Channel_LS20031_GPS_10Hz_Receiver
http://www.microcenter.com/product/392636/Arduino_Mega2560_Rev_3
http://www.microcenter.com/product/389841/microSD_Shield
http://www.microcenter.com/product/389881/GPS_Shield

I am picking up the parts today, minus the gps shield. Is a gps shield a necessity? Will I be able to make the receiver without it? The store is sold outl of it. Also, will an UNO or Mega be needed in order to make the receiver? I still would like to include a lcd display. Regarding the audio feedback, it doesn't have to say the name of the building; it will be just as good if it can make simple 'beeping' noises.

Thanks in advance

Shield is not a necessity - just a convenience. You can add wires to the GPS module and plug them into the Ardiuno.
Just secure everything so nothing is flopping around.
Uno can receive the GPS signals and parse them for location info. Mega will also work.
LCD display can be controlled by Uno.
Tone library can be used to make beeping noises.

Thanks for the advice. I decided to work with the Mega. I am at another crossroads now. I am following the procedure from Sparkfun to quick test the gps module. The test code that was given is below.

void setup() {
  Serial.begin(57600); 
}
void loop() {
  if (Serial.available()) {
    #if ARDUINO >= 100 //For Arduino v1.0+
    Serial.write(Serial.read());
    #else //For Arduino v0023 or earlier
    Serial.print(Serial.read(), BYTE);
    #endif
   }
}

I verified the sketch and there were no errors; but there were errors when I uploaded it. The errors are below.

Binary sketch size: 3,284 bytes (of a 258,048 byte maximum)
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

Any advice of what I am possibly doing wrong?

Update

I ran the code again from above and changed the wiring around a bit. Now, when I upload the sketch, there are no errors and the gps led blinks. I wired it differently than the tutorial on sparkfun.

GPS -> Mega 2560(how I wired it)

pin 5 -> power side: gnd or pwm side: gnd(not sure if one side is important than another)
pin 4 -> nothing
pin 3 -> power side: 3.3 V
pin 2 -> nothing
pin 1 -> communication side: tx3/pin 14

I changed the baud in the serial port. Now, my problem is getting the information written in the port. Nothing shows up at all. The information should be something like this,

$GPGGA,105317.709,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,4C
$GPGLL,8960.0000,N,00000.0000,E,105317.709,V,N
49
$GPGSA,A,1,,,,,,,,,,,,,,,1E
$GPGSV,1,1,00
79
$GPRMC,105317.709,V,8960.0000,N,00000.0000,E,0.00,0.00,010610,,,N78
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N
32

Hello everyone,

I have some major updates. The GPS works now with no problems. The receiver is apart of my senior design project. The LCD display displays the lattitude and longitude live. We used Google maps to find the coordinates around the engineering building to test it out. A piezo is being used for audible feedback; and it works fine. Now, we would like the LCD to display the number of fixed satellites in and out of range. Also, in conjunction with the piezo to make an annoying sound when the satellites are out of range then a normal tone within range. A GPS is most accurate when four satellites are in range. The code is below, I apologize for the lack of comments.

#include <TinyGPS.h>
#include <LiquidCrystal.h>
 
 
TinyGPS gps;
LiquidCrystal lcd(52, 50, 28, 26, 24, 22);
 
 
static void gpsdump(TinyGPS &gps);
static bool feedgps();
static void print_float(float val, float invalid, int len, int prec);
static void print_int(unsigned long val, unsigned long invalid, int len);
static void print_date(TinyGPS &gps);
static void print_str(const char *str, int len);
 
 
 
 
 
 
void setup()
{
 
  lcd.begin(16, 2);
  lcd.print("LON");
  lcd.setCursor(0, 1);
  lcd.print("LAT");
 
  Serial.begin(115200);
  Serial3.begin(57600);
 
  Serial.println();
  Serial.println("Latitude Longitude");
  Serial.println("(deg)    (deg)    ");
  Serial.println("------------------");
}
 
 
void loop()
{
float flat, flon;
  gps.f_get_position(&flat, &flon);
 
 
  bool newdata = false;
  unsigned long start = millis();
 
  // Every second we print an update
  while (millis() - start < 1000)
  {
    if (feedgps())
      newdata = true;
  }
 
  gpsdump(gps);
 
  if (flat<=41.940719 && flat>= 41.93923 && flon>=-88.763013 && flon<=-88.761898)
{
  tone (9,261, 50);
  lcd.print("Engr Bldg");
}
 
 
  lcd.setCursor(4,1);
  lcd.print(flat,5);
 
  lcd.setCursor(4,0);
  lcd.print(flon,5);
}
 
 
static void gpsdump(TinyGPS &gps)
{
  float flat, flon;
  unsigned long age, date, time, chars = 0;
  unsigned short sentences = 0, failed = 0;
  static const float LONDON_LAT = 51.508131, LONDON_LON = -0.128002;
 
 
  gps.f_get_position(&flat, &flon, &age);
  print_float(flat, TinyGPS::GPS_INVALID_F_ANGLE, 9, 5);
  print_float(flon, TinyGPS::GPS_INVALID_F_ANGLE, 10, 5);
 
 
  gps.stats(&chars, &sentences, &failed);
  print_int(chars, 0xFFFFFFFF, 6);
  Serial.println();
 
 
 
}
 
 
 
 
static void print_int(unsigned long val, unsigned long invalid, int len)
{
  char sz[32];
  if (val == invalid)
    strcpy(sz, "*******");
  else
    sprintf(sz, "%ld", val);
  sz[len] = 0;
  for (int i=strlen(sz); i<len; ++i)
    sz[i] = ' ';
  if (len > 0)
    sz[len-1] = ' ';
  Serial.print(sz);
  feedgps();
}
 
 
static void print_float(float val, float invalid, int len, int prec)
{
  char sz[32];
  if (val == invalid)
  {
    strcpy(sz, "*******");
    sz[len] = 0;
        if (len > 0)
          sz[len-1] = ' ';
    for (int i=7; i<len; ++i)
        sz[i] = ' ';
    Serial.print(sz);
  }
  else
  {
    Serial.print(val, prec);
    int vi = abs((int)val);
    int flen = prec + (val < 0.0 ? 2 : 1);
    flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
    for (int i=flen; i<len; ++i)
      Serial.print(" ");
  }
  feedgps();
}
 
 
static void print_date(TinyGPS &gps)
{
  int year;
  byte month, day, hour, minute, second, hundredths;
  unsigned long age;
  gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);
  if (age == TinyGPS::GPS_INVALID_AGE)
    Serial.print("*******    *******    ");
  else
  {
    char sz[32];
    sprintf(sz, "%02d/%02d/%02d %02d:%02d:%02d   ",
        month, day, year, hour, minute, second);
    Serial.print(sz);
  }
  print_int(age, TinyGPS::GPS_INVALID_AGE, 5);
  feedgps();
}
 
 
static void print_str(const char *str, int len)
{
  int slen = strlen(str);
  for (int i=0; i<len; ++i)
    Serial.print(i<slen ? str[i] : ' ');
  feedgps();
}
 
 
static bool feedgps()
{
  while (Serial3.available())
  {
    if (gps.encode(Serial3.read()))
      return true;
  }
  return false;
}

I added this line of code in the void loop and I compiled. But, it doesn't print the correct information.

int satellites = gps.satellites();
  if( satellites > 3)
    {
      Serial.print("number of satellies");Serial.println( gps.satellites() );
    }
  else
    {
    Serial.println ("nothing");
    }

Before that I searched for code that specifically printed the number of satellites

#include <NewSoftSerial.h>
#include <TinyGPS.h>
 
TinyGPS gps;
NewSoftSerial nss(2, 3);
 
void setup()
{
  Serial.begin(115200);
  nss.begin(4800);
 
  Serial.println("TinyGPS Satellite Count Mod Test");
  Serial.println();
}
 
void loop()
{
  if (nss.available())
  {
    if (gps.encode(nss.read()))
    {
      Serial.print("Satellites in view: ");
      Serial.println(gps.satsinview(), DEC);
 
      if (gps.fixtype() == TinyGPS::GPS_FIX_NO_FIX)
      {
        Serial.print("No fix.");
      }
      else
      {
        // we have a fix (could be GPS_FIX_2D or GPS_FIX_3D)
        Serial.print("Fix type: ");
        if (gps.fixtype() == TinyGPS::GPS_FIX_2D)
          Serial.println("2D");
        else
          Serial.println("3D");
 
        Serial.print("Satellites used: ");
        Serial.println(gps.satsused(), DEC);
 
        // You can do the rest of your coding here - e.g. gpsdump()
      }
    }
  }
}

I tested out the above code but, 'satsused' and 'satsinview' were not recognized.

Any suggestions?

You have to install the updated version of TinyGPS that is on that page.

Pete