I am new to Arduino and am using MEGA to get data from NEO-6M (hobbyking). I connected my GPS module to PORT 1 and am trying to read serial data. I am getting junk values. Here is my code:
if (Serial1.available() > 0)
Please help me out
Junk values could be a baud rate mismatch. Do you have the serial monitor set to 38400? Are you sure that the GPS defaults to (or is set to) that rate?
I have set the serial monitor to 38400 and have tried all the available baud rates (keeping the serial and serial1 baud rates same). The default value is given as 38400 for factory setting. Link: http://www.hobbyking.com/hobbyking/store/__31135__neo_6m_gps_module.html
Please help me out
The serial and serial1 rates don't have to be the same - indeed it's better if Serial is running faster than the GPS on Serial1 - less chance of overflow.
What does this "junk" data look like?
The data looks like the one attached in the image. I am now using this code with softwareserial.
SoftwareSerial mySerial(10, 11); // RX, TX
// Open serial communications and wait for port to open:
Serial.println(“uBlox Neo 6M”);
// set the data rate for the SoftwareSerial port
void loop() // run over and over
Thanks once again
You need to determine what rate the gps is trying to send serial data to the arduino. The default speed will be in the device datasheet, it is unlikely to be 38000, more likely 9600.
Once you have the device working, then it is usually possible to send a command to it, to change the serial speed. But, you need to start with the default speed it uses when it powers on.
The site he got that GPS from clearly states it would be in default mode at 38.400.
The datasheet of the unit however tells that default is 9600 (as suggested by others).
I have one of those GPS modules and it communicates at 9600 baud.
Hi, it seems you use mega 2560
For GPS data it comes with NMEA sentences, you can use TinyGPS++ library to capture the certain data you are interested in
Here goes the link to download the library together with introduction: TinyGPS++ | Arduiniana
Hope you'll soon have FUN with your GPS module
Plus since NEO 6 gives a goddamn 26s as cold start, just be patient until it gets the data like latitude & longitude