Show Posts
Pages: 1 ... 16 17 [18] 19
256  Forum 2005-2010 (read only) / Interfacing / Garmin GPS on: July 25, 2008, 07:34:37 am
Hello

So I got some troubles getting the right data from a Garmin GPS:
First I plugged the Garmin to the PC to get some NMEA Data:

$GPGGA,121638,4724.0053,N,00830.5565,E,1,04,4.0,510.6,M,48.0,M,,*48
$GPGLL,4724.0053,N,00830.5565,E,121638,A,A*43
$GPBOD,,T,,M,,*47
$GPBWC,121638,,,,,,T,,M,,N,,A*74
$GPVTG,222.4,T,221.7,M,0.0,N,0.0,K*4E
$GPXTE,A,A,,,N,A*51
$PGRME,16.8,M,12.3,M,20.8,M*1B
$PGRMZ,1659,f*3F
$PGRMM,CH-1903*44
$HCHDG,221.7,,,0.7,E*28

That was what he sent to me every second.

Now i saw that this line is important:
$GPGGA,121638,4724.0053,N,00830.5565,E,1,04,4.0,510.6,M,48.0,M,,*48

I used the GPS Tutorial on the Arduino Website but without any success.
I just changed the GPRMC to GPGGA and changed some parameters.
I plugged the TX from the Garmin to the Rx und the Ground to the Ground.
But as i started the Terminal nothing readable appeared...
Can someone help me


PS:
even with this code i just get:

