GPS fail!!

Hello, I am an arduino user who is going crazy!!
I had an gpsloggershield with EM-411 two months ago and I can't make it work

The gps module have a led which indicate me there have the possition found but tere is nothing in my computer screen. There is no coordinates, I only can read there "searching" but I can wait hours and hours and there is nothing to do. Please help me!!

there's the program:

#include <NewSoftSerial.h>
#include <TinyGPS.h>

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

TinyGPS gps;
NewSoftSerial nss(0, 1);

void gpsdump(TinyGPS &gps);
bool feedgps();
void printFloat(double f, int digits = 2);

void setup()
{
Serial.begin(115200);
nss.begin(4800);

Serial.print("Testing TinyGPS library v. "); Serial.println(TinyGPS::library_version());
Serial.println("by Mikal Hart");
Serial.println();
Serial.print("Sizeof(gpsobject) = "); Serial.println(sizeof(TinyGPS));
Serial.println();
}

void loop()
{
bool newdata = false;
unsigned long start = millis();

// Every 5 seconds we print an update
while (millis() - start < 5000)
{
if (feedgps())
newdata = true;
}

if (newdata)
{
Serial.println("Acquired Data");
Serial.println("-------------");
gpsdump(gps);
Serial.println("-------------");
Serial.println();
}
}

void printFloat(double number, int digits)
{
// Handle negative numbers
if (number < 0.0)
{
Serial.print('-');
number = -number;
}

// Round correctly so that print(1.999, 2) prints as "2.00"
double rounding = 0.5;
for (uint8_t i=0; i<digits; ++i)
rounding /= 10.0;

number += rounding;

// Extract the integer part of the number and print it
unsigned long int_part = (unsigned long)number;
double remainder = number - (double)int_part;
Serial.print(int_part);

// Print the decimal point, but only if there are digits beyond
if (digits > 0)
Serial.print(".");

// Extract digits from the remainder one at a time
while (digits-- > 0)
{
remainder *= 10.0;
int toPrint = int(remainder);
Serial.print(toPrint);
remainder -= toPrint;
}
}

void gpsdump(TinyGPS &gps)
{
long lat, lon;
float flat, flon;
unsigned long age, date, time, chars;
int year;
byte month, day, hour, minute, second, hundredths;
unsigned short sentences, failed;

gps.get_position(&lat, &lon, &age);
Serial.print("Lat/Long(10^-5 deg): "); Serial.print(lat); Serial.print(", "); Serial.print(lon);
Serial.print(" Fix age: "); Serial.print(age); Serial.println("ms.");

feedgps(); // If we don't feed the gps during this long routine, we may drop characters and get checksum errors

gps.f_get_position(&flat, &flon, &age);
Serial.print("Lat/Long(float): "); printFloat(flat, 5); Serial.print(", "); printFloat(flon, 5);
Serial.print(" Fix age: "); Serial.print(age); Serial.println("ms.");

feedgps();

gps.get_datetime(&date, &time, &age);
Serial.print("Date(ddmmyy): "); Serial.print(date); Serial.print(" Time(hhmmsscc): "); Serial.print(time);
Serial.print(" Fix age: "); Serial.print(age); Serial.println("ms.");

feedgps();

gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);
Serial.print("Date: "); Serial.print(static_cast(month)); Serial.print("/"); Serial.print(static_cast(day)); Serial.print("/"); Serial.print(year);
Serial.print(" Time: "); Serial.print(static_cast(hour)); Serial.print(":"); Serial.print(static_cast(minute)); Serial.print(":"); Serial.print(static_cast(second)); Serial.print("."); Serial.print(static_cast(hundredths));
Serial.print(" Fix age: "); Serial.print(age); Serial.println("ms.");

feedgps();

