element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum I'm having trouble getting my gps shield to work with my arduino
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 10 replies
  • Subscribers 392 subscribers
  • Views 2530 views
  • Users 0 members are here
  • gps logger
  • gps
  • gps_shield
  • arduino
Related

I'm having trouble getting my gps shield to work with my arduino

tlucas756
tlucas756 over 7 years ago

Hello everyone!

So this week i got a Neo-6M GPS shield in the mail, because I need it for a school project. However I'm a newbie when it comes to arduino programming, so I grabbed some code on the internet that said it'd function with this module.

But bad luck; I can't get this gps module to work and display my location, instead it gives me a bunch of characters on the serial monitor that I can't understand...

Could it be a problem with the program? Or maybe the antenna, or the GPS shield itself?

Could you give me some advice to test out?

Thank you!

 

Here's the page I grabbed the code from: Tutorial to Communicate Neo-6M GPS to Arduino : 7 Steps (with Pictures)   And some pictures of my hardware:imageimageimageimage

  • Sign in to reply
  • Cancel

Top Replies

  • tlucas756
    tlucas756 over 7 years ago in reply to rachaelp +1
    Hello rachael, so I messed with the baud rates and found that it starts showing something at 115200 baud. But the gps signal doesn't seem to work; for the record in the code it mentions London so that…
  • gadget.iom
    gadget.iom over 7 years ago +1
    Hi tlucas756 I'm happy to take a look at the code if you are still having issues. If you could like some code-review would you mind pasting it here or attaching it as a txt file or something. I'm very…
  • gadget.iom
    gadget.iom over 7 years ago +1
    Code as attached: #include <TinyGPS++.h> #include <SoftwareSerial.h> /* This sample code demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object. It requires the use of SoftwareSerial, and assumes…
