NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » 25$ 10 Hz - FMP04-TLP GPS module (easy setup)

May 16, 2011
by kle8309
kle8309's Avatar

I recently bought a gps mod for just $25 + $7 priority shipping from Ohararp LLC. It was pretty simple to setup and I can read the raw GMEA output using my hyperterminal. Compare to other GPSs, this has good sensitivity and pricing.

The only discrepancy from the datasheet was that the default baud rate was 9600. However, it's actually 38400!!!.

Here are the outputs (not everything, there should be 4 outputs: GGA GSA GSV RMC)

$GPGGA,225932.100,XXXX.8620,N,09739.5941,W,1,9,0.96,388.5,M,-25.2,M,,6C $GPRMC,225932.100,A,XXXX.8620,N,09739.5941,W,0.03,224.88,160511,,,A73

(I XXXX out for privacy)

OHARARP LLC gps link

All I need now is to parse the data using UART. But need to mod the uart lib so that UBRROL=23 (calculated using the atmega datasheet)

If you guys have any questions just post them. This is pretty simple compare to the other projects I'm working on.

Cheers

May 16, 2011
by kle8309
kle8309's Avatar

demonstration of gps

May 18, 2011
by 6ofhalfdozen
6ofhalfdozen's Avatar

heya kle8309,

That is a pretty sweet GPS module. There is a little confusion in the datasheets, one actually says it can transmit signals at 115.2 8n1 while the other says output is limited to 9600 8n1. Otherwise, it definately looks to be simple but effective. I have never heard of the OHARARP folks before. Any one else dealt with them in the past?

May 18, 2011
by kle8309
kle8309's Avatar

"Any one else dealt with them in the past?" I first found out about this company while looking at adafruit so adafruit has posted a link to them

adafruit

July 01, 2011
by esoderberg
esoderberg's Avatar

"nkgps"

Another GPS: this is a Locosys GPS configured to output RMC NMEA data on a 5hz cycle via UART at 38400 bps.

Not a very sophisticated NMEA parser but it puts out all the info I want; serial stream read via interrupt driven UART.

Code below:

// gps.c
// for ATmega328p nano

#define F_CPU 16000000
#include "../utility/io_328p.h"
#include <avr/io.h>
#include <inttypes.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include "../utility/delay.h"
#include "../utility/lcd.h"
#include "../utility/uart.h"

volatile char received_from_uart, time[10], v[10], lat[12], lon[12];
volatile uint16_t nmea_state = 1;

void uartgps_init(uint8_t br) {
 // set baud rate
  UBRR0H = 0;
  UBRR0L = br;  //103 9.6kbps and 16Mhz see page 203 in datasheet//25 for        38.4kbs//207 4.8//16 57.6//8 115.2kbps

 // enable uart RX and interrupt on RX
 UCSR0B = (1<<RXEN0) | (1<<RXCIE0) | (1<<TXEN0);

 // set 8N1 frame format
 UCSR0C = (1<<UCSZ01)|(1<<UCSZ00);
}

ISR(USART_RX_vect){  // will be triggered on every character received //  gps configured for RMS only
received_from_uart = UDR0;
UDR0=received_from_uart;

nmea_state++;

if (received_from_uart == '$')nmea_state=0;

if ((nmea_state>5) & (nmea_state<18)) time[nmea_state-6]=received_from_uart;

if ((nmea_state>19) & (nmea_state<32)) lat[nmea_state-20]=received_from_uart;

if ((nmea_state>31) & (nmea_state<45)) lon[nmea_state-32]=received_from_uart;

if ((nmea_state>44) & (nmea_state<50)) v[nmea_state-45]=received_from_uart;

}

int main(void) {
// init uart
uartgps_init(26);

//fire up lcd
lcd_init();
FILE lcd_stream = FDEV_SETUP_STREAM(lcd_putchar, 0, _FDEV_SETUP_WRITE);
lcd_home();

// turn on interrupt handler
sei();

// main loop
while(1) {

lcd_line_one();
fprintf_P(&lcd_stream, PSTR("GPS  Speed: %c%c%c%c kts"),v[0],v[1],v[2],v[3], v[4]);
lcd_line_two();
fprintf_P(&lcd_stream, PSTR("GMT: %c%c%c%c%c%c%c%c%c%"),    time[1],time[2],time[3],time[4],time[5],time[6],time[7],time[8], time[9]);
lcd_line_three();
fprintf_P(&lcd_stream, PSTR("lat:   %c%c%c%c%c%c%c%c%c%c%c"), lat[0],lat[1],lat[2],lat[3],lat[4],lat[5],lat[6],lat[7],lat[8],lat[9], lat[10]);
lcd_line_four();
fprintf_P(&lcd_stream, PSTR("long: %c%c%c%c%c%c%c%c%c%c%c%c"), lon[0],lon[1],lon[2],lon[3],lon[4],lon[5],lon[6],lon[7],lon[8],lon[9],lon[10],lon[11]);
}

return 0;
}
July 01, 2011
by Ralphxyz
Ralphxyz's Avatar

