GPS Problems

Tips and questions relating to the GPS modules from SFE

Moderator: phalanx

Post Reply
ArtieRiechert
Posts: 4
Joined: Sat Feb 27, 2016 6:04 am

GPS Problems

Post by ArtieRiechert » Sat Feb 27, 2016 6:12 am

Hello I bought a EM-506 module. I used tinygps example simple_test. BTW I checked the wiring it was connected to 2,3 which I set Software Serial to. All it says is that there is no connection and check wiring. I came here for help because this is where I bought it. Please help and thanks.

jremington
Support Volunteer
Posts: 2254
Joined: Fri Jun 15, 2007 9:41 pm
Location: Eugene, Or

Re: GPS Problems

Post by jremington » Sat Feb 27, 2016 6:23 pm

Please describe exactly how you wired the GPS unit, and to what microcontroller.
Please also post the code, using code tags [ code] [ /code] without the blanks.
Describe what the LED indicator does when you power it up and let it sit.

Note that when testing a brand new GPS unit, you must be outside with a clear view of the sky and may have to wait up to 15 minutes for a cold start.

ArtieRiechert
Posts: 4
Joined: Sat Feb 27, 2016 6:04 am

Re: GPS Problems

Post by ArtieRiechert » Sun Feb 28, 2016 9:09 am

Thank you for your reply. I'm using a MEGA 2560. I just wired the first four pins ground, power, receiver, and transmit. Also the LED blinks so I know it must have a lock. This is a tiny gps example library

Code: Select all

#include <SoftwareSerial.h>

#include <TinyGPS.h>

/* This sample code demonstrates the normal use of a TinyGPS object.
   It requires the use of SoftwareSerial, and assumes that you have a
   4800-baud serial GPS device hooked up on pins 2(rx) and 3(tx).
*/

TinyGPS gps;
SoftwareSerial ss(2, 3);

void setup()
{
  Serial.begin(115200);
  ss.begin(4800);
  
  Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
  Serial.println("by Mikal Hart");
  Serial.println();
}

void loop()
{
  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;

  // For one second we parse GPS data and report some key values
  for (unsigned long start = millis(); millis() - start < 1000;)
  {
    while (ss.available())
    {
      char c = ss.read();
      // Serial.write(c); // uncomment this line if you want to see the GPS data flowing
      if (gps.encode(c)) // Did a new valid sentence come in?
        newData = true;
    }
  }

  if (newData)
  {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&flat, &flon, &age);
    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.print(" SAT=");
    Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
    Serial.print(" PREC=");
    Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
  }
  
  gps.stats(&chars, &sentences, &failed);
  Serial.print(" CHARS=");
  Serial.print(chars);
  Serial.print(" SENTENCES=");
  Serial.print(sentences);
  Serial.print(" CSUM ERR=");
  Serial.println(failed);
  if (chars == 0)
    Serial.println("** No characters received from GPS: check wiring **");
} 

jremington
Support Volunteer
Posts: 2254
Joined: Fri Jun 15, 2007 9:41 pm
Location: Eugene, Or

Re: GPS Problems

Post by jremington » Sun Feb 28, 2016 9:58 am

I just wired the first four pins ground, power, receiver, and transmit.
To what?

ArtieRiechert
Posts: 4
Joined: Sat Feb 27, 2016 6:04 am

Re: GPS Problems

Post by ArtieRiechert » Sun Feb 28, 2016 11:52 am

I wired pin 1 (GND) to ground on Arduino MEGA 2560, pin 2 (POWER(5v)) to 5v on Arduino MEGA 2560, pin 3 (RX) to pin 2 on the Arduino MEGA 2560(Digital Pin not Analog), and pin 4 (TX) to pin 3 on Arduino MEGA 2560(Digital Pin not analog). The reason I use pins 2, 3 on the MEGA is because I use Software Serial which allows other pins to be used as tx and rx.

jremington
Support Volunteer
Posts: 2254
Joined: Fri Jun 15, 2007 9:41 pm
Location: Eugene, Or

Re: GPS Problems

Post by jremington » Sun Feb 28, 2016 12:03 pm

With the Mega2560, there are four hardware serial ports. Use one those instead of software serial (it is buggy).
1. Use the correct baud rate for the GPS unit. Unless you have changed the default, 4800 is unlikely to be correct.
2. Wire TX on the GPS unit to RX on the Arduino. Until you have that working, do not connect RX on the GPS to anything.

ArtieRiechert
Posts: 4
Joined: Sat Feb 27, 2016 6:04 am

Re: GPS Problems

Post by ArtieRiechert » Sun Feb 28, 2016 12:58 pm

Thank you for your help. Hardware serial work thanks very much. If you need me to help send me a pm.

Post Reply