GPS Receiver. Build and program your own GPS receiver. Contents. Overview Challenge 1: Understanding GPS Data. Overview

Similar documents
MP3 Player. Add an MP3 module to the board and design a user interface. Overview Challenge 1: Control the MP3 Module with Your Computer

Datasheet of stand-alone GPS smart antenna module, LS20057

NMEA reference manual

NMEA Reference Manual

GPS Engine Board ET-332

SkyTraq Venus 6 GPS Module ST22

Data Sheet. Gmm u1 GPS Module GR9804-DS000B. GlobalTop Technology Inc. Revision: V0B

Datasheet of stand-alone GPS smart antenna module, LS20229

PPS usable by timing applications via serial port emulation

Note: The PmodGPS arrives with the RTCM feature inactive, to enable RTCM capabilities users should contact GlobalTop at:

Datasheet of GPS smart antenna module, NL-50xE Sirf3 series

GPS Module DataSheet

DG-100 Data Logger User Manual. Version 1.2

GM862-GPS, GE863-GPS - GPS AT COMMANDS SET GM862-GPS, GE863-GPS 80278ST10021a Rev. 0-21/04/06

NMEA Reference Manual

International Journal of Research in Advent Technology Available Online at:

The Gotop GT-1613-MTR is a complete GPS engine module that features super

MoTeC USA GPS. Part # M GPS BL Available in 10 Hz or 20 Hz. USER MANUAL Version 1.4

Datasheet of stand-alone GPS smart antenna module with magnetic sensor, LS20126

SATLAB Field Tools. User Guide for SL55

SAH2217 Enhanced ATHEROS GPS Module with ultra high sensitivity and antenna open/short detection/protection

GPS-Receiver JP3 Description

GST-1 Troubleshooting FAQ

Onyx RFG-2000 GPS Receiver

How to setup a serial Bluetooth adapter Master Guide

User s Manual of BTGP-38KM Bluetooth GPS Data Logger V1.0

Modbus and ION Technology

K.Prasanna NIT Rourkela,India Summer Internship NUS

Serial Communications

Configuring Serial Terminal Emulation Programs

USB GPS User s Guide (WIN)

PM1122 INT DIGITAL INTERFACE REMOTE

NL-464US User Manual (60122)

Trimble R8 Base and Rover Quick Setup Guide. Inland GPS Inc.

Instructions on How to Use HyperTerminal to Test Serial Ports ...

