SparkFun Forums 

Where electronics enthusiasts find answers.

Tips and questions relating to the GPS modules from SFE
By ArtieRiechert
#188425
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.
By jremington
#188432
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.
By ArtieRiechert
#188434
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 **");
} 
By jremington
#188436
I just wired the first four pins ground, power, receiver, and transmit.
To what?
By ArtieRiechert
#188438
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.
By jremington
#188439
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.
By ArtieRiechert
#188440
Thank you for your help. Hardware serial work thanks very much. If you need me to help send me a pm.