NMEA Parsing!!

Hi to everyone!

  1. i have a problem with the GPS module...i want to know the coordinates (latitude and longitude) and the time-date only in the startup of the arduino (not in the loop)! First of all, i've tried to use the arduino playground code to have the information from the GPS, and it worked!
    Then I instinctively moved the instructions from the loop() to the start(), but now it doesn't work, and i don't know why...and that's it's just what i want!!!!!

  2. Is there a kind of library (that works!) to parse the NMEA strings and have the informations (like date, time, lat, long,...) separately? I use an Arduino Mega, and the communication with the GPS module is not with SoftSerial, but Serial (rxpin 0).

Any suggestion????

Please...help me!

Thanks a lot!!

Angelo

I think the GPS comm needs to loop several times to read all the data. One shot will probably miss the string and need to read the second.

You could put the instructions in a function and run that fucntion for a period of 5 seconds or so. That might even work in the setup if you use a while millis() < 5000, run the GPS instructions...

Which GPS instructions are you using? I was playing with tinyGPS, which worked very well.

Thanks a lot for the suggestion! It seems to work...i've used while (millis()<1000) so i have the information once, and i parsed them in strings (array of chars): time, date, latitude, longitude, status.

I'm using the sketch from Playground... Arduino Playground - GPS

One thing to keep in mind, if the GPS and the Arduino are starting up at the same time, alot of GPS units have a Cold Start time of > 45 seconds.

You might want to set up a function in your setup to keep reading until it has a certain fix on the satellites (3D fix for example), so the data can be close to precise. Maybe use a While loop and test for the number of satellites or the type of fix? Not sure how that works, only played with a GPS shortly.

But I agree, TinyGPS is very easy to use, but it takes up quite a bit of space.