Parallax Serial LCD 2 rows x 16 characters Non-backlit (#27976) 2 rows x 16 characters Backlit (#27977) 4 rows x 20 characters Backlit (#27979)

An Arduino Controlled GPS Corrected VFO

GPS Receiver. User s Guide. May. 28, 2003

Projet 15. Annexes. Réalisation d'un logiciel de mesure d'éclairement. Réalisé par Thomas Roncaglia pour la société ERIBAT.

Using a Laptop Computer with a USB or Serial Port Adapter to Communicate With the Eagle System

TP- 051 GPS RECEIVER

Time Synchronization & Timekeeping

GPS Selection Guide. EZ Guide 500 & 250 Trimble #

CENTRONICS interface and Parallel Printer Port LPT

Technical Manual. For use with Caller ID signaling types: Belcore 202, British Telecom, & ETSI

GPS Tracking Simulation by Path Replaying G. Rajendran #1, Dr. M. Arthanari #2, M. Sivakumar #3 #1 Assistant Professor of Computer Science,

CM HOST CM CardTransporter Fuel Communication and Management Software Software version up to 3.1

SURVEY PRO. GPS Quick Start Guide

MT3339 PC Tool Operation Manual

Technical Article Developing Software for the CN3 Integrated GPS Receiver

Modbus and ION Technology

Current Cost Data Cable User Guide. Installing and configuring the data cable

The Answer to the 14 Most Frequently Asked Modbus Questions

RS-232 Communications Using BobCAD-CAM. RS-232 Introduction

TI GPS PPS Timing Application Note

L10. Quectel GPS Engine. EVB User Guide L10_EVB_UGD_V1.00

L16. Quectel GNSS Engine. EVB User Guide L16_EVB_UGD_V1.0

Navilock NL-442U Sirf Star IV GPS USB Receiver User Manual (61994)

Technical Bulletin. Teledyne PDS Clock Synchronization Considerations. Version 1.2

Cypress CY7C64225 USB-to-UART Setup Guide Version 1.3

8051 MICROCONTROLLER COURSE

Waspmote. Quickstart Guide

Zodiac Serial Data Interface Specification

LDG Electronics External Meter Serial Communications Protocol Specification

Features Reference. About Unified Communication System. Before Using This Machine. Starting a Meeting. What You Can Do During the Meeting

USB GPS User s Guide (WIN)

Virtual Integrated Design Getting started with RS232 Hex Com Tool v6.0

Bluetooth HC-06 with serial port module Easy guide

To perform Ethernet setup and communication verification, first perform RS232 setup and communication verification:

R4 AIS Transponder System

Installing the drivers for the Current Cost Data Cable

WA Manager Alarming System Management Software Windows 98, NT, XP, 2000 User Guide

Additional Setup Instructions for Modbus: RTU, ASCII, TCP, Omni & Enron

DIRECT INTERNET DATA. User s Guide

Tech Info Document: PIC16F84A LCD Satellite Antenna Tracking Interface

di-gps Eco ProFessional PF1-M digital images GPS receiver

Global Monitoring + Support

GTS-4E Hardware User Manual. Version: V1.1.0 Date:

Table of contents. Chapter 1. Introduction Background Project Specification Plan of Development...

Part 1 Product introduction 2. Part 2 Features 3. Part 3 Safety notes 4. Part 4 Quick user s guide 5. Part 5 Operation notes 7

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

Communications Instructions for DOOSAN, FANUC Controls

RIGtalk. Revision 5. Owner s Manual 2012.

How to setup a serial Bluetooth adapter

Programming and Using the Courier V.Everything Modem for Remote Operation of DDF6000

RS232 Board datasheet

PRODUCTIVITY THROUGH INNOVATION 600 CONTROL DIRECT DRIVE TECHNICAL/OPERATION MANUAL

Clever Devices IVN GPS Broadcast over Ethernet Interface Control Document

Connecting your Omega/BetaPAT PLUS to a PC via a USB

RCForb Server Setup. Overview

Bluetooth to serial HC-06 wireless module

Exer. 1 Using Handheld GPS for location & recording points

DELORME. Getting Started with. Earthmate GPS BT-20. Bluetooth

GPS Fleet Setup Manual. Created by the team at FollowUs. A short documentation to get you started and setup with regards to the GPS Fleet

Programming Flash Microcontrollers through the Controller Area Network (CAN) Interface

I. DigitalCAT Captioning Software Overview A. Welcome B. Acquiring the Captioning Add-On C. Purpose of this Guide...

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

Using HyperTerminal with Agilent General Purpose Instruments

FAQ Sprint 3G/4G USB Modem U300

Incident Commander Pro Radio-Based Automatic Tracking System

Transcription:

GPS Receiver Build and program your own GPS receiver. Contents Overview Challenge 1: Understanding GPS Data o Collecting Your Components o Connecting the Receiver to Your Computer o Setting up a Terminal Emulator o Understanding GPS Data Challenge 2: Controlling the Receiver o Collecting Your Components o Connecting the Receiver to the Chip o Displaying Raw GPS Data on the LCD o Parsing the Raw GPS Data o Selecting GPS Output Streams o Displaying Specific GPS Data Elements o Formatting GPS Data on Two Lines Overview In this project, you will build an interface to the GlobalSat EM-406A GPS Receiver. The EM-406A is a 20-channel GPS receiver based on the SiRF StarIII chipset, and it features a built-in antenna. After building the interface circuit, you will learn how to customize it to display more than 30 standard GPS data types, including latitude, longitude, altitude, velocity, heading, time, and date. Figure 1. GlobalSat EM-406A GPS Receiver.

Like most GPS receivers, the EM-406A conforms to the standard NEMA SiRF interface protocol, so the code you write in this project will work with most other GPS receivers. Challenge 1: Understanding GPS Data In order to better understand the GPS data format, you will first connect your GPS receiver directly to your computer through the Machine Science programming cable. GPS receivers are capable of transmitting a large volume of data, which can be difficult to see on a small LCD screen. By viewing the data on a computer monitor, you will be able to learn about the different GPS data streams and data types. Collecting Your Components In order to connect your GPS receiver to your computer, you will need the following components: Part Quantity Description A 1 GlobalSat EM-406A GPS Engine B 1 Connector harness (6-pin) C 1 Bent header (6-pin) D 1 Bent header (4-pin) Connecting the Receiver to Your Computer Using Figure 2 as a guide, connect the GPS receiver to the programming board, which will link it to your computer. To avoid intefering with the microcontroller, build this circuit in an area of the board away from the chip. Figure 3 shows one way to lay out this circuit. To orient the GPS unit properly, note the position of the grey wire in Figure 3.

Figure 2. Connecting the GPS receiver to the computer (schematic). Figure 3. Connecting the GPS receiver to the computer (photo). Setting up a Terminal Emulator Connected as shown in Figure 2, the GPS receiver will send satellite data to your computer s COM port. To view the data, you will need to run a terminal emulator--a program that emulates an older-style text-only computer terminal. Depending on your operating system, your computer may already have a terminal emulator, or you may need to download one from the Internet: Windows (Vista): TeraTerm Pro Web is available here: http://www.ayera.com/teraterm/ Windows (pre-vista): HyperTerminal is available in the Start menu under Programs > Accessories > Communication.

Macintosh: ZTerm comes pre-installed with OSX and above. Linux: CuteCom can be found at: http://cutecom.sourceforge.net/ The instructions in this section are for installing TeraTerm Pro Web, but should give you enough information to help you set up any of the other programs listed above. 1. Determine which COM port your Machine Science programming board is using by viewing the Options menu in the Programming Window. 2. Download TeraTerm Pro Web from http://www.ayera.com/teraterm/ 3. Unzip the.zip file to a convenient location on your hard drive. 4. Open the folder and double click on the file ttermpro.exe. You will see a dialog box like the one shown in Figure 4. Figure 4. New connection dialog box. 5. Select Serial and the COM port being used by your Machine Science programming board. You should now see unintelligible characters scrolling across and down your screen as shown in Figure 5.

Figure 5. TeraTerm Window. 6. The reason you see a jumble of characters is that you need to set the baud rate in baud rate in your terminal program to match the baud rate of the GPS receiver. Select Serial port... from the Setup menu. You should now see a dialog box like the one shown in Figure 6. Figure 6. Serial port setup. 7. Select 4800 for the baud rate. You should now see lines of GPS data being updated every second on your screen, as shown in Figure 7.

Understanding GPS Data Figure 7. Terminal emulator. GPS receivers are capable of transmitting eight types of GPS data streams, shown below: Option GGA GLL GSA GSV MSS RMC VTG ZDA Time and position data Latitude, longitude, time and status Description GPS receiver operating mode, satellites used in the position solution, and DOP values The number of GPS satellites in view, satellite ID numbers, elevation, and azimuth Signal-to-noise ratio, signal strength, frequency, and bit rate from a radio-beacon, receiver Time, date, position, course and speed data Course and speed information relative to the ground Pulse Per Second (PPS) timing message Referring to Figure 7 (or your terminal emulator, if it is still running on your computer), you should see four types of GPS data streams: GGA, RMC, GSV, and GSA. These are the four default data streams that are transmitted by the GPS receiver. Each stream is transmitted on a single line. An example of a GGA data stream is shown below. $GPGGA,161229.487,3723.2475,N,12158.3416,W,1,07,1.0,9.0,M,,,,0000*18

Each GPS data stream can have up to sixteen GPS data fields. The data fields are separated by commas, as shown in the sample above. Table 3 below details the data fields contained in the GGA data stream. Name Example Description Message ID $GPGGA GGA protocol header UTC Time 161229.487 hhmmss.sss (h=hours, m=minutes, s=seconds) Latitude 3723.2474 ddm.mmmm (d=degrees, m=minutes) N/S Indicator N N=north or S=south Longitude 12158.3416 dddmm.mmmm (d=degrees, m=minutes) E/W Indicator W E=east or W=west Position Fix Indicator 1 0=fix not valid, 1,2, or 3= fix valid Satellites Used 07 Range 0 to 12 HDOP 1.0 Horizontal dilution of precision MSL Altitude 9.0 Meters above sea level Units M Meters Geoid Separation Units Age of Diff. Corr. Diff. Ref. Station ID 0000 Meters Meters Seconds Checksum *18 Check for valid data <CR><LF> Carriage return and line feed indicating end of message Don't worry about understanding all of the GPS data types shown in this table. The ones of greatest interest to you will probably be time, latitude, longitude, and altitude. In the next challenge, you will learn how to display this information in a meaningful way on your LCD. Challenge 2: Controlling the Receiver In this challenge, you will construct a circuit connecting the EM-406A to the Atmega Board and program the chip to display readable GPS data on the LCD.

Collecting Your Components In order to build the circuit, you will need the following components: Part Quantity Description A 1 GlobalSat EM-406A B 1 Connector harness (6-pin) C 1 Bent header (6-pin) D 1 Atmega Board Connecting the Receiver to the Chip Using the schematic in Figure 8 as a guide, add your components to the breadboard. Figure 9 shows an example of a completed board for this circuit. Since the leads on the GPS receiver are not labeled, you may need to examine the picture to make the correct connections. Figure 8. Connecting GPS receiver to the Atmega168 (schematic).

Figure 9. Connecting GPS receiver to the Atmega168 (photo). Displaying Raw GPS Data on the LCD The following code will allow you to begin receiving data from your GPS receiver and displaying the information on your LCD. In this first step, you will not be parsing the data from your receiver. As you learned in the previous challenge, GPS receivers can produce a lot of data, so your tiny LCD will quickly fill up with a lot of numbers, letters, and symbols. While you will not be able to read the data, it will indicate that your circuit is working properly. (It also looks kind of cool!) IMPORTANT NOTE: The GPS receiver and the Machine Science programming board both use the same pin for transmitting data to the Atmega168. You must disconnect the wire linking the GPS pin 4 to the Port D0 of the Atmega168 before downloading your code. You can immediately reconnect this wire once the code has been downloaded. 1. #include "mxapi.h" 2. #include "usart.h" 3. #include "lcd.h" 4. 5. int main (void) 6. { 7. char gps_characters; //Declare a variable for storing GPS characters

8. usart_init(4800); //Initialize the USART to 4800 baud 9. lcd_init(); //Initialize your LCD 10. while(1==1) //Start an infinite loop 11. { 12. gps_characters=usart_read(); //Read each character from the GPS 13. lcd_character(gps_characters); //Display each character on the LCD 14. } 15. } Parsing the Raw GPS Data In order to better view the data on your LCD, you will need to parse the raw data stream from the GPS receiver. In Figure 7, you can see that the terminal emulator on your computer displays each data stream on a separate line. It does this by checking for a carriage return and line feed, the ASCII characters 13 and 10, at the end of each data stream (as shown in the last rows of Table 3). When the terminal emulator finds these two characters, it starts the next data set on a new line, making the data much easier to read than if it were simply a continuous stream. The microcontroller has no built-in ability to parse data. As you may have seen in the previous exercise, the carriage return and line feeds at the end of each data string are displayed on the LCD as more data. As a result, using the previous code, the GPS data was displayed on the LCD in long stream without easily discernible breaks. The next code sample introduces breaks after each line of data, just like the terminal emulator did. It checks continuously for a line feed character (ASCII 10), and when it gets one, it repositions LCD's cursor at the start of the first line before displaying the next character. The data on the display remains somewhat difficult to read, since all of the different GPS data streams are displayed, but it is easier to pick out patterns in the data. 1. #include "mxapi.h" 2. #include "usart.h" 3. #include "lcd.h" 4. 5. int main (void) 6. { 7. char gps_characters; //Declare a variable to store GPS characters 8. usart_init(4800); //Initialize the USART to 4800 baud 9. lcd_init(); //Initialize the LCD 10. while(1==1) //Start an infinite loop

11. { 12. gps_characters = usart_read(); //Read each character from the GPS 13. lcd_character(gps_characters); //Display each character on the LCD 14. if (gps_characters == 10) //Check for the line feed (ASCII 10) character 15. { 16. lcd_instruction( FIRST_LINE ); //Move the cursor to the first line 17. } 18. } 19. } Programming Challenge Modify your code so that each line new line scrolls up in the same way that it displays on your computer monitor. This is difficult! Selecting GPS Output Streams The following code turns on and off specific GPS data streams. Remember that the receiver is capable of transmitting any or all of the eight different GPS streams listed in Table 2 at a rate of up to 100 Hertz each. In order to display the data on the LCD, it is best to turn on only one stream and turn off the rest, using a function called gps_setdata. This function takes two arguments: the first argument selects the GPS stream that you want to turn on or off; the second argument determines how frequently (in Hertz) the GPS receiver transmits the stream. A value of 0 turns off the stream entirely, while a value of 1 to 99 specifies a transmission frequency of 1 to 99 times a second. 1. #include "mxapi.h" 2. #include "usart.h" 3. #include "lcd.h" 4. #include "gps.h" 5. 6. int main (void) 7. { 8. char gps_characters; //Declare a variable to store GPS character 9. usart_init(4800); //Initialize the USART to 4800 baud 10. lcd_init(); //Initialize the LCD 11. delay_ms(2000); //Delay while GPS receiver warms up 12.

13. /* Turn off all NMEA formats except the one you want to see. */ 14. gps_setdata(nmea_gga, 1); //Turn on GGA format at 1 Hertz 15. gps_setdata(nmea_gsa, 0); //Turn off GSA format (0 Hertz) 16. gps_setdata(nmea_gsv, 0); //Turn off GSV format (0 Hertz) 17. gps_setdata(nmea_rmc, 0); //Turn off RMC format (0 Hertz) 18. while(1==1) //Run the following code in an infinite loop 19. { 20. gps_characters = usart_read(); //Read each character from the GPS 21. lcd_character(gps_characters); //Display each character on the LCD 22. if (gps_characters==10) //Check for the line feed (ASCII 10) character 23. { 24. lcd_instruction(first_line); //Move the cursor to the first line 25. } 26. } 27. } You do not need to select a GPS data stream every time you program the device. Once a stream is selected, the receiver displays only that stream until the gps_setdata function is called again. Programming Challenge Try changing the GPS stream displayed by your GPS receiver. Try changing how often the GPS stream is updated. Displaying Specific GPS Data Elements With the following code, you can display specific GPS data elements, such as time, latitude, longitude, and altitude, from the selected data stream. To simplify matters, every GPS data stream is parsed in the background by a function within the gps.h header file. The parsed data is stored in an array called gps_data[ ], with each value in the array representing a different GPS data element. You can reference any element in the gps_data[ ] array in your code.

For example, with the GGA data stream, selected a line of data might look like this: $GPGGA,161229.487,3723.2475,N,12158.3416,W,1,07,1.0,9.0,M,,,,0000*18 In this instance, gps_data[0] would equal $GPGGA, gps_data[1] would equal 161229.487, gps_data[2] would equal N, and so on. The following table shows the gps_data[] values for some of the more useful data elements in the GGA, RMC, and VTC data streams. GPS Data Example Units Format GGA RBC VTG Message ID $GPGGA 0 0 0 Latitude 3723.2475 Degrees and minutes ddmm.mmmm 2 3 North/South N 3 4 Longitude 12158.3416 Degrees and minutes dddmm.mmmm 4 5 East/West W 5 6 Altitude 9.0 Meters 9 Speed 0.2 Kilometers / hour Course 309.62 Degrees 8 1 Time 161229.487 hhmmss.ss 1 1 Date 120598 ddmmyy 9 Satellites 07 0 to 12 7 This program uses the chip's internal interrupts, which allow the microcontroller to execute multiple tasks at the same time. A few new statements are added to enable and initialize the interrupts. 1. #include "mxapi.h" 2. #include "usart.h" 3. #include "lcd.h" 4. #include "gps.h" 5. 6. int main (void) 7. { 8. usart_init(4800); //Initialize the USART to 4800 baud 7

9. usart_interrupt_rx(enable); //Enable interrupts for the USART 10. sei(); //Turn on interrupts 11. lcd_init(); //Initialize the LCD 12. 13. while(1==1) //Start an infinite loop 14. { 15. lcd_instruction(first_line); //Move the cursor to the first line 16. lcd_instruction(clear); //Clear the LCD 17. lcd_text(gps_data[2]); //Display the 3rd value in the selected data stream 18. } 19. } Formatting GPS Data on Two Lines The last code example in this project will display and format multiple GPS data fields on both lines of the LCD. The added functions in this example should be familiar to you from other Machine Science projects. 1. #include "mxapi.h" 2. #include "usart.h" 3. #include "lcd.h" 4. #include "gps.h" 5. 6. int main (void) 7. { 8. usart_init(4800); //Initialize the Atmega168s USART to 4800 baud 9. usart_interrupt_rx(enable); //Enable interrupts for the USART 10. sei(); //Turn on interrupts 11. lcd_init(); //Initialize your LCD 12. 13. while(1) //Run the following code in an infinite loop 14. { 15. lcd_instruction(first_line); //Move the cursor to the first line 16. lcd_text(gps_data[2]); //Display value of third data field 17. lcd_character(':'); //Display ':' character

18. lcd_text(gps_data[3]); //Display value of fourth data field 19. 20. lcd_instruction(second_line); //Move the curse to the first line 21. lcd_text(gps_data[4]); //Display value of fifth data field 22. lcd_character(':'); //Display ':' character 23. lcd_text(gps_data[5]); //Display value of sixth data field 24. lcdblankline(); //Send blanks to clear the lines 25. } 26. }