GPS no satellites

hi

I have Arduino Mega and hexTronik 1575-R A GPS. I

I found a code online and download their headerfile. the code keep printing 0 satelite found.

hi

I have Arduino Mega and hexTronik 1575-R A GPS. I want use this to know my location.

I found a code online and download their headerfile. the code keep printing 0 satelite found.

I have connect TX pin of GPS to arduino rx pin 15 and RX pin of GPS to arduino tx pin 14.

the code is below.

#include "TinyGPS++.h"
#include "SoftwareSerial.h"

SoftwareSerial serial_connection(14,15); //RX=pin 10, TX=pin 11
TinyGPSPlus gps;//This is the GPS object that will pretty much do all the grunt work with the NMEA data
void setup()
{
  Serial.begin(9600);//This opens up communications to the Serial monitor in the Arduino IDE
  serial_connection.begin(9600);//This opens up communications to the GPS
  Serial.println("GPS Start");//Just show to the monitor that the sketch has started
  Serial.println("Satellite Count:");
  Serial.println(gps.satellites.value());
}

void loop()
{
  while(serial_connection.available())//While there are characters to come from the GPS
  {
    gps.encode(serial_connection.read());//This feeds the serial NMEA data into the library one char at a time
  }
  if(gps.location.isUpdated())//This will pretty much be fired all the time anyway but will at least reduce it to only after a package of NMEA data comes in
  {
    //Get the latest info from the gps object which it derived from the data sent by the GPS unit
    Serial.println("Satellite Count:");
    Serial.println(gps.satellites.value());
    Serial.println("Latitude:");
    Serial.println(gps.location.lat(), 6);
    Serial.println("Longitude:");
    Serial.println(gps.location.lng(), 6);
    Serial.println("Speed MPH:");
    Serial.println(gps.speed.mph());
    Serial.println("Altitude Feet:");
    Serial.println(gps.altitude.feet());
    Serial.println("");
  }
}

1035700564: I have connect TX pin of GPS to arduino rx pin 15 and RX pin of GPS to arduino tx pin 14.

Softwareserial constructor takes rx,tx. Your wiring is backwards.

wildbill:
Your wiring is backwards.

+1

After switching your wires, you may still have trouble, because you are printing too much.

I would also suggest using AltSoftSerial on pins 8 & 9 for the GPS device. SoftwareSerial is very inefficient, because it disables interrupts for long periods of time. This will interfere with other parts of your sketch.

If you really can’t use pins 8 & 9, you should use my NeoSWSerial. It is almost as good as AltSoftSerial, and it works at baud rates 9600, 19200 and 38400.

I would also suggest my NeoGPS library. It’s smaller, faster and more accurate than all other libraries. The library and example programs are structured so that you would print information (or do other work) when the GPS device is done sending characters for a little while, during the GPS quiet time. Your current sketch will try to print while the GPS device is still sending characters.

Here is your sketch, modified to use NeoGPS and AltSoftSerial:

#include <NMEAGPS.h>
#include <AltSoftSerial.h>

AltSoftSerial gpsPort; // GPS TX to pin 8, GPS RX to pin 9
NMEAGPS gps;

void setup()
{
  Serial.begin(9600);
  gpsPort.begin(9600);
  
  Serial.println( F("GPS Start") );  // F macro saves RAM
}

void loop()
{
  if (gps.available( gpsPort ))
  {
    //Get the latest info from the gps object which it derived from the data sent by the GPS unit
    gps_fix fix = gps.read();

    Serial.print( F("Satellite Count:") );
    if (fix.valid.satellites)
      Serial.print( fix.satellites );
    Serial.print( F("\nLatitude:") );
    if (fix.valid.location)
      Serial.print( fix.latitude(), 6 );
    Serial.print( F("\nLongitude:") );
    if (fix.valid.location)
      Serial.print( fix.longitude(), 6 );
    Serial.print( F("\nSpeed MPH:") );
    if (fix.valid.speed)
      Serial.print( fix.speed_mph() );
    Serial.print( F("\nAltitude Meters:") );
    if (fix.valid.altitude)
      Serial.print( fix.altitude());
    Serial.println();
  }
}

The original sketch uses 8956 bytes of program space and 610 bytes of RAM.
The NeoGPS version uses 8730 bytes of program space and 420 bytes of RAM

If you want to try it, it is also available from the Arduino IDE Library Manager, under the menu Sketch → Include Library → Manage Libraries. Be sure to read the Troubleshooting page for other tips.

Cheers,
/dev

I am using the Uno and have a similar problem. I used the direct hookup bypassing the Uno to make sure I had the NEMA sentence coming in and I do. However, when I use one of the many example programs to parse the data, all I get is zeroes. Any ideas? Thank you.

I had the NEMA sentence coming in

Was it mostly empty data, like

    $GPRMC,123519,A,,,,,,,230394,003.1,W*5F

That means the GPS device is connected correctly and you have the correct baud rate, but you do not have good satellite reception. Check the antenna connection and get closer to a window or go outside. The first fix could take 10 minutes or more.

You could also try NMEAdiagnostic.ino or NMEA.ino, but I suspect you do not have good reception.

I used the direct hookup bypassing the Uno

Then you switched TX and RX to try a sketch, right?

Cheers, /dev

