Hey everyone,

I'm having some trouble configuring my EM-406A to output. About half of the time, the output is just junk. I have 3+ satellites in view, have tried all sorts of different baud rates, and searched all over and can't seem to figure it out. Here's some example output:

Current GPS: 2911.3540,08102.7931
Current GPS: ,,*1.3540,08102.7931
Current GPS: 2911.3528,08102.7938
Current GPS: 179,14,09,,044,15,24
Current GPS: 179,14,09,,044,15,24
Current GPS: 22,30,27,,12,,,,,,,3
Current GPS: 2911.3511,08102.7968

As you can see, the first, third and last are the only correct outputs. Here's the code I'm using on the Mega:

byteGPS = 0;
  i = 0;
  
  while(byteGPS != 42) {                   // read the GGA sentence
    byteGPS = mySerial.read();        
    inBuffer[i]=byteGPS;              
    i++; 
  }
   
  k = 1;
  m1 = 0;
  m2 = 0;
  
  while(inBuffer[k] != 42) {
    k++;
  
    if(k > 17 && k < 27) {
      //Serial.print(inBuffer[k]);            // write the GGA sentence
      currentGPSlat[m1] = inBuffer[k];
      m1++;      
    }
 
     if(k > 29 && k < 40) {
      //Serial.print(inBuffer[k]);            // write the GGA sentence
      currentGPSlong[m2] = inBuffer[k];
      m2++;      
    }   


Even when I'm just outputing the NMEA string, I get either a bunch of commas, or junk in general.

Any troubleshooting advice would be appriciated!

Tags: Arduino, EM406, GPS, Mega

Views: 110

Reply to This

Replies to This Discussion

Is your EM406 in binary mode? (no red LED). If so, that might explain it.
Hi Chris, asides leaving the board alone for a week to let the capacitor drain power... is there any other way to revert it from binary mode?
and why is that you have only 3+ sat ? are you indoors? just wondering , can you post pictures of your setup with some close ups so that someone can help. is it possible for you to take this to say school playground ( bit away from buildings and possible interferences) and test . tell us what you see in data and no of sats
I'm not indoors. I work on it at school and we're surrounded by tall buildings. Sometimes I'll get 4 satellites, but I don't think the problem is that, as I get accurate results sometimes.

The EM406 is not in binary mode. It is blinking red as soon as it locks.
Looks as it should to me for NMEA mode. You have valid ANSI data, so your baud rates and such are fine.

1. With 3 sats you can't get a GPS position unless you've entered a manual altitude.
2. The series of commas: ,,,,, is showing you that the values between those commas is invalid / null.
3. does mySerial.read(); check serial available? You realize that you should check that first, right? And watch for -1 inputs anyway?

I'm assuming that your parsing in mySerial.read is skipping (or trying to) everything except GGA? (I think you are letting other message data past.) And you are confirming the checksum? You might make sure that that routine is more fault tolerant. Never, ever, trust inputs coming from somewhere else.
You're right.

I can't post the GPS results today as there's a nasty thunderstorm, but the raw data comes back as either valid half the time, or the other half the time, as random characters or just commas.

How would I go about checking serial? Or check for -1 inputs? I'm new to programming for the Arduino, so please let me know if there's some integral part I'm missing here.

Thanks for the help.
The reason that I ask is because I suspect your parsing function has a bug in it. Not very familiar with the Arduino, but in one of your lines you have an * character. The gps unit should only transmit that at the end of a nmea sentence, before the checksum. So the reason that you have one in the middle of one of your lines, is interesting.
Right, exactly my thinking. That asterisk is what made me think his parsing is off. Maybe making the assumption that any comma is followed by a valid data byte, reading the next comma as that byte, and losing count ... thus reading in to the next message.
Can you post the unparsed nmea data?
0,0,218,GPGGA,185649.000,2911.3525,N,08102.8378,W,1,04,6.4,-40.6,M,-31.6,M,,0000
0,0,218,3,27,26,15,18,12,,,,,,,,7.0,5.4,4.5
0,0,219,«Væf̖A,2911.3552,N,08102.8370,W,0.51,24.57,250310,,
0,0,219,GPGGA,185659.000,2911.3552,N,08102.8366,W,1,05,5.4,-36.5,M,-31.6,M,,0000
0,0,219,eÌ6,15,18,12,,,,,,,,7.1,5.4,4.5
0,0,219,VvVæf̖A,2911.3551,N,08102.8363,W,0.39,39.73,250310,,
0,0,218,GPGGA,185709.000,2911.3531,N,08102.8364,W,1,05,5.4,-37.8,M,-31.6,M,,0000
0,0,217,4ef˙7,26,15,18,12,,,,,,,,7.1,5.4,4.6
0,0,218,©MC,185715.000,A,2911.3539,N,08102.8356,W,0.32,355.20,250310,,
0,0,218,GPGGA,185719.000,2911.3547,N,08102.8352,W,1,05,5.4,-33.9,M,-31.6,M,,0000
0,0,218,3eÌ6,15,18,12,,,,,,,,7.1,5.4,4.6
0,0,218,š725.000,A,2911.3549,N,08102.8342,W,0.23,50.59,250310,,
0,0,218,GPGGA,185729.000,2911.3550,N,08102.8335,W,1,05,5.4,-30.4,M,-31.6,M,,0000
Ok, we have a few issues:
1. you are getting some weird characters, I don't know if this is from your internet browser or copying/pasting from a terminal program or not. But if these characters are what you are seeing on your live feed, it looks like maybe a clock issue that isn't consistent. If you have an oscilloscope I would probe your tx line on your gps to see how clean it is, and if it looks nasty make sure nothing else is connected to it that could be interfering with the tx line or decrease the length of wire...
2. I assume the MC line got cut off and is actually GPRMC, the A indicates you have an active signal, but I don't know why you would be getting several "," characters in a row.
3. And what is with the 0,0,21x numbers infront of the sentence type? Each sentence should start with a "$" character. I have used this GPS sensor before and have never seen this.
4. And again, there is no "*" character at the end of the sentence. That is weird.

I don't know how you have this hooked up, but if you had it hooked up to your controller when you uploaded this data, can you hook the sensor directly up to your computer (through a max232 or equivelant) and use hyperterminal to verify the data? If this was hooked up through your controller you may have a problem with it, somewhere.
The numbers before are from another sensor (ultrasonic). Sorry about that. I hooked it up to an oscilloscope but not really sure what to look for - it's just sending serial data every second. Any other ideas on what to try? This is driving me nuts.

One thing I forgot to mention is I don't have the 1PPS pin connected. I read this wasn't necessary, but maybe someone can correct me?

And one last thing - the manual mentions setting a software command. I don't think I do anything like that, could someone provide an example of what that would look like for a GGA sentence?

RSS

Groups

© 2012   Created by Chris Anderson.

Badges  |  Report an Issue  |  Terms of Service