0

Recently I bought a GPS module (ublox neo-6M-0-001) for my Arduino Mega 2560. I connected Vcc and Gnd (LED at GPS module glows blue and sometimes blinking).

GPS module RX port is connected to the Arduino's TX3, Port 14. GPS module TX port is connected to the Arduino's RX3, Port 15.

As a first step I just want to print the serial data received from the GPS module:

#include "SoftwareSerial.h"

SoftwareSerial mySerial(15, 14); // RX, TX

void setup() {
  Serial.begin(9600);
  Serial.println("uBlox Neo 6M Test");
  mySerial.begin(9600);
}

void loop() {
   if (mySerial.available())
     Serial.write(mySerial.read());
}

Saldy, there is no data received from the GPS module. According to the datasheet the baud rate 9600 seems to be correct.

Do I need to configure the GPS module somehow before it delivers data? Do I need to buy an external antenna?

Thanks for your help.

2 Answers 2

3

The Arduino Mega 2560 has three additional hardware serial ports. Why not use one of them instead? Serial1 on pins 19 (RX) and 18 (TX).

void setup()
{
  Serial.begin(9600);
  Serial.println("uBlox Neo 6M Test");
  Serial1.begin(9600);
}

void loop() // run over and over
{
  if (Serial1.available())
     Serial.write(Serial1.read());
}

Cheers!

3
  • Wow. Very good. If I use the keyword Serial1 instead of the library SoftwareSerial it works perfect. But I don't understand whats wrong with the library.
    – Freude
    Feb 7, 2016 at 18:55
  • Actually I think it is simply an invalid pin for SoftwareSerial RX. The source code says "Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69". Feb 7, 2016 at 19:02
  • You could use Serial3 on pins 15 (RX) and 14 (TX). Feb 7, 2016 at 19:04
-1

I am also using the sam setup i.e Arduino Mega and NEO6VM2. The GPS module works perfectly fine with a Arduino Uno but when using Mega there are no CharsRX received i.e the Mega is not receiving anything. Please I need help urgently.

1
  • If you want help, then first of all you should ask a proper question and not post it as an answer to another question. Please learn how to use this site: arduino.stackexchange.com/tour
    – jfpoilpret
    May 14, 2017 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.