GPS is not working

Hello everyone
I am using neo 6m GPS with the Arduino Mega 2560.
My connections are:
Ard-->GPS
3.3v-->Vcc
GND-->GND
pin 0 (RX) --> TX
pin 1 (TX) --> RX

my code is
#include <SoftwareSerial.h>

SoftwareSerial ss(1, 0);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
ss.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
Serial.pri
while (ss.available()){
// get the byte data from the GPS
Serial.write(ss.read());
}
}

I removed the RX TX connections before uploading the code and again connected
But there no output in the serial monitor. Not even a single character.

I have 3 gps modules and its the same for all of them. I waited for 1 hour for each gps module but there was no progress. NO GPS module LED blinking. and no RX TX LED on Arduino blinking.
Could you please guide me??

You are useing SoftwareSerial, but you have connected your GPS to the hardware Serial
pins on your Mega. These pins are used by the normal Serial.print.
Your loop() has a problem with the Serial.pri ????
Try to use other pins and try to use TinyGPS++.h with a lot of esamples
/ffur

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use [color = red]code tags[/color] (the </> icon above the compose window) to make it easier to read and copy for examination

Why are you using software serial on a board that has spare hardware serial ports?

1 Like

Then which port should I use?

Serial1, Serial2 or Serial3.

1 Like

So for same hardware connections my code should look like

void setup() {

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

void loop() {

while (Serial1.available()){

Serial.write(Serial1.read());
}
}

Right

No, you should connect your GPS to the Serial1 pins (45, 46) and not the Serial pins (0, 1).

1 Like

Thank you John for suggestion but on my arduino mega
19 18 are RX1 TX1,
17 16 are RX2 TX2,
15 14 are RX3 TX3,
so I connected RX and TX of GPS module to TX1 and RX1 respectively. Then I got the readings on serial monitor.
and I just used Serial1 instead of ss of Software Serial.

Final code looks like this.

int GPSBaud = 9600;
void setup() {
  Serial.begin(9600);

  Serial1.begin(GPSBaud);
}

void loop() { 
  while(Serial1.available()){
    Serial.write(Serial1.read());
  }
}

Thank you

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.