Serial.print("Alt(cm): "); Serial.print(gps.altitude()); Serial.print(" Course(10^-2 deg): "); Serial.print(gps.course()); Serial.print(" Speed(10^-2 knots): "); Serial.println(gps.speed());
Serial.print("Alt(float): "); printFloat(gps.f_altitude()); Serial.print(" Course(float): "); printFloat(gps.f_course()); Serial.println();
Serial.print("Speed(knots): "); printFloat(gps.f_speed_knots()); Serial.print(" (mph): "); printFloat(gps.f_speed_mph());
Serial.print(" (mps): "); printFloat(gps.f_speed_mps()); Serial.print(" (kmph): "); printFloat(gps.f_speed_kmph()); Serial.println();

feedgps();

gps.stats(&chars, &sentences, &failed);
Serial.print("Stats: characters: "); Serial.print(chars); Serial.print(" sentences: "); Serial.print(sentences); Serial.print(" failed checksum: "); Serial.println(failed);
}

bool feedgps()
{
while (nss.available())
{
if (gps.encode(nss.read()))
return true;
}
return false;
}

In my computer screen appears:

Testing TinyGPS library v. 10

by Mikal Hart

Sizeof(gpsobject) = 103

...and that's all! :frowning:
Please help me!!

If you're using an uno, this doesn't look good:

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

TinyGPS gps;
NewSoftSerial nss(0, 1);

That would mean you're trying to use the same pins for the GPS as for your serial monitor. What pins is the gps attached to?

I have an arduino duemilanove and there are the pin 0 to read and 1 to trans,
I have cheated the pin 2 to connect to ground too

I think the wires are properly connected, the problem should de in program or in library.

thanks :slight_smile:

The same issue exists with the duemilanove. You need to move the gps connections to different pins, say 3 & 4 and configure nss appropriately, ie

NewSoftSerial nss(3, 4);

I have done those changes and there is doing the same

thanks for your help :slight_smile:

Have you been able to get any response from the GPS module in some way yet ?

If not, without the micro controller in the arduino-board, you could use it as a USB<-> ttl rs232 converter.
By attaching the GPSmodule to pins 0/1 and opening the terminal-window at the right speed, it should be possible to check whether the module transmits any data.

If not, without the micro controller in the arduino-board

You can leave the micro in the circuit, just upload the code below which "disables" the serial ports and lets you connect directly to serial monitor. You only need to hook the Tx line up from the GPS but make sure you connect the GPS Tx to the Arduino Tx (not the Rx).

void setup(){
  pinMode(0,INPUT);
  digitalWrite(0,LOW);
  pinMode(1,INPUT);
  digitalWrite(1,LOW);
}

void loop(){
  while(1);
}

I can't understand why is not running because the GPS's led is blinking and it show us the posittion is found. I will try connect it to RS232 this weekend.

thanks to everyone to help me
.... this arduino module is killing me.... :slight_smile:

Did you try the sketch I posted above to see if you are getting valid NMEA sentences on the screen?

Please, pardon me because I can't understand yu're saying very well. I am not an arduino expert, I only have it for six months and there are too many things I have to learn. Can you explain it step by step?

thanks a lot :slight_smile:

#include <NewSoftSerial.h>
#include <TinyGPS.h>

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

TinyGPS gps;
NewSoftSerial nss(3, 4);

void gpsdump(TinyGPS &gps);
bool feedgps();
void printFloat(double f, int digits = 2);

void setup()
{
  Serial.begin(115200);
  nss.begin(4800);
  
  Serial.print("Testing TinyGPS library v. "); Serial.println(TinyGPS::library_version());
  Serial.println("by Mikal Hart");
  Serial.println();
  Serial.print("Sizeof(gpsobject) = "); Serial.println(sizeof(TinyGPS));
  Serial.println();
}

void loop()
{
  // I HAVE CHANGED IT false->true
  bool newdata = true;
  unsigned long start = millis();

  // Every 5 seconds we print an update
  while (millis() - start < 5000)
  {
    if (feedgps())
      newdata = true;
  }
  
  if (newdata)
  {
    Serial.println("Acquired Data");
    Serial.println("-------------");
    gpsdump(gps);
    Serial.println("-------------");
    Serial.println();
  }
}

