Newbie trying to interface Arduino Mega with Ultimate GPS v3


thanx for reading my message. I'm a newbie here but I have some technical background in general so I hope I can progress on a personal project I have: make a sailing race tool to compute gps, compass & NMEA data.

I'm just starting. I've setup my software, downloaded the GPS library & uploaded sketches. I'm now using the sample sketches with Ultimate GPS. I can see on the serial output the text sent by the Arduino (Mega in my case). However I never see any GPS output data which should be present (I followed some Adafruit tutorials). I have a red blinking LED on the GPS module but no more. I believe it's trying to acquire satellites which it won't because I"m inside my house. However it should still be spitting out data.

Does anybody have any clue about how to debug that?

Thanx ahead for your help!

Does anybody have any clue about how to debug that?

Not until you post your code.
And please use the code button </>

so your code looks like this

and is easy to copy to a text editor


There are diagnostics here that use NeoGPS, a library I wrote. It checks a bunch of things, as long as you've hooked up the right pins (described here) and modified gps_port.h to match.

I assume that you are using the breakout module (wired separately), not the GPS logger shield (stacked)?

How is everything wired? Pics can help, too.

Cheers, /dev

Thanx a lot already for your answers.

Here’s the code:

// Test code for Adafruit GPS modules using MTK3329/MTK3339 driver
// This code just echos whatever is coming from the GPS unit to the
// serial monitor, handy for debugging!
// Tested and works great with the Adafruit Ultimate GPS module
// using MTK33x9 chipset
//    ------>
// Pick one up today at the Adafruit electronics shop 
// and help support open source hardware & software! -ada

#include <Adafruit_GPS.h>
#if ARDUINO >= 100
 #include <SoftwareSerial.h>
  // Older Arduino IDE requires NewSoftSerial, download from:
// #include <NewSoftSerial.h>
 // DO NOT install NewSoftSerial if using Arduino 1.0 or later!

// Connect the GPS Power pin to 5V
// Connect the GPS Ground pin to ground
// If using software serial (sketch example default):
//   Connect the GPS TX (transmit) pin to Digital 3
//   Connect the GPS RX (receive) pin to Digital 2
// If using hardware serial (e.g. Arduino Mega):
//   Connect the GPS TX (transmit) pin to Arduino RX1, RX2 or RX3
//   Connect the GPS RX (receive) pin to matching TX1, TX2 or TX3

// If using software serial, keep these lines enabled
// (you can change the pin numbers to match your wiring):
#if ARDUINO >= 100
  SoftwareSerial mySerial(3, 2);
  NewSoftSerial mySerial(3, 2);
Adafruit_GPS GPS(&mySerial);
// If using hardware serial (e.g. Arduino Mega), comment
// out the above six lines and enable this line instead:
//Adafruit_GPS GPS(&Serial1);

// Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
// Set to 'true' if you want to debug and listen to the raw GPS sentences
#define GPSECHO  true

// this keeps track of whether we're using the interrupt
// off by default!
boolean usingInterrupt = false;
void useInterrupt(boolean); // Func prototype keeps Arduino 0023 happy

void setup()  
  // connect at 115200 so we can read the GPS fast enuf and
  // also spit it out
  Serial.println("Adafruit GPS library basic test!");

  // 9600 NMEA is the default baud rate for MTK - some use 4800
  // You can adjust which sentences to have the module emit, below
  // uncomment this line to turn on RMC (recommended minimum) and GGA (fix data) including altitude
  // uncomment this line to turn on only the "minimum recommended" data for high update rates!
  // uncomment this line to turn on all the available data - for 9600 baud you'll want 1 Hz rate
  // Set the update rate
  // Note you must send both commands below to change both the output rate (how often the position
  // is written to the serial line), and the position fix rate.
  // 1 Hz update rate
  // 5 Hz update rate- for 9600 baud you'll have to set the output to RMC or RMCGGA only (see above)
  // 10 Hz update rate - for 9600 baud you'll have to set the output to RMC only (see above)
  // Note the position can only be updated at most 5 times a second so it will lag behind serial output.

  // Request updates on antenna status, comment out to keep quiet

  // the nice thing about this code is you can have a timer0 interrupt go off
  // every 1 millisecond, and read data from the GPS for you. that makes the
  // loop code a heck of a lot easier!

// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
  char c =;
  // if you want to debug, this is a good time to do it!
  if (GPSECHO)
    if (c) UDR0 = c;  
    // writing direct to UDR0 is much much faster than Serial.print 
    // but only one character can be written at a time. 

void useInterrupt(boolean v) {
  if (v) {
    // Timer0 is already used for millis() - we'll just interrupt somewhere
    // in the middle and call the "Compare A" function above
    OCR0A = 0xAF;
    TIMSK0 |= _BV(OCIE0A);
    usingInterrupt = true;
  } else {
    // do not call the interrupt function COMPA anymore
    TIMSK0 &= ~_BV(OCIE0A);
    usingInterrupt = false;

void loop()                     // run over and over again
   // do nothing! all reading and printing is done in the interrupt

It is the one present on the Adafruit website: Breakout Arduino Wiring | Adafruit Ultimate GPS | Adafruit Learning System

I’m using an Arduino Mega.
I’ve respected the connections on the picture.

On the serial monitor I see the string sent by the Arduino but no more, like if it is receiving nothing from the GPS.
This is why I’d like to check that the communication is working ok.

I’ll look at the NeoGPS project tonight I think.

I’ve got a display and a compass module I want to interface and I’ll check the communication as well after the GPS.

Thanx for your help

I tried NeoGPS but I have basic issue --> won't compile. It screams with:

In file included from C:\xxxxx\Dev\Arduino\libraries\NeoGPS/NMEAGPS.h:24:0,

                 from C:\xxxxx\Dev\Arduino\libraries\NeoGPS\examples\NMEAdiagnostic\NMEAdiagnostic.ino:2:

C:\xxxxx\Dev\Arduino\libraries\NeoGPS/GPSfix.h:121:37: error: 'constexpr' needed for in-class initialization of static data member 'const float gps_fix::KM_PER_NMI' of non-integral type [-fpermissive]

     static const float KM_PER_NMI = 1.852;


C:\xxxxx\Dev\Arduino\libraries\NeoGPS/GPSfix.h:127:37: error: 'constexpr' needed for in-class initialization of static data member 'const float gps_fix::MI_PER_NMI' of non-integral type [-fpermissive]

     static const float MI_PER_NMI = 1.150779;


Utilisation de la bibliothèque NeoGPS prise dans le dossier : C:\xxxxx\Dev\Arduino\libraries\NeoGPS (legacy)
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

It's like it does not like float value.

Regarding the Adafruit library, maybe I'm not using the right PWM pins. I'm using 2,3 like on the example with an Arduino but maybe it's different on a Mega 2560. I can't seem to find information on that but I keep looking.


Well, I guess I did rush a bit too much when I started the project yesterday --> I did not read some comments in the code that were specific to the Arduino Mega. That being read, I can now receive data from the GPS (had to use different RX/TX pins).

However I still can't compile the NeoGPS code and I'd appreciate to use this lib because it seems very light.

Fiddlesticks. I'll have to update it for the new IDE. :-/

Thanks, /dev

Is there anything I can do to bypass this issue for the time being?

Fixt. You just need the latest GPSfix.h

Excellent, it worked like a charm. I now need to take some time to see what I can retrieve for my project. Thanx a lot!!