v«Y«åë·q_[e{§S§§§§§§§§§§§§}§Y«Ÿuåë·q_qq}§™›——§—'›—£ŸŸ•§c§ŸŸ™Ÿ£••›§u§§Ÿ
§›£Ÿ§•Ÿ›£Ÿ§e§—£Ÿ§e§§«—™åë·q_qgg§—'›—£ŸŸ•§c§ŸŸ™Ÿ£••›§u§™›——§S§Y«—}åë·q_{aw§
§W§§e§§«—'åë·q_{Qy§™›——§§§§§§W§§e§§c§§Y«“åë·q_SWq§Ÿ£Ÿ§W§™•£™§e§Ÿ£Ÿ§c§Ÿ£Ÿ§i«—
›åë·q_OWu§S§S§§§c§Y«—™åë·_q[eu§•£Ÿ§e§››£•§e§›'£Ÿ§e«}åë·_q[eK§“§3«™™åë·_q[ee
§yo¥Ÿ™«——åë·oyowq§™•£™§§§Ÿ£'§u«››åë

Code:
int ledPin = 13;                     // LED test pin
int rxPin = 0;                       // RX pin
int txPin = 1;                       // TX pin
char incomingByte;

void setup(){
  pinMode(ledPin, OUTPUT);           // initialize LED pin
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  Serial.begin(4800);                // initialize Serial
}

void loop(){

  digitalWrite(ledPin, HIGH);        // switch LED on (debugging)
  
  if(Serial.available() > 0){        // send data only when you receive data
    incomingByte = Serial.read();    // read incoming
    Serial.print(incomingByte);      // send incoming
  }  
}


Thx
Geko
257  Forum 2005-2010 (read only) / Exhibition / Re: Arduino + MAX7456 OSD on: September 06, 2008, 01:05:53 am
Thx a lot. May you send me the link from the Forum. I can speak German
so it would be easyer for me to read it there.

THx
Geko
258  Forum 2005-2010 (read only) / Exhibition / Re: Arduino + MAX7456 OSD on: September 03, 2008, 02:04:34 pm
WOW!

Great! I'm gonna try this for my FPV Plane!
How fast is the refresh rate on the Screen?

Thx
Geko
259  Forum 2005-2010 (read only) / Exhibition / Re: Has an Arduino ever gone so high? on: March 28, 2010, 07:21:35 am
Didn't get this info. Do you have a link?

The problem is that the balloon and the gas is from the government smiley smiley
260  Forum 2005-2010 (read only) / Exhibition / Re: Has an Arduino ever gone so high? on: March 27, 2010, 07:23:17 am
now you even can hear or see an Airplane smiley


Andy
261  Forum 2005-2010 (read only) / Exhibition / Re: Has an Arduino ever gone so high? on: March 26, 2010, 05:40:59 pm
??? lol
would be a huge weight with 35km of rope smiley
that's why I connected a Mobile to the Arduino so that the sonde can send me an SMS when it has been returned back to the ground...
262  Forum 2005-2010 (read only) / Exhibition / Has an Arduino ever gone so high? on: March 26, 2010, 10:37:48 am
I launched now 3 Balloons with an Arduino Mega one to 35km one to 32km and the third up to 28km height and they do still work smiley

http://snowflakeone.ch/index.php?option=com_content&view=article&id=13&Itemid=16&lang=en

there are just a few Pictures on the site the other ones are for comercial purpose


thx
Andy
263  Forum 2005-2010 (read only) / Exhibition / Re: I made a GPS library for decoding NMEA protoco on: September 11, 2008, 06:22:03 am
But as you know the SoftwareSerial is quite slow or better it does
need a lot of power and that slows the Arduino down. I got some
experience in this. I do now parse the Gps sentence at 5hz on the
UART so the Hardware Serial on pin 0. I think as your program grows
Software Serial is going to be a problem.
And at 5hz the Software Serial is relay struggling getting the
data and parse them...

Geko
264  Forum 2005-2010 (read only) / Exhibition / Re: I made a GPS library for decoding NMEA protoco on: September 11, 2008, 04:27:01 am
Quote
Geko, thank you so much for you assistance and help on this topic! It is much appreciated by me.

I have looked into the remarks in this thread shortly, and believe that nearly all problems are caused because the example programs were written for Wiring, not Arduino! I do not have an Arduino, and as a result, I didn't know that there is no port "Serial1" on Arduino.

I will write new example code, and try it on an actual Arduino this weekend. Will then post an update on this thread and inform you how to download the new example code. I'm pretty sure it will work fine then.

thanks for your feedback and patience,
Maarten

Thx a lot Maarten

Yes I think there are some bugs in the Library but he core code does work for me. Just some tiny bits
do not work!

Thx again for your great work!
Geko
265  Forum 2005-2010 (read only) / Exhibition / Re: I made a GPS library for decoding NMEA protoco on: September 11, 2008, 03:25:05 am
I told you it does just work on the UART port.
Connect the GPS pin to Arduino Pin 0 (RX).

I haven't tried it with the SoftwareSerial (pin 2 or pin 3)

Would be strange if it doesn't work...
What kind of Sentence does your GPS send?

Geko
266  Forum 2005-2010 (read only) / Exhibition / Re: I made a GPS library for decoding NMEA protoco on: September 10, 2008, 05:52:14 am
Quote
GekoCH.

Quote
So you like to parse the data with the NMEA library on the Software Serial port?

Yes I would like to parse the data with the NMEA library but not necessarily with the Software Serial.

Thank you GekoCH and Maartenl for your efforts.

So this code works on the Hardware Serial (UART) just change the Baundrate
and set your GPS to send the data in GPRMC and of course the destination smiley-grin

Code:
#include <nmea.h>

NMEA myGPS(GPRMC);

float dest_latitude = xx.xxxxxxxx;
float dest_longitude = y.yyyyyyyy;

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

void loop() {
  if (Serial.available() > 0 ) {

    if (myGPS.decode(Serial.read())) {
      
    
      Serial.print("Time:     ");
      Serial.println(myGPS.gprmc_utc(), DEC);
  
      Serial.print("Distance: ");
      Serial.print(round(myGPS.gprmc_distance_to(dest_latitude, dest_longitude, MTR)),DEC);
      Serial.println("m");
      
    }
  }
}

Geko
267  Forum 2005-2010 (read only) / Exhibition / Re: I made a GPS library for decoding NMEA protoco on: September 10, 2008, 01:37:10 am
Quote
GekoCH, you are a legend. I can't tell you what a relief it is to finally get GPS data I can use. Thank you very much.

Whereabouts do you call the gprmc_distance_to function in your code as I couldn't get that bit working still with the NMEA library?

Thanks again.


So you like to parse the data with the NMEA library on the Software Serial port?
I haven't tried that because I won't need it but I think I'm going to try this as well..

Geko
268  Forum 2005-2010 (read only) / Exhibition / Re: I made a GPS library for decoding NMEA protoco on: September 09, 2008, 02:31:27 pm
Code:
#include <AFSoftSerial.h>

AFSoftSerial mySerial =  AFSoftSerial(2, 3);

#define GPSRATE 9600

#define BUFFSIZ 90
char buffer[BUFFSIZ];
char *parseptr;
char buffidx;
uint8_t hour, minute, second, year, month, date;
uint32_t latitude, longitude;
uint8_t groundspeed, trackangle;
char latdir, longdir;
char status;

void setup()
{
  
  Serial.begin(GPSRATE);
  mySerial.begin(GPSRATE);
}
 
 
void loop()
{
  uint32_t tmp;
  

  readline();

  if (strncmp(buffer, "$GPRMC",6) == 0) {
    
    // hhmmss time data
    parseptr = buffer+7;
    tmp = parsedecimal(parseptr);
    hour = tmp / 10000;
    minute = (tmp / 100) % 100;
    second = tmp % 100;
    
    parseptr = strchr(parseptr, ',') + 1;
    status = parseptr[0];
    parseptr += 2;
    
    // grab latitude & long data
    // latitude
    latitude = parsedecimal(parseptr);
    if (latitude != 0) {
      latitude *= 10000;
      parseptr = strchr(parseptr, '.')+1;
      latitude += parsedecimal(parseptr);
    }
    parseptr = strchr(parseptr, ',') + 1;
    // read latitude N/S data
    if (parseptr[0] != ',') {
      latdir = parseptr[0];
    }
    
    //Serial.println(latdir);
    
    // longitude
    parseptr = strchr(parseptr, ',')+1;
    longitude = parsedecimal(parseptr);
    if (longitude != 0) {
      longitude *= 10000;
      parseptr = strchr(parseptr, '.')+1;
      longitude += parsedecimal(parseptr);
    }
    parseptr = strchr(parseptr, ',')+1;
    // read longitude E/W data
    if (parseptr[0] != ',') {
      longdir = parseptr[0];
    }
    

    // groundspeed
    parseptr = strchr(parseptr, ',')+1;
    groundspeed = parsedecimal(parseptr);

    // track angle
    parseptr = strchr(parseptr, ',')+1;
    trackangle = parsedecimal(parseptr);


    // date
    parseptr = strchr(parseptr, ',')+1;
    tmp = parsedecimal(parseptr);
    date = tmp / 10000;
    month = (tmp / 100) % 100;
    year = tmp % 100;
    
    Serial.print("\nZeit: ");
    Serial.print(hour, DEC); Serial.print(':');
    Serial.print(minute, DEC); Serial.print(':');
    Serial.println(second, DEC);
    Serial.print("Datum: ");
    Serial.print(date, DEC); Serial.print('-');
    Serial.print(month, DEC); Serial.print('-');
    Serial.print("0");
    Serial.println(year, DEC);
    Serial.print("Speed: ");
    Serial.println(groundspeed, DEC);
    
    
   Serial.print("Lat: ");
    if (latdir == 'N')
       Serial.print('+');
    else if (latdir == 'S')
       Serial.print('-');
    Serial.print(latitude/1000000, DEC); Serial.print('°', BYTE); Serial.print(' ');
    Serial.print((latitude/10000)%100, DEC); Serial.print('\''); Serial.print(' ');
    Serial.print((latitude%10000)*6/1000, DEC); Serial.print('.');
    Serial.print(((latitude%10000)*6/10)%100, DEC); Serial.println('\"');
    
  
  }
  //Serial.println(buffer);
}

uint32_t parsedecimal(char *str) {
  uint32_t d = 0;
  
  while (str[0] != 0) {
   if ((str[0] > '9') || (str[0] < '0'))
     return d;
   d *= 10;
   d += str[0] - '0';
   str++;
  }
  return d;
}

void readline(void) {
  char c;
  
  buffidx = 0;
  while (1) {
      c=mySerial.read();
      if (c == -1)
        continue;
      //Serial.print(c);
      if (c == '\n')
        continue;
      if ((buffidx == BUFFSIZ-1) || (c == '\r')) {
        buffer[buffidx] = 0;
        return;
      }
      buffer[buffidx++]= c;
  }
}

PS: It does even parse the GPRMC sentence just for testing for your device...

Geko
269  Forum 2005-2010 (read only) / Exhibition / Re: I made a GPS library for decoding NMEA protoco on: September 09, 2008, 02:29:49 pm
Quote
I tried using the standard Serial but it didn't work for me.

Below is code that I am using that does enable me to get GPS data but I need to find a way to parse the GPS data string for the Longitude and Latitude values. When I debug it with Serial.println() (not in example below this bit) it messes up the GPS data I can see in the debugging window.

Maarten, your gprmc_distance_to function is just what I need but I can't get it to work  smiley-sad

Code:
// include the SoftwareSerial library
#include <SoftwareSerial.h>

// Constants
#define rxPin 9
#define txPin 8

// set up the serial port

SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);