Hey Guys thanks for answering. Yes my NEMA sentenxe is loaded with all the data - lat, lon, alt, time, everything that was supposed to be there so I know I have the data stream coming in. Then when I try to route it through the Uno all I get in several of the programs is the header labels. I switched the Rx and TX but no diff. I'm not sure what I'm doing wrong but whatever it is it is consistent with all of the programs tried. Should I post the code of one of the programs for a look by you smarter guys? ??? JBB

You tried NeoGPS? It won't output zeros or asterisks. Try the NMEAsimple.ino, and edit it to use the correct serial port and baud.

Yes, I just found the NeoGPS and can't wait to try it. Trouble is I'm out of town and have to get back home first. I'll update as soon as I try it and thank you.

I know this is an easy answer but I just got the NeoGPS downloaded and when I look at the unzipped file there is no .h or .cpp file in it. Also, the README file is a .MD. Am I supposed to be able to read this? Thank you. JBB

Hey dev,

I just noticed my library files are pretty much the way their supposed to be with a couple of issues.

First of all, the .cpp files are there with the .cpp file extension but the H file is also there without the extension. What’s up with that, the file has no extension but loads the library just like it was there?

Secondly, the NeoGPS folder unzipped didn’t give the two files .h and .cpp and when included in a program gave a #include<NMEAGPS.h> label in the program.

The NeoSWSerial folder has the .cpp file but the .h file is the one with no extension.

The Neo files obviously are doing something different. Thank you for your great explanations.

Thank you. JBB

Just follow the NeoGPS Install instructions or re-read reply #3. All the NeoGPS source code is in a subdirectory called src.

NeoSWSerial is a typical Arduino library that you simply unzip into Arduino\Libraries directory. That would create Arduino\Libraries\NeoSWSerial-master directory, which you can rename to Arduino\Libraries\NeoSWSerial, if you want.

If you're on Windows, you may have selected a Windows Explorer option to "Hide extensions for known file types", under View -> Options -> Change Folder and Search Options, in the View tab.

Dev

Thank you for that explanation! JBB

Hi, I got this error message when uploading the basic GPS sketch which bypasses the Arduino to check for GPS signal. Any idea what the problem is?

Arduino: 1.8.2 (Windows 7), Board: "Arduino/Genuino Uno"

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

An error occurred while uploading the sketch

For anyone else who sees an erroe like this, I think this is due to incorrect wiring. I switched the rx and tx pins and I have a steady GPS sentence stream coming out! JBB

I have loaded, compiled and run a GPS sketch and then loaded a new GPS sketch which gives the following error message. I switch back to the previously run sketch and it compiles and runs again no problem. My computer says com3 is active. Any ideas what is wrong? Thank you. JBB

Arduino: 1.8.2 (Windows 7), Board: “Arduino/Genuino Uno”

Sketch uses 8098 bytes (25%) of program storage space. Maximum is 32256 bytes.
Global variables use 586 bytes (28%) of dynamic memory, leaving 1462 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can’t open device “\.\COM3”: Access is denied.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Do you have two IDE windows open at the same time? Be sure to close the Serial Monitor windows before uploading.

You don't have GPS TX connected to Arduino pin 0 while uploading, right?

Yeah dev, I was committing all those errors!!! Thank you.
Great hints for me to correct immediately.
And, I noticed the altitude readout varies considerably over the course of a day/night cycle.
Right now we are in a decreasing mode from a max height earlier in the day. The difference in altitude is around 100 to 150 feet. I know the earth isn’t round but I’m just sitting here in one place. What’s up?

It's just the typical GPS jitter. It's a random walk around your 3D position (lat,lon,alt).

Hi Dev,

I loaded the code you had suggested to someone else and, using the hints you gave earlier, it loaded and ran pretty well. Questions I have:

  1. I am getting Latitude: 39,957431 and
    Longitude: -860180660.01

even though 6 digits are asked for (I believe) with this - “Serial.print( fix.longitude(), 6 ); ?” Do I do some math to get it to typical units for location? Hints for that?

  1. Is there a source of commands for the GPS so I can change units, i.e. Meters to Feet, etc?

  2. I am trying to use this GPs for location while I record “g” loads and occasionally add location. Is there a simple way to ask for elapsed time so that every 10 seconds I could have it stop recording and start over?

Thank you.

#include <NMEAGPS.h>
#include <AltSoftSerial.h>

AltSoftSerial gpsPort; // GPS TX to pin 8, GPS RX to pin 9
NMEAGPS gps;

void setup()
{
Serial.begin(9600);
gpsPort.begin(9600);

Serial.println( F(“GPS Start”) ); // F macro saves RAM
}

void loop()
{
if (gps.available( gpsPort ))
{
//Get the latest info from the gps object which it derived from the data sent by the GPS unit
gps_fix fix = gps.read();

Serial.print( F(“Satellite Count:”) );
if (fix.valid.satellites)
Serial.print( fix.satellites );
Serial.print( F("\nLatitude:") );
if (fix.valid.location)
Serial.print( fix.latitude(), 6 );
Serial.print( F("\nLongitude:") );
if (fix.valid.location)
Serial.print( fix.longitude(), 6 );
//Serial.print( F("\nSpeed MPH:") );
//if (fix.valid.speed)
Serial.print( fix.speed_mph() );
Serial.print( F("\nAltitude Meters:") );
if (fix.valid.altitude)
Serial.print( fix.altitude());
Serial.println();
Serial.println();
}
}