Help with GPS EM506 and Arduino Mega

Hi,

Here’s my setup. I have my GPS Module EM506 attached to the GPS Breakout Board. Here’s the setup:

Pin 1 of the breakout board is connected to GRND on Arduino.
Pin 2 is connected to VIN on Arduino (5V doesn’t work for some reason?).
Pin 3 is connected to Pin 2 on Arduino (PWM)
Pin 4 is connected to Pin 3 on Arduino (PWM)

I am using an Arduino Mega 2560.

Here’s the code that I’m using:

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
/*
   This sample sketch 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 = 4, TXPin = 3;
static const uint32_t GPSBaud = 4800;

// 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("DeviceExample.ino"));
  Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module"));
  Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println(F("by Mikal Hart"));
  Serial.println();
}

void loop()
{
  // This sketch displays information every time a new sentence is correctly encoded.
  while (ss.available() > 0)
    if (gps.encode(ss.read()))
      displayInfo();

  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected: check wiring."));
    while(true);
  }
}

void displayInfo()
{
  Serial.print(F("Location: ")); 
  if (gps.location.isValid())
  {
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 6);
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F("  Date/Time: "));
  if (gps.date.isValid())
  {
    Serial.print(gps.date.month());
    Serial.print(F("/"));
    Serial.print(gps.date.day());
    Serial.print(F("/"));
    Serial.print(gps.date.year());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F(" "));
  if (gps.time.isValid())
  {
    if (gps.time.hour() < 10) Serial.print(F("0"));
    Serial.print(gps.time.hour());
    Serial.print(F(":"));
    if (gps.time.minute() < 10) Serial.print(F("0"));
    Serial.print(gps.time.minute());
    Serial.print(F(":"));
    if (gps.time.second() < 10) Serial.print(F("0"));
    Serial.print(gps.time.second());
    Serial.print(F("."));
    if (gps.time.centisecond() < 10) Serial.print(F("0"));
    Serial.print(gps.time.centisecond());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.println();
}

It just tells me that no GPS is detected, “check wiring”. However, on the GPS module itself I can see the LED blinking, which according to this datasheet means it’s found my position.

Thank you for the help!

ps: The cable that I have doesn’t fit the GPS breakout very well, why is that? What cables should I get?
pss: I’m very new to all this, please be nice haha

GPS Pin 4 is the GPS TX pin. It should be connected to the Mega pin 19 (RX1) so you can use Serial1, not SoftwareSerial.

You should be careful, because this GPS module is a 3.3V module, while the Arduino uses 5V. You should use "level shifting" to connect the GPS TX and RX pins to the Arduino (connecting VCC and GROUND are ok).

It is safe to connect the GPS TX pin to the Arduino RX1 pin (the Arduino can safely use the lower-voltage output by the GPS). You may not get good data because the GPS voltage is almost too low. It works for some people.

It is not safe to connect the GPS RX pin to the Arduino TX1 pin, because the 5V output by the Arduino is above the maximum 3.6V into the GPS module. You only need this connection if you send configuration commands to the GPS module.

Here is a link about level shifting with a few discrete parts (resistors and a diode) or a Level-shifting module that you buy.

I would also suggest my NeoGPS library. It is smaller, faster, more reliable and more accurate than all other libraries. You can install it from the IDE Library Manager (Sketch -> Include Library -> Manage Libraries) or download the ZIP from the link.

NeoGPS will use Serial1 on a Mega by default (pins 18 and 19). This is much, much more efficient than a "software" serial port on pins 2 & 3. Much. ;) There are a total of 4 hardware serial ports on the Mega: Serial, Serial1, Serial2 and Serial3. This allows you to avoid SoftwareSerial, which is very inefficient.

The NeoGPS examples (start with File -> Examples -> NeoGPS -> NMEA) are structured so that they are easier to modify. Many people have trouble modifying other libraries' examples.

Cheers, /dev

Hi,

Thanks for your answer! Right now here’s my setup (going from Arduino to GPS Breakout):

GND → Pin 1 GPS
VIN → Pin 2 GPS
Pin 19 (TX2) → 10K Resistor → Pin 3 GPS (RX)
Pin 18 (RX1) → 1K Resistor → 10K Resistor → Pin 4 GPS (TX)

I’ve modified it according to the link you sent me.
I’m running your library, and I’m using the program called “NMEA”, but it still doesn’t work. Any ideas?

I seem to not be understanding something :confused: Again, the GPS is blinking but no data on Serial Monitor. This is last thing that appears

 Status,UTC Date/Time,Lat,Lon,Hdg,Spd,Alt,Sats,Rx ok,Rx err,Rx chars,
NMEA.INO: started
  fix object size = 31
  gps object size = 84
Looking for GPS device on Serial1

GPS quiet time is assumed to begin after a RMC sentence is received.
  You should confirm this with NMEAorder.ino

Status,UTC Date/Time,Lat,Lon,Hdg,Spd,Alt,Sats,Rx ok,Rx err,Rx chars,

Thank You!

VIN → Pin 2 GPS

That should be 5V (not Vin) to GPS pin 2.

Pin 19 (TX2) → 10K Resistor → Pin 3 GPS (RX)

? That should be pin 19 (TX1) to a voltage divider (two resistors, review the link).

Pin 18 (RX1) → 1K Resistor → 10K Resistor → Pin 4 GPS (TX)

?? What is that? You can’t use two resistors that add to 11k?!?

Reply 6 at that link has the schematic. It’s OK to use nothing instead of the pull up resistor/diode for Arduino RX1 to GPS TX, but you have to use the divider for Arduino TX1 to GPS RX (2 resistors to gnd, gps rx tapped at the middle). Some people use a resistor (1K to 4.7K) between TX1 and GPS RX.