// variables
byte byteGPS = 0;
int i = 0;
int indices[13];
int cont = 0;
int conta = 0;

char inBuffer[300] = "";

int k = 0;

void setup(){

  //setup for mySerial port
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  mySerial.begin(4800);
  
  //setup for Serial port
  Serial.begin(19200);

  // setup the GPS module
  Serial.println("Configurando GPS...");
  delay(1000);
  mySerial.println("$PSTMNMEACONFIG,0,4800,1,1");        // configure NMEA sentences to show only GGA sentence
  delay(100);
  
  // command for setting time and position
  mySerial.println("$PSTMINITGPS,4140.000,N,00053.000,W,0197,22,10,2007,11,40,00");    

  // "4140.000,N" means: Latitude 41º40'00.0" North
  // "00053.000,W" means: Longitude 0º53'00.0" West
  // "0197" means 197 m elevation
  // "22,10,2007,11,40,00" means date and time (October 22, 2.007 - 11h 40min 00sec UTC time)
}

void loop(){
 
  byteGPS = 0;
  i = 0;
  while(byteGPS != 42){                   // read the GGA sentence
    byteGPS = mySerial.read();        
    inBuffer[i]=byteGPS;              
    i++;                      
  }
  
  k = 1;
  while(inBuffer[k] != 42){
    Serial.print(inBuffer[k]);            // write the GGA sentence
     k++;
  }
  Serial.println();
  delay(3000);
}