Parents
  • gadget.iom
    gadget.iom over 7 years ago

    Code as attached:

    #include <TinyGPS++.h>
    #include <SoftwareSerial.h>
    /*
      This sample code demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object.
      It requires the use of SoftwareSerial, and assumes that you have a
      4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
    */
    static const int RXPin = 30, TXPin = 31;
    static const uint32_t GPSBaud = 9600;
    
    
    // The TinyGPS++ object
    TinyGPSPlus gps;
    
    
    // The serial connection to the GPS device
    SoftwareSerial ss(RXPin, TXPin);
    
    
    void setup()
    {
     Serial.begin(115200);
     ss.begin(GPSBaud);
    
    
     Serial.println(F("FullExample.ino"));
     Serial.println(F("An extensive example of many interesting TinyGPS++ features"));
     Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
     Serial.println(F("by Mikal Hart"));
     Serial.println();
     Serial.println(F("Sats HDOP Latitude   Longitude   Fix  Date       Time     Date Alt    Course Speed Card  Distance Course Card  Chars Sentences Checksum"));
     Serial.println(F("          (deg)      (deg)       Age                      Age  (m)    --- from GPS ----  ---- to London  ----  RX    RX        Fail"));
     Serial.println(F("---------------------------------------------------------------------------------------------------------------------------------------"));
    }
    
    
    void loop()
    {
     static const double LONDON_LAT = 51.508131, LONDON_LON = -0.128002;
    
    
     printInt(gps.satellites.value(), gps.satellites.isValid(), 5);
     printInt(gps.hdop.value(), gps.hdop.isValid(), 5);
     printFloat(gps.location.lat(), gps.location.isValid(), 11, 6);
     printFloat(gps.location.lng(), gps.location.isValid(), 12, 6);
     printInt(gps.location.age(), gps.location.isValid(), 5);
     printDateTime(gps.date, gps.time);
     printFloat(gps.altitude.meters(), gps.altitude.isValid(), 7, 2);
     printFloat(gps.course.deg(), gps.course.isValid(), 7, 2);
     printFloat(gps.speed.kmph(), gps.speed.isValid(), 6, 2);
     printStr(gps.course.isValid() ? TinyGPSPlus::cardinal(gps.course.value()) : "*** ", 6);
    
    
     unsigned long distanceKmToLondon =
       (unsigned long)TinyGPSPlus::distanceBetween(
         gps.location.lat(),
         gps.location.lng(),
         LONDON_LAT,
         LONDON_LON) / 1000;
     printInt(distanceKmToLondon, gps.location.isValid(), 9);
    
    
     double courseToLondon =
       TinyGPSPlus::courseTo(
         gps.location.lat(),
         gps.location.lng(),
         LONDON_LAT,
         LONDON_LON);
    
    
     printFloat(courseToLondon, gps.location.isValid(), 7, 2);
    
    
     const char *cardinalToLondon = TinyGPSPlus::cardinal(courseToLondon);
    
    
     printStr(gps.location.isValid() ? cardinalToLondon : "*** ", 6);
    
    
     printInt(gps.charsProcessed(), true, 6);
     printInt(gps.sentencesWithFix(), true, 10);
     printInt(gps.failedChecksum(), true, 9);
     Serial.println();
    
     smartDelay(1000);
    
    
     if (millis() > 5000 && gps.charsProcessed() < 10)
       Serial.println(F("No GPS data received: check wiring"));
    }
    
    
    // This custom version of delay() ensures that the gps object
    // is being "fed".
    static void smartDelay(unsigned long ms)
    {
     unsigned long start = millis();
     do
     {
       while (ss.available())
         gps.encode(ss.read());
     } while (millis() - start < ms);
    }
    
    
    static void printFloat(float val, bool valid, int len, int prec)
    {
     if (!valid)
     {
       while (len-- > 1)
         Serial.print('*');
       Serial.print(' ');
     }
     else
     {
       Serial.print(val, prec);
       int vi = abs((int)val);
       int flen = prec + (val < 0.0 ? 2 : 1); // . and -
       flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
       for (int i=flen; i<len; ++i)
         Serial.print(' ');
     }
     smartDelay(0);
    }
    
    
    static void printInt(unsigned long val, bool valid, int len)
    {
     char sz[32] = "*****************";
     if (valid)
       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);
     smartDelay(0);
    }
    
    
    static void printDateTime(TinyGPSDate &d, TinyGPSTime &t)
    {
     if (!d.isValid())
     {
       Serial.print(F("********** "));
     }
     else
     {
       char sz[32];
       sprintf(sz, "%02d/%02d/%02d ", d.month(), d.day(), d.year());
       Serial.print(sz);
     }
    
     if (!t.isValid())
     {
       Serial.print(F("******** "));
     }
     else
     {
       char sz[32];
       sprintf(sz, "%02d:%02d:%02d ", t.hour(), t.minute(), t.second());
       Serial.print(sz);
     }
    
    
     printInt(d.age(), d.isValid(), 5);
     smartDelay(0);
    }
    
    
    static void printStr(const char *str, int len)
    {
     int slen = strlen(str);
     for (int i=0; i<len; ++i)
       Serial.print(i<slen ? str[i] : ' ');
     smartDelay(0);
    }

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • gadget.iom
    gadget.iom over 7 years ago

    Code as attached:

    #include <TinyGPS++.h>
    #include <SoftwareSerial.h>
    /*
      This sample code demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object.
      It requires the use of SoftwareSerial, and assumes that you have a
      4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
    */
    static const int RXPin = 30, TXPin = 31;
    static const uint32_t GPSBaud = 9600;
    
    
    // The TinyGPS++ object
    TinyGPSPlus gps;
    
    
    // The serial connection to the GPS device
    SoftwareSerial ss(RXPin, TXPin);
    
    
    void setup()
    {
     Serial.begin(115200);
     ss.begin(GPSBaud);
    
    
     Serial.println(F("FullExample.ino"));
     Serial.println(F("An extensive example of many interesting TinyGPS++ features"));
     Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
     Serial.println(F("by Mikal Hart"));
     Serial.println();
     Serial.println(F("Sats HDOP Latitude   Longitude   Fix  Date       Time     Date Alt    Course Speed Card  Distance Course Card  Chars Sentences Checksum"));
     Serial.println(F("          (deg)      (deg)       Age                      Age  (m)    --- from GPS ----  ---- to London  ----  RX    RX        Fail"));
     Serial.println(F("---------------------------------------------------------------------------------------------------------------------------------------"));
    }
    
    
    void loop()
    {
     static const double LONDON_LAT = 51.508131, LONDON_LON = -0.128002;
    
    
     printInt(gps.satellites.value(), gps.satellites.isValid(), 5);
     printInt(gps.hdop.value(), gps.hdop.isValid(), 5);
     printFloat(gps.location.lat(), gps.location.isValid(), 11, 6);
     printFloat(gps.location.lng(), gps.location.isValid(), 12, 6);
     printInt(gps.location.age(), gps.location.isValid(), 5);
     printDateTime(gps.date, gps.time);
     printFloat(gps.altitude.meters(), gps.altitude.isValid(), 7, 2);
     printFloat(gps.course.deg(), gps.course.isValid(), 7, 2);
     printFloat(gps.speed.kmph(), gps.speed.isValid(), 6, 2);
     printStr(gps.course.isValid() ? TinyGPSPlus::cardinal(gps.course.value()) : "*** ", 6);
    
    
     unsigned long distanceKmToLondon =
       (unsigned long)TinyGPSPlus::distanceBetween(
         gps.location.lat(),
         gps.location.lng(),
         LONDON_LAT,
         LONDON_LON) / 1000;
     printInt(distanceKmToLondon, gps.location.isValid(), 9);
    
    
     double courseToLondon =
       TinyGPSPlus::courseTo(
         gps.location.lat(),
         gps.location.lng(),
         LONDON_LAT,
         LONDON_LON);
    
    
     printFloat(courseToLondon, gps.location.isValid(), 7, 2);
    
    
     const char *cardinalToLondon = TinyGPSPlus::cardinal(courseToLondon);
    
    
     printStr(gps.location.isValid() ? cardinalToLondon : "*** ", 6);
    
    
     printInt(gps.charsProcessed(), true, 6);
     printInt(gps.sentencesWithFix(), true, 10);
     printInt(gps.failedChecksum(), true, 9);
     Serial.println();
    
     smartDelay(1000);
    
    
     if (millis() > 5000 && gps.charsProcessed() < 10)
       Serial.println(F("No GPS data received: check wiring"));
    }
    
    
    // This custom version of delay() ensures that the gps object
    // is being "fed".
    static void smartDelay(unsigned long ms)
    {
     unsigned long start = millis();
     do
     {
       while (ss.available())
         gps.encode(ss.read());
     } while (millis() - start < ms);
    }
    
    
    static void printFloat(float val, bool valid, int len, int prec)
    {
     if (!valid)
     {
       while (len-- > 1)
         Serial.print('*');
       Serial.print(' ');
     }
     else
     {
       Serial.print(val, prec);
       int vi = abs((int)val);
       int flen = prec + (val < 0.0 ? 2 : 1); // . and -
       flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
       for (int i=flen; i<len; ++i)
         Serial.print(' ');
     }
     smartDelay(0);
    }
    
    
    static void printInt(unsigned long val, bool valid, int len)
    {
     char sz[32] = "*****************";
     if (valid)
       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);
     smartDelay(0);
    }
    
    
    static void printDateTime(TinyGPSDate &d, TinyGPSTime &t)
    {
     if (!d.isValid())
     {
       Serial.print(F("********** "));
     }
     else
     {
       char sz[32];
       sprintf(sz, "%02d/%02d/%02d ", d.month(), d.day(), d.year());
       Serial.print(sz);
     }
    
     if (!t.isValid())
     {
       Serial.print(F("******** "));
     }
     else
     {
       char sz[32];
       sprintf(sz, "%02d:%02d:%02d ", t.hour(), t.minute(), t.second());
       Serial.print(sz);
     }
    
    
     printInt(d.age(), d.isValid(), 5);
     smartDelay(0);
    }
    
    
    static void printStr(const char *str, int len)
    {
     int slen = strlen(str);
     for (int i=0; i<len; ++i)
       Serial.print(i<slen ? str[i] : ' ');
     smartDelay(0);
    }

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube