Another NEO-6M Issue...

Hi ladies and gents, new member here, long time interest in the arduino having used pic microcontrollers back in the day while I was doing my undergrad in electronic engineering, but only recently bought the arduino mega 2560, absolutely loving it so far, however...

I seem to be having an issue connecting a ublox neo-6m GY-GPS6MV2 module up for a near space balloon project i'm working on. Basically i'm running an extremely simple program from Rui Santos to power the module and receive NMEA data which should then be displayed in the serial window. I'm receiving no data.

The module, as i'm sure you know, has 4 connections vcc, which I've connected to 5v. The board has the 3v3 regulator so don't worry. GND, tx which goes to the arduino rx and rx to the arduino tx. I'm receiving the flashing light to indicate there is satellite lock, so everything looks good. But no data being received.

Baud rate is 9600, which I believe is the default rate for the neo. Anyone have any idea what i'm doing wrong, because i'm about getting ready to throw the bloody thing in the sea >:(

#include <SoftwareSerial.h>

// The serial connection to the GPS module
SoftwareSerial ss(4, 3);

void setup(){
  Serial.begin(9600);
  ss.begin(9600);
}

void loop(){
  while (ss.available() > 0){
    // get the byte data from the GPS
    byte gpsData = ss.read();
    Serial.write(gpsData);
  }
}

Module:

Not sure if you can make out the picture, red and black are +5v and ground. Yellow is TX to pin 3 (RX), and orange is RX to pin 4 (TX)

Hi, and welcome to the forum.

Don't use SoftwareSerial with a Mega.
It has three spare hardware serial ports.
There is an MultiSerial example in the IDE showing you how to use them.
Leo..

Thanks for the reply Wawa, i'm curious if using a hardware serial port would make any difference, surely I should still be getting something on the serial monitor using the software serial?

That being said, i've never used the hardware serial ports before so i'm not sure how the code should look. From the example, I think it reads from serial1 (pins 18/19) then passes that info to serial0 which passes it back to the computer so it can be read on the serial monitor?

void setup() {
  // initialize both serial ports:
  Serial.begin(9600);
  Serial1.begin(9600);
}

void loop() {
  // read from port 1, send to port 0:
  if (Serial1.available()) {
    int inByte = Serial1.read();
    Serial.write(inByte);
  }

  // read from port 0, send to port 1:
  if (Serial.available()) {
    int inByte = Serial.read();
    Serial1.write(inByte);
}

Then:
NEO -> Arduino
Vcc -> 5v
TX -> TX1 pin 18
RX -> RX1 pin 19
GND -> 0v

Seems very strange to me that TX/RX should go to TX1/RX1 and not crossed over, but the schematic says it's like this so...

A good place to check when stuff such as software serial does not work is the 'Arduino software serial reference' (Google it), there you will find the reason your program does not work;

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, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).

Seems you have found another error in the Arduino tutorials.
Yes, the TX/RX lines should AFAIK be crossed.
Never connected a GPS module to an Arduino, but I think only the TX line from the module is relevant for GPS data.
Could take a while (~20min) for a relocated (from China) GPS to start working.
Give it a clear view of the sky for at least that time.
Leo..

I have used a lot of GPSs with Arduinos, and yes they all needed RX and TX crossed.

A GPS from cold, with a good clear view of the sky should get a fix in typically 40 seconds. However if a GPS has backup and last had a fix less than four hours ago, it might aquire a new fix in 5 seconds or so.

I say typically 40 seconds because some will be slightly faster, say 30 seconds maybe and some slower maybe 60 seconds.

A GPS that takes longer than 60 seconds to get a fix from cold is suspect in my exeperience and it matters little where they came from or were manufactured or when last used.

If a GPS takes more than 2 minutes to get a fix from cold then either it or its antenna is poor quality or broken, might as well bin it.

The ones that do take longer then 2 minutes to get a fix, because their antennas are bad, are easy to spot by checking the satellite signal strengths in the GPGSV sentence, they will be showing as very weak.

There are so many elements to a complete GPS project. All need to work. I feel the best approach is to understand each element and know the cues that tell you each is working (or not). It's not hard to prove each element but you need to be systematic in your troubleshooting.

The GPS LED is flashing. I have a receiver that flashes until it gets a fix, then goes steady when it has a fix. I have one that does exactly the opposite. This is a function of the board design not of the actual receiver. I haven't located a data sheet for any of the GPS modules I have (the boards, not the receivers which are all u-blox neo6M. The u-blox data sheets are available).

Immediately after powering, the module will not have a fix, so whatever the LED is doing, it is saying "no fix".

If the LED is going (flashing or steady) then you have to assume the receiver is working and trying to pick up satellite signals. It will be putting NMEA sentences onto its TX pin, fix or no fix. Check that no component on the module is hot.

You need to see those sentences. Do this without using a sketch. Three simple ways:

  1. if the board has a USB connection, connect it to your computer; use Windows Device Manager to see its port number (USB cable MUST be one that carries data, not just a charging cable) open the IDE monitor on the same port; data shud appear (if garbage, change baud setting)

  2. connect the GPS module to an Arduino board (as already pointed out VCC,GND and TX are all you need); I have a non-genuine UNO and the GPS TX pin MUST connect to this UNO's TX pin (pin 1); I ignore the pin labels and observe the LEDS labelled TX & RX; connect the Arduino's RESET pin to GND to kill its sketch; open the monitor and see the sentences

  3. connect the GPS to a bluetooth module (VCC,GND, TX and RX); no Arduino involved; open a bluetooth serial terminal app on a smart phone, connect and read the NMEA sentences on the phone

All of these methods give the satisfaction of knowing you understand each element and are managing it, rather than stumbling in the dark.

There's a fourth method: connect it to u-blox's u-center software. Much more fun than the monitor.

John.

my first thought is always: does the serial monitor rate in the box at the bottom right of the serial monitor match the rate of Serial in void setup()?

srnet:
A good place to check when stuff such as software serial does not work is the 'Arduino software serial reference' (Google it), there you will find the reason your program does not work;

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, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).

FIXED!

You, my good man, are a life saver! Never realised pins 4 and 3 on the mega were not change interrupt enabled. In my foolish arduino noobishness, I just assumed because it worked on pin 3/4 on the UNO that all the UNO features would be on the MEGA. I put the NEO TX to the MEGA RX on pin 12 and it worked right away!

Hi,
Welcome to the forum.

It would be good if you posted your COMPLETE code rather than snippets.
Its only because your screen capture mentions it, that you are using the TinyGPS++ library in your code.

Thanks.. Tom.. :slight_smile: