MiniMod isn't outputting a constant position

I have a minimod hooked to my nano, and frankly the fix is pathetic.

Sitting in exactly the same place, I am getting readings (just from raw data) that are varying by almost 250 feet in longitude and 100 feet in latitude. The 'good fix' LED is illuminated, and I am reading back 'A' as acquired signal.

I bought this GPS because it is listed as accurate to within 9 feet, and I am thus far unimpressed.

Newsoftware serial is from here:

http://sundial.org/arduino/?page_id=61

Is there anything that I am missing? Any help is greatly appreciated.

#include <NewSoftSerial.h>


////////////////////////////////////////////////////////
//                  Declarations                      //
////////////////////////////////////////////////////////

NewSoftSerial SoftSer(2, 3);
boolean gpsupdate(long &lati, long &longi, long &timedec);


////////////////////////////////////////////////////////
//                  Main Program                      //
////////////////////////////////////////////////////////

void setup()
{
  SoftSer.begin(4800);
  Serial.begin(115200);
}

void loop()
{
 
 long latitude;
 long longitude;
 long timedec; 
 
 if (gpsupdate(latitude,longitude,timedec)) {
   gpsprint(latitude,longitude);
 }
}


////////////////////////////////////////////////////////
//           Functions Appear Below                   //
////////////////////////////////////////////////////////

void gpsprint(long lati, long longi){
 long dd;
 long mm;
 dd = lati/1000000;
 mm = abs(lati - dd*1000000);
 Serial.print(dd); Serial.print("."); Serial.print(mm);
 Serial.print(char(9)); 
 dd = longi/1000000;
 mm = abs(longi - dd*1000000);
 Serial.print(dd); Serial.print("."); Serial.print(mm);
 Serial.println("");
}


boolean gpsupdate(long &lati, long &longi, long &timedec){
   
   boolean headerfound = false;
   boolean linefound = false;
   boolean newdata = true;
   
   long oldlat = lati;
   long oldlon = longi;
   
   char header[6] = "GPGGA";
   int verify = 1;
   char newbyte;
   char time[6];
   char lat[9] = "";
   char latdir;
   char lon[10] = "";
   char londir;
   int  posfix;

   while (!linefound) {   
      newbyte = gpsread();
      if (char(newbyte) == header[verify]){
        verify++;
        if(verify = 5) {headerfound = true;}
      }
      else{
        verify = 0; 
      }
     
      if (headerfound){
        dumpnext(6);
        keepnext(time,6);         
        dumpnext(4);
        keepnext(lat,9);
        dumpnext(1);
        latdir = gpsread();
        dumpnext(1);
        keepnext(lon,10);
        dumpnext(1);
        londir = gpsread();
        dumpnext(1);
        posfix = gpsread();
  
        lati = reformat(strtol(lat,NULL,10), latdir);
        longi = reformat(strtol(lon,NULL,10), londir); 
        timedec = strtol(time,NULL,10);      
        headerfound = false;
        linefound = true;
        
        if (lati == oldlat && longi == oldlon){
          newdata = false;
        }
        
      }
  } 
  return newdata;
}


void dumpnext(int number){
 char dumpbit;
  for (int t = 0;t< number;t++){        
    dumpbit = gpsread();    
 } 
}

char gpsread(){
  char gpsdata;
  bool notready = true;
    while (notready)
    {
      if (SoftSer.available()){ 
        gpsdata = SoftSer.read();
        notready = false;
      }
    } 
    return gpsdata;
}

void keepnext(char *returnarray, int number){
  int correction = 0; 
  char databit;
  for(int t = 0;t<number;t++){
       databit = gpsread();
       returnarray[t-correction] = databit;
       if (databit == '.'){
         correction = 1;
       }       
   }
}


long reformat(long measurement, char direc){
  long dd;
  long mmmmmm;
  dd = measurement/1000000;
  dd = dd*1000000;
  mmmmmm = measurement - dd;        
  mmmmmm = mmmmmm/6*10;
  measurement = dd+mmmmmm;  
  if (direc == 'S' || direc == 'W' ){
     measurement = -measurement;
  }
  return measurement;
}

afrey--

I can't speak for your GPS, but I do note that your code appears to be printing the raw GPS position data. If you are noticing variations directly in that, be advised that GPS latitude and longitude are measured not in feet, but in degrees and minutes. Specifically, latitude is in the form ddmm.mmmm and longitude dddmm.mmmm.

The least significant digit is measuring 10000ths of a minute, which is somewhat smaller than a foot.

To test your GPS parsing, you might compare the results with my TinyGPS object.

Mikal

EDIT: Just as an experiment, I ran my GPS for an hour and it drifted +/-60 meters. It was positioned very far from any exterior window, though, so I'd expect this to improve outdoors.

Yeah, right now I am trying to print just raw position data and I am getting the same +/- 60 meters. I've plotted the positions on google earth, so I know its not just moving foot by foot.

I'll give TinyGPS a try and write up how that goes.

Does NewSoftwareSerial ignore any strings being sent? Could that be a problem?