Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

GPS for robot

Status
Not open for further replies.
Hi there

Have someone tried to build a GPS-circuit before?
I don't know much about interfacing the GPS-modules, so I'd really like some help. Perhaps with the GPS Module ZX4120 (Crownhill) or WP-RF-GPSM001 (Xemics).

The project must contain the following three thing (to LCD)
Global coordinates
Speed
Altitude

Could someone help me beginning this project, on how to get the different data from the GPS Module?
 
Last edited:
It's a simple serial data connection, and the data is standard - might be NMEA? - something like that anyway!. There's LOT'S of details about it available, google should find all you want to know. EPE did a project with a GPS module a while back, and the PIC source code can be downloaded from their website.
 
The GGA (one of the needed commands for the module) command from the first link (dknguyen) it says:

$GPGGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh

That's fine, but how can I write that to the module from a PIC?
 
Through the GPS's serial port of course! I'm guessing it's a UART, so connect it to the UART pins on the PIC. If it's SPI, connect it to the SPI. Then you code the rest.
 
Things you may want to consider when choosing a GPS module:

1: Power requirements, some need 5V and those such as the ZX4120 and WP-RF-GPSM001 need 3.6V. Also look for a low power consumption type.

2: Antenna, Some have built-in antenna, others like those above need an external one, usually an active (powered) type.

3: Physical connections, check what type of data interface connector and antenna plug that you will need - they may vary and be hard to find.

4: Data interface, The above types support standard NMEA0183 protocols, sending the serial data at logic levels using 4800 or 9600 baud.
Other modules may use RS232 levels which is better for interfacing to a PC but would need an extra interface to convert back to a microcontroller logic level.

5: Data modes, they usually send several NMEA sentences each second.
The defaults may be fine, usually RMC and GGA sentences are sent by default.You may need to send configuration commands to the module if you want to select certain lesser-used sentences.

6: Some modules also have a separate 1pps pulse output, which is good if you want to get exact timing. (the timestamps in the NMEA sentences are not precise due to the serial data delays)


When you have chosen the module and connected it up ok, you then just need to interface it to the microcontroller's serial input.

Write a routine to initialise the UART with the correct baud rate, data and stop bits then have it check the received data, looking for the required sentence headers eg. $GPGGA and then pic-out and convert the chosen ASCII data parameters and maybe convert to HEX or decimal data for use in calculations or just send it to the display.

If you read through the NMEA data specification you will see that each parameter is separated by a comma making it easier to locate the info in the sentence that you want by counting the number of commas before it rather than counting the number of bytes (which can vary).
 
Thanks PICASM, but the electrically isn't the problem it's the programming that courses the problems. I'm writing my source code in C. Dows the module send NMEA0183 commands to the PIC all the time or do I have to give it the commands to receive the commands?

Code:
$GPGGA,161229.487,3723.2475,N,12158.3416,W,1,07,1.0,9.0,M, ,M, ,0000*18

I don't know much about USART, so I don't know how to "get the data" received. The above code might be received, but how to seperate the different data?

Does someone have a C code sample which shows how to receive longitude/latitude coordinates and store these values in variables - updating maybe each 2 seconds?
 
The GPS module usually sends each NMEA sentence once every second without any need for you to send it any request command.
(eg. every second it sends an RMC, GGA and several other types of sentence)

Each sentence ends with <CR> <LF> characters.

For info on setting-up and useing the USART, you could download microchip AN774 (Asynchronous Communications with the PICmicro).

Sorry, I don't' use C code, perhaps someone else may be able to help you there.

Microchip also provide "Application Maestro Software" which may help you as it can automatically create some of the code for controlling the USART (it has C code for the 18F series pics only).
 
Google for "pic serial uart C source code" and see if you can find the code you can add to your code. You should be able to find code that will read a byte of a string terminated with CR/LF.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top