Thanks in advance for any help anyone can give me.


The gprmc_distance_to function does work on my Arduino. But without Software Serial.

I had also big problems getting the SoftSerial working. Go using the "AFSoftSerial" liabary and this code which does work
for my GPS:
See next post:
270  Forum 2005-2010 (read only) / Exhibition / Re: I made a GPS library for decoding NMEA protoco on: September 09, 2008, 11:48:41 am
Quote
Quote
Maarten
But only at 1hz .... I got a GPS at 5hz so would it be possible
to parse this???

Geko

Geko, a quick reply, because I am at work. The frequency of GPS (NMEA) output was approx 1Hz on the GPS receivers that I have worked with. My library is not dependent on the actual output frequency of the GPS receiver: it simply processes whatever comes out of the GPS. The only constraint in that respect is that the host (Arduino/Wiring) _could_ be too slow to catch all the characters. I cannot judge that, but please inform me if it works for higher-speed NMEA output.

ooops ok now it does work... hm but I don't know why. Ok it does display the sentence at 5Hz so know I have
to parse the GGA and VTG sentence...

EDIT:
I took a closer look and look what happend:

Sentence = $GPGGA,...
Datatype = GPVTG
Number of terms = FF0,0
Sentence = $GPVTG,...
Datatype = GPVTG
Number of terms = 11
Sentence = $GPGGA,...
Datatype = GPVTG
Number of terms = FF0,0
Sentence = $GPVTG,...
Datatype = GPVTG
Number of terms = 11

There are still some problems....

Geko
Pages: 1 ... 16 17 [18] 19