Gps neo 6m not showing any data after interfacing with arduino mega

I have uploaded my program to my arduino mega 2560,done all the connections but nothing happening.
The only thing that is seen in the serial monitor is the void setup()
Serial.println("The GPS Receeved Signal");

Nothing happens after this.

Here is my code:

#include <TinyGPS.h>
//long   lat,lon; // create variable for latitude and longitude object
float lat,lon;
TinyGPS gps; // create gps object

void setup(){
Serial.begin(57600); // connect serial
Serial.println("The GPS Received Signal:");
Serial1.begin(115200); // connect gps sensor

}
 
void loop(){
    while(Serial1.available()){ // check for gps data
    if(gps.encode(Serial1.read()))// encode gps data
    { 
    gps.f_get_position(&lat,&lon); // get latitude and longitude

    Serial.print("Position: ");
    
    //Latitude
    Serial.print("Latitude: ");
    Serial.print(lat,6);
    
    Serial.print(",");
    
    //Longitude
    Serial.print("Longitude: ");
    Serial.println(lon,6); 
    
   }
  }
}
Serial1.begin(115200); // connect gps sensor

I have two Neo6M GPS units and both are 9600 baud which is the default baud rate.

A super simple test code to check the connection between the Mega and GPS.

void setup()
{
   Serial.begin(115200);
   Serial1.begin(9600);
}

void loop()
{
   if (Serial1.available())
   {
      Serial.print(char(Serial1.read()));
   }
}

You should see something like:

$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,00*79
$GPGLL,,,,,,V,N*64
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,00*79
$GPGLL,,,,,,V,N*64

groundFungus:
A super simple test code to check the connection between the Mega and GPS.

void setup()

{
  Serial.begin(115200);
  Serial1.begin(9600);
}

void loop()
{
  if (Serial1.available())
  {
      Serial.print(char(Serial1.read()));
  }
}




Nothing happening

You should see something like:


$GPRMC,,V,,,,,,,,,,N53
$GPVTG,,,,,,,,,N
30
$GPGGA,,,,,,0,00,99.99,,,,,,48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99
30
$GPGSV,1,1,0079
$GPGLL,,,,,,V,N
64
$GPRMC,,V,,,,,,,,,,N53
$GPVTG,,,,,,,,,N
30
$GPGGA,,,,,,0,00,99.99,,,,,,48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99
30
$GPGSV,1,1,0079
$GPGLL,,,,,,V,N
64

groundFungus:

Serial1.begin(115200); // connect gps sensor

I have two Neo6M GPS units and both are 9600 baud which is the default baud rate.

Changed to 9600 but still nothing

groundFungus:

Serial1.begin(115200); // connect gps sensor

I have two Neo6M GPS units and both are 9600 baud which is the default baud rate.

I also got two Gps neo 6m modules i intend to have them on one arduino but still the same issue.
So i decided to test only one gps module but nothing except the

void setup(){
Serial.println("The GPS Received Signal")
}

Below is my connection diagram with two gps modules.and my code

//Connect with pin 18 and 19
#include <TinyGPS.h>
//long   lat,lon; // create variable for latitude and longitude object
float lat,lon;
TinyGPS gps1; // create gps object
TinyGPS gps 2;
void setup(){
Serial.begin(57600); // connect serial
Serial.println("The GPS Received Signal:");
Serial1.begin(9600); // connect gps sensor
Serial2.begin(9600); // connect gps sensor
}
 
void loop(){
    while(Serial1.available()){ // check for gps data
    if(gps.encode(Serial1.read()))// encode gps data
    { 
    gps.f_get_position(&lat,&lon); // get latitude and longitude

    Serial.print("Position: ");
    
    //Latitude
    Serial.print("Latitude: ");
    Serial.print(lat,6);
    
    Serial.print(",");
    
    //Longitude
    Serial.print("Longitude: ");
    Serial.println(lon,6); 
    
   }
  

}
 
    while(Serial2.available()){ // check for gps data
    if(gps2.encode(Serial2.read()))// encode gps data
    { 
    gps2.f_get_position(&lat,&lon); // get latitude and longitude

    Serial.print("Position: ");
    
    //Latitude
    Serial.print("Latitude: ");
    Serial.print(lat,6);
    
    Serial.print(",");
    
    //Longitude
    Serial.print("Longitude: ");
    Serial.println(lon,6); 
    
   }
  }
}

How is it that with 64 posts, you still don't understand that you need to provide links to the modules you are using, and post a wiring diagram?

Get one GPS module working alone, with simple example code, before doing something more complex.

What baud rate do you have set in your serial monitor window?

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Have you got;
Mega Tx connected to 6M Rx
Mega Rx connected to 6M Tx.

Tom.... :slight_smile:

please tell us you did not connect TX to RX and RX to RX

“RX to RX”...
tracing the wires on the picture posted at #5, that looks like exactly what OP did on both units.

Also OP - it looks like you’re using green wire for Ground. Are you sure that’s plugged into the ground pin on the mega? It’s hard to tell from the photo but looks like it might be in the wrong spot. Double check.

steve20016:
What baud rate do you have set in your serial monitor window?

57600

jremington:
How is it that with 64 posts, you still don't understand that you need to provide links to the modules you are using, and post a wiring diagram?

Get one GPS module working alone, with simple example code, before doing something more complex.

Also tried single connection but experienced the same ..
No data

alexmunala:
57600

Here is a picture

steve20016:
“RX to RX”...
tracing the wires on the picture posted at #5, that looks like exactly what OP did on both units.

Also OP - it looks like you’re using green wire for Ground. Are you sure that’s plugged into the ground pin on the mega? It’s hard to tell from the photo but looks like it might be in the wrong spot. Double check.

Yes i have double checked the connection its okay

The code you showed in the first post will not produce any output until the GPS gets a fix, that will need the GPS to be outdoors likely.

The code in post #2 is what to use as a test, you should get output from the GPS indoors or out, fix or no-fix.

Note that this code outputs to the serial monitor at 115200 baud, so thats what you need to set the serial monitor baud rate to, not 57600 baud as you seem to have done.

srnet:
The code you showed in the first post will not produce any output until the GPS gets a fix, that will need the GPS to be outdoors likely.

The code in post #2 is what to use as a test, you should get output from the GPS indoors or out, fix or no-fix.

Note that this code outputs to the serial momitor at 115200 baud, so thats what you need to set the serial monitor baud rate to, not 57600 baud as you seem to have done.

I believe my gps got a fix because i can see a blue light blinking.
But the code in #2 outputs nothing...same to my code #1 ,no output but ive got a fix for my gps

Hi

The Arduino Mega has three additional serial ports: Serial1 on pins 19 (RX) and 18 (TX), Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX)

Pin 19 is Rx on the Mega, in your picture Pin 19 is the orange wire, and it goes to Rx on the GPS.....
Pin 18 is Tx on the Mega, in your picture Pin 18 is yellow wire, and it goes to Tx on the GPS....
WRONG.
Pin 19 Rx goes to Tx on the GPS.
Pin 18 Tx goes to Rx on the GPS.


Tom... :slight_smile:

alex,

the red wire providing power to the GPS board -- is that connected to the Mega 3.3v or 5v pin. I can't tell from your photo, it could be either.

when you say the blue light is blinking -- is it blinking at about once per second or faster than that?

john.

"RX to RX"...
tracing the wires on the picture posted at #5, that looks like exactly what OP did on both units.

I think you missed the point in what I was saying. You can’t have RX-RX. It won’t work.

RX on one side must connect to TX on the other.

See reply #17 above.