Go Down

Topic: I made a GPS library for decoding NMEA protocol (Read 9716 times) previous topic - next topic

mday

Quote
So this code works on the Hardware Serial (UART) just change the Baundrate and set your GPS to send the data in GPRMC


Thanks GekoCH  although I can't get the latest code to work. I put the baudrate to 4800 and I also tried putting the following code into the setup function:

Code: [Select]
pinMode(2, INPUT);
pinMode(3, OUTPUT);

GekoCH

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

maartenl

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

GekoCH

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

mday

GekoCH,

Code: [Select]
I told you it does just work on the UART port.
Connect the GPS pin to Arduino Pin 0 (RX).


OK, this won't work for me as I have a GPS/GPRS shield that sits directly on top of the Arduino and uses pins 2 and 3.

Maarten, thanks that would be great!

maartenl

#20
Sep 11, 2008, 12:57 pm Last Edit: Sep 11, 2008, 01:04 pm by maartenl Reason: 1
Quote
OK, this won't work for me as I have a GPS/GPRS shield that sits directly on top of the Arduino and uses pins 2 and 3.


I am aware that the example code does not work (yet) via Arduino pins 2 and 3. However, I'm hoping to borrow an Arduino this weekend and write some new example code that uses "SoftwareSerial" on those two pins. I have no reason to assume that would not work.

Maarten

GekoCH

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

maartenl

#22
Sep 11, 2008, 02:14 pm Last Edit: Sep 11, 2008, 02:15 pm by maartenl Reason: 1
I wasn't really aware that SoftwareSerial was much slower than Serial, but I trust that it is. This may indeed be limiting to the number of sentences the library can process per second. However, this not only depends on the frequency of NMEA cycles (for example 1 Hz, or 5 Hz), but also on the number of sentences output per cycle. If you are only using a particular sentence type (for example GPRMC or GPGGA), then some GPS receivers let you choose to only output those sentence types. This will considerably speed-up processing.

Also, I would think that the library as-it-is does not require much processing, but only at the moment when a GPRMC sentence was completed: at that moment it does a lot of floating-point stuff.

Maarten

Madhu

Hi Maarten,

Any progress with the Arduino port of the NMEA library? It works fine with the Wiring IDE though.

Keep up the good work.

thanks,
Madhu.

mrkiss

I'm looking forward to Maarten's progress too.

And I got some success(? )  

with Arduino and NMEA library , I connected  GPS to HW serial and AFSoftSerial to the PC
It works ^^ (<- smiling eyes. kind of Korean emoticon. korean emoticon is upright style. can you understand it? )
But programming is some hassle --; (<- cold sweating ?)



busstopArduino

#25
Oct 26, 2008, 01:06 pm Last Edit: Oct 26, 2008, 01:09 pm by busstopArduino Reason: 1
Any idea of how to connect the arduino BT to a BT GPS receiver?

this is the closest I've read to a BT connection other than a computer:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1180546719  :-[


Orac

How is the arduino port coming along?

I am looking foward to this :)

Brad Burleson

#27
Dec 12, 2008, 10:57 am Last Edit: Dec 13, 2008, 01:24 am by bradb Reason: 1
I'm not sure why anybody is waiting for a "port" to the Arduino - the NMEA library works out of the box for me.  I think the example programs are what needs to be modified.

I grabbed the provided example to show all sentences and modified two or three lines - it worked fine for me.  

Here is the modified code, but my contribution wasn't much.  Oh yeah, you'll need the AFSoftSerial library (since the normal software serial doesn't have an avaliable function).


Code: [Select]
// This example illustates access to all sentence types,
// using the NMEA library. It assumes that a GPS receiver
// is connected to serial port 'Serial1' at 4800 bps.

#include <nmea.h>
#include <AFSoftSerial.h>

// Constants
#define rxPin 9
#define txPin 8

// set up the serial port

AFSoftSerial mySerial = AFSoftSerial(rxPin, txPin);

// variables
NMEA gps(ALL);    // GPS data connection to all sentence types

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

void loop() {
 if (mySerial.available() > 0 ) {
   // read incoming character from GPS and feed it to NMEA type object
   if (gps.decode(mySerial.read())) {
     // full sentence received
     Serial.print ("Sentence = ");
     Serial.println (gps.sentence());
     Serial.print ("Datatype = ");
     Serial.println (gps.term(0));
     Serial.print ("Number of terms = ");
     Serial.println (gps.terms());
   }
 }
}


Hope this helps,

Brad.

[edit]I've seen a reference somewhere on the forum that this library has a large memory footprint - perhaps that's the problem people are seeing?  I've upgraded to the 328P, so maybe that's why I don't see a problem?[/edit]

mikalhart

#28
Dec 19, 2008, 05:51 am Last Edit: Dec 19, 2008, 06:01 am by mikalhart Reason: 1
Quote
I've seen a reference somewhere on the forum that this library has a large memory footprint - perhaps that's the problem people are seeing?  I've upgraded to the 328P, so maybe that's why I don't see a problem?


I think your assessment is correct, Brad.  Creating a single NMEA object allocates ~1200 bytes of RAM, which is probably great for the 328P, but a little too big to fit in a "conventional" Arduino.

I am working on a derivative library called TinyGPS that provides a subset of NMEA's functionality but is much smaller.  It provides latitude, longitude, time, date, course, speed, and magnetic variation -- everything that the $GPRMC sentence provides.  I would welcome suggestions on whether this would suffice for a majority of users.

Mikal

Brad Burleson

Quote
It provides latitude, longitude, time, date, course, speed, and magnetic variation -- everything that the $GPRMC sentence provides.  I would welcome suggestions on whether this would suffice for a majority of users.


Mikal-

I'm not sure what everybody else needs, but I think it would be fine for my purposes (I haven't looked, but I think that's enough information to plot my location on google maps).

Since I'm passing the data via XBee using API mode, I'm limited to a payload of 72 bytes (once I get the code sorted out) so simple is really better.

I'm looking forward to your library.

Brad.

Go Up