esoderberg, do you want to explain what is going on with your code?

I have a older DPS unit I was going to play around with and try to connect it to my Nerdkit so I would like to use your code.

I'd like to start with the interrupt:

ISR(USART_RX_vect){  // will be triggered on every character received //  gps configured for RMS only
received_from_uart = UDR0;
UDR0=received_from_uart;

nmea_state++;

if (received_from_uart == '$')nmea_state=0;

if ((nmea_state>5) & (nmea_state<18)) time[nmea_state-6]=received_from_uart;

if ((nmea_state>19) & (nmea_state<32)) lat[nmea_state-20]=received_from_uart;

if ((nmea_state>31) & (nmea_state<45)) lon[nmea_state-32]=received_from_uart;

if ((nmea_state>44) & (nmea_state<50)) v[nmea_state-45]=received_from_uart;

}

Seems strange to be [quote] "triggered on every character received" [/quote]

Ralph

July 01, 2011
by esoderberg
esoderberg's Avatar

Ralph,

With RXCIE0 and Global Interrupt Flag set to 1, every time the RXCn bit in UCSRnA is set (when a byte or ASCII character receive is complete) it will trigger the interrupt. The nice thing about doing it this way is that instead of asking the UART to read and then waiting for the receive to be complete with:

 /* Wait for data to be received */
 while ( !(UCSRnA & (1<<RXCn)) );)

it lets the program do other things until the buffer is ready to be read and then handles it after it comes in.

Eric

July 02, 2011
by Ralphxyz
Ralphxyz's Avatar

This will be a great start for me using GPS, thanks again.

I have a older Lowrance Electronics GlobalMap Sport GPS unit I picked up at a yard sale 5 years ago.

It was for the boating industry so the mapping modules are for the waters around Long Island, NY but the GPS data works fine.

I just found a NDC-1 cable from Lowrance on EBAY so I do not have to open the case to make connections or make up my own cable.

My GPS uses NMEA 0183 Version 1.5 and 2.

I can send:

GLL SENTENCES
RMC/RMB SENTENCES
APB SENTENCES

The default BAUD is 4800 No Parity and 8 Data Bits but everything is changeable.

I would like to incorporate the GPS into a robot.

The GPS technology is probable old but it still works. It probable is not as accurate as a newer GPS device.

Ralph

July 02, 2011
by esoderberg
esoderberg's Avatar

I put this code in the NK library along with some links to reference material. The links show and work fine in the preview but when I save the library page the text "library" is inserted in front of the http: in the link and it no longer works. To see if it is NK Library specific I put one of those same links here. Works fine in preview, we'll see if it still works once the reply is saved.

test

July 02, 2011
by Ralphxyz
Ralphxyz's Avatar

Nothing that "Library" does is surprising except that you can occasionally make it work!

Ralph

July 02, 2011
by Noter
Noter's Avatar

Eric,

There was https:__ starting the links instead of https://.

Not that it matters much, I use IE and none of that google docs stuff works for me.

July 03, 2011
by Rick_S
Rick_S's Avatar

The link comes up with an MTK NMEA Packet User Manual for me.

Rick

July 03, 2011
by esoderberg
esoderberg's Avatar

Rick,

The "test" link here in the forum seems to work, its the same link put in the NK library in the same fashion that is the problem. Were you able to open the MTK NMEA Packet User Manual from the Library section under GPS?

Eric

July 03, 2011
by Noter
Noter's Avatar

I checked again and now I understand. Even if you fix the link in the library it is broken again after a refresh. I think it's a problem in the page and has to be fixed by the nerdkit staff.

July 03, 2011
by Rick_S
Rick_S's Avatar

No, I just see a [?] that links back to the same page.

July 03, 2011
by Noter
Noter's Avatar

If you edit the page and fix the links then preview they are ok. But then when you refresh they are broken again. Try it and see if it's the same for you.

July 03, 2011
by Rick_S
Rick_S's Avatar

Must be something to do with the https: or the link itself. If I change the link to http://www.google.com, it works. But it won't accept the other and keep it. I agree that unless you can change the linked to location, it will be something that the NK guys will have to make work.

Rick

Post a Reply

Please log in to post a reply.

Did you know that a NerdKit can take control of a remote-controlled car? Learn more...