void printFloat(double number, int digits)
{
  // Handle negative numbers
  if (number < 0.0)
  {
     Serial.print('-');
     number = -number;
  }

  // Round correctly so that print(1.999, 2) prints as "2.00"
  double rounding = 0.5;
  for (uint8_t i=0; i<digits; ++i)
    rounding /= 10.0;
  
  number += rounding;

  // Extract the integer part of the number and print it
  unsigned long int_part = (unsigned long)number;
  double remainder = number - (double)int_part;
  Serial.print(int_part);

  // Print the decimal point, but only if there are digits beyond
  if (digits > 0)
    Serial.print("."); 

  // Extract digits from the remainder one at a time
  while (digits-- > 0)
  {
    remainder *= 10.0;
    int toPrint = int(remainder);
    Serial.print(toPrint);
    remainder -= toPrint; 
  } 
}

void gpsdump(TinyGPS &gps)
{
  long lat, lon;
  float flat, flon;
  unsigned long age, date, time, chars;
  int year;
  byte month, day, hour, minute, second, hundredths;
  unsigned short sentences, failed;

  gps.get_position(&lat, &lon, &age);
  Serial.print("Lat/Long(10^-5 deg): "); Serial.print(lat); Serial.print(", "); Serial.print(lon); 
  Serial.print(" Fix age: "); Serial.print(age); Serial.println("ms.");
  
  feedgps(); // If we don't feed the gps during this long routine, we may drop characters and get checksum errors

  gps.f_get_position(&flat, &flon, &age);
  Serial.print("Lat/Long(float): "); printFloat(flat, 5); Serial.print(", "); printFloat(flon, 5);
  Serial.print(" Fix age: "); Serial.print(age); Serial.println("ms.");

  feedgps();

  gps.get_datetime(&date, &time, &age);
  Serial.print("Date(ddmmyy): "); Serial.print(date); Serial.print(" Time(hhmmsscc): "); Serial.print(time);
  Serial.print(" Fix age: "); Serial.print(age); Serial.println("ms.");

  feedgps();

  gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);
  Serial.print("Date: "); Serial.print(static_cast<int>(month)); Serial.print("/"); Serial.print(static_cast<int>(day)); Serial.print("/"); Serial.print(year);
  Serial.print("  Time: "); Serial.print(static_cast<int>(hour)); Serial.print(":"); Serial.print(static_cast<int>(minute)); Serial.print(":"); Serial.print(static_cast<int>(second)); Serial.print("."); Serial.print(static_cast<int>(hundredths));
  Serial.print("  Fix age: ");  Serial.print(age); Serial.println("ms.");
  
  feedgps();

  Serial.print("Alt(cm): "); Serial.print(gps.altitude()); Serial.print(" Course(10^-2 deg): "); Serial.print(gps.course()); Serial.print(" Speed(10^-2 knots): "); Serial.println(gps.speed());
  Serial.print("Alt(float): "); printFloat(gps.f_altitude()); Serial.print(" Course(float): "); printFloat(gps.f_course()); Serial.println();
  Serial.print("Speed(knots): "); printFloat(gps.f_speed_knots()); Serial.print(" (mph): ");  printFloat(gps.f_speed_mph());
  Serial.print(" (mps): "); printFloat(gps.f_speed_mps()); Serial.print(" (kmph): "); printFloat(gps.f_speed_kmph()); Serial.println();

  feedgps();

  gps.stats(&chars, &sentences, &failed);
  Serial.print("Stats: characters: "); Serial.print(chars); Serial.print(" sentences: "); Serial.print(sentences); Serial.print(" failed checksum: "); Serial.println(failed);
}
  
bool feedgps()
{
  while (nss.available())
  {
    if (gps.encode(nss.read()))
      return true;
  }
  return false;
}

and it returns:

Testing TinyGPS library v. 10

by Mikal Hart

Sizeof(gpsobject) = 103

Acquired Data


Lat/Long(10^-5 deg): 999999999, 999999999 Fix age: 4294967295ms.

Lat/Long(float): 10000.00000, 10000.00000 Fix age: 4294967295ms.

Date(ddmmyy): 0 Time(hhmmsscc): 4294967295 Fix age: 4294967295ms.

Date: 0/0/2000 Time: 198:96:72.95 Fix age: 4294967295ms.

Alt(cm): 999999999 Course(10^-2 deg): 999999999 Speed(10^-2 knots): 999999999

Alt(float): 10000000.00 Course(float): 10000000.00

Speed(knots): 10000000.00 (mph): 11507795.00 (mps): 5144444.00 (kmph): 18520000.00

Stats: characters: 0 sentences: 0 failed checksum: 0


Acquired Data


Lat/Long(10^-5 deg): 999999999, 999999999 Fix age: 4294967295ms.

Lat/Long(float): 10000.00000, 10000.00000 Fix age: 4294967295ms.

Date(ddmmyy): 0 Time(hhmmsscc): 4294967295 Fix age: 4294967295ms.

Date: 0/0/2000 Time: 198:96:72.95 Fix age: 4294967295ms.

Alt(cm): 999999999 Course(10^-2 deg): 999999999 Speed(10^-2 knots): 999999999

Alt(float): 10000000.00 Course(float): 10000000.00

Speed(knots): 10000000.00 (mph): 11507795.00 (mps): 5144444.00 (kmph): 18520000.00

Stats: characters: 0 sentences: 0 failed checksum: 0


Is written "Supports NMEA 0183 data protocol" in datasheet

....I think this shield is not friendly :slight_smile:

I'm not sure which shield you're using (you have yet to specify), but if it's the Adafruit shield, your pin assignments are incorrect.

Try this:

NewSoftSerial mySerial =  NewSoftSerial(2, 3);

If you're using power control, you will also need to output that pin to ground (pin 4 in the Adafruit shield).

It's not very helpful to say the 'shield is not friendly' when you haven't gotten around to telling us WHICH shield you're using. We're guessing blindly in the dark here.

I have an arduino duemilanove with adafruit gps logger shield
gps module is an EM-411
pin 3 is Rx
pin 4 is Tx
pin 2 is ground

The reason this doesn't work is because the GPS module (EM-411) is not compatible with the shield. If you look on Adafruit's website she lists the EM-406a as being the compatable Global Sat GPS engine. Electrically they are pretty much the same but the difference is with the connector, more specifically pins 3 and 4. On the EM-411 pin 3 is Tx and pin 4 is Rx, on the EM-406a they are opposite (the rest are the same with the exception of the optional PPS on pin 6). After looking at the schematic I see she uses a buffer on the GPS Rx line (probably for voltage level conversion) and I don't believe it's bidirectional so you can't simply swap the pins on NewSoftSerial.

My advice (use at your own risk) is to swap the lines on the GPS connector for pins 3 and 4 and everything should work just fine after that.

I have changed them, and it didn't worked
I dont know if it not work because I have broken it making the connection wrong or if is not compatible at all

aaahggg!! :slight_smile:

thanks for your help :slight_smile:

Couple things. Where exactly did you swap the wires? Also can you take a clearer picture of the area where the white wires are soldered to the board?

I hope you can see it well because there are too many wires with the same colour in a small place

Aren't you supposed to set Digital Pin 2 to ground to turn the GPS on? Also where did you switch the wires at...the white wires or at the 6 pin connector that plugs into the board?

The pin 2 is conected to ground under atmel processor as it is show here:

http://www.ladyada.net/make/gpsshield/directconnect.html

I have connected:
Option 2. Wiring using an Arduino