Sie sind auf Seite 1von 7

Using LabVIEW to Acquire GPS Data

Bookmark and Share

"Using LabVIEW, we successfully developed a GPS data acquisition


system to use as a learning platform to understand the data structure of a
GPS module."

Explore the NI Developer


Community

- Pong Ke Xin, UCSI University Malaysia

Discover and collaborate on the latest


example code and tutorials with a
worldwide community of engineers and
scientists.
Check out the NI Community

Who is National Instruments?


National Instruments provides a
graphical system design platform for
test, control, and embedded design
applications that is transforming the
way engineers and scientists design,
prototype, and deploy systems.
Learn more about NI

The Challenge:
Creating a system to power a global positioning system (GPS) module, acquire and process data, and display the latitude and
longitude in Google Earth.

The Solution:
Using NI LabVIEW software to create a GPS module data acquisition interface and link the decoded longitude and latitude
information to Google Earth to locate actual positions.
Author(s):
Pong Ke Xin - UCSI University Malaysia
Low Chang Weng - UCSI University Malaysia

Introduction
GPS is a satellite-based navigation system made up of 24 networked satellites placed into orbit by the U.S. Department of
Defense. GPS was originally intended for military applications, but in the 1980s, the government made the system available for
civilian use. GPS works in all weather conditions, anywhere in the world, 24 hours a day. There are no subscription fees or
setup charges to use GPS. GPS is used to indicate the current position of the user through a GPS module.

System Overview
Figure 1 shows the complete system overview block diagram of our LabVIEW GPS data acquisition system. The system
consists of a GPS module, a serial RS232 interface, and a computer preinstalled with LabVIEW. The GPS module sends a
series of standard NMEA format messages that give position, satellite information, time, and more. The GPS module connects
to the computer through NI-VISA available in LabVIEW and uses RS232 to transmit the GPS module information. After that, the
decoded longitude and latitude information are linked to Google Earth and the system locates the actual position.
For the GPS data acquisition system, we power up the GPS module with a 5 V power supply. After powering up, the GPS
module starts communicating with GPS satellites to obtain the current coordinates of the GPS module. The GPS module then
uses TTL to send data to the computer through a serial port, using the RS232 protocol, where it is processed by LabVIEW.
LabVIEW is programmed to extract the coordinates of the current position. The program we created in LabVIEW recognizes the
series through format recognition to determine which part of the data series is the coordinates. The coordinates are then shown
on the front panel, and input to the Google Maps URL. The front panel then displays a Google Map with the current position of
the user.

1/7

www.ni.com

Figure 1: System Overview Block Diagram

Figure 2: LabVIEW GPS Data Acquisition subVI


Figure 2 shows the subVI of the LabVIEW GPS data acquisition system. The block diagram in blue indicates the serial
communication function. The green box represents the block diagram to read and match the $GPRMC message. The red block
diagram splits the message of $GPRMC into single parts. Finally, the purple box shows the successfully extracted longitude and
latitude.

Figure 3: GPS Data Acquisition System VI


Figure 3 shows the LabVIEW GPS data acquisition system VI. After the longitude and latitude are extracted (the coordinates of
the actual position), the coordinates are input to the URL of the Google Map. The front panel shows the current position of the
user on Google Earth by using the balloon.

Results and Discussion


The following figures show the standard NMEA 0183 protocol and details of each GPS module command reading. The format
series of each datasheet is separated in parts by number. Each number is determined by the details listed in the format series.
Figure 4 shows the subVI front panel reading of the GPS Module. The data inside the read string is the reading received by the

2/7

www.ni.com

Figure 4 shows the subVI front panel reading of the GPS Module. The data inside the read string is the reading received by the
GPS module after it communicates with the GPS satellites. The three commands continuously repeat at 1-second intervals. The
detail of each part of the message is indicated by the datasheet provided. To obtain the current coordinates of the GPS module,
the $GPRMC command extracts the longitude and latitude.
The data in the blue box is the string that begins with the $GPRMC and the rest of the string. The string begins with the
$GPRMC command because LabVIEW programming is designed to match the $GPRMC only. The longitude and latitude are
required to input the URL of the Google Map so the $GPRMC message is extracted from the blue box.
The data in the substring (purple box) has been divided into single parts and put into the array. The LabVIEW program extracts
the longitude and latitude only, which are the coordinates of the current position. Therefore, the fourth, fifth, sixth, and seventh
indexes of the array are extracted. The longitude, latitude, and the direction are then input to the Google Maps URL, which then
maps the current position of the user.

Figure 4: Front Panel Reading GPS Module subVI

Figure 5: LabVIEW GPS Data Acquisition GUI


The GPS data acquisition system UI shows Google Earth, COM port, Baud rate, latitude, longitude, balloon color, balloon
alphabet, URL, and Google Maps API key. The COM port is used to set the USB port where the serial RS232 is connected to
the computer. Baud rate is used to set the default data rate of the GPS module to transmit data to NI-VISA. The delay time
gives some response time to the GPS module. Latitude and longitude are extracted from a series of data from the GPS module.
Balloon color and balloon alphabet indicate the coordinates of the current position. With the balloon coordinates, the user
discovers their current position. URL is an abbreviation of Uniform Resource Locator, which lists the global address of
documents and other resources on the World Wide Web. The Google Maps API key is used to embed Google Maps in web
pages and it has only 86 characters.
The GPS data acquisition system responds best with the COM port set to COM5, Baud rate set to 4,800 (the default Baud rate
of the GPS module), and the delay time set to 2,000 ms. In our experiment, when the GPS module acquires data, the latitude
shows a reading of 3.08333 and the longitude shows a reading of 101.74. This means that the GPS module acquires the
coordinates as 3.08333 North, and 101.74 East thus the actual location of the user is mapped in Google Earth by the blue
balloon (see Figure 6).
Once the red LED on the GPS module is blinking, the GPS module is performing two-way communication with the GPS satellite
and the data acquired is processed by LabVIEW. If the red LED on the GPS module remains on, there is no signal acquired.
After that, LabVIEW extracts the longitude and latitude using the recognized format series of each message and, hence maps
the coordinates on Google Earth.

3/7

www.ni.com

Figure 6: Experiment Setup of GPS Data Acquisition System Using LabVIEW

Conclusion
Using LabVIEW, we successfully developed a GPS data acquisition system to use as a learning platform to understand the data
structure of a GPS module. LabVIEW successfully obtains data from the GPS module through serial port communication.
LabVIEW also successfully extracts the latitude and longitude from the series of format messages from the GPS module.
Finally, the decoded longitude and latitude are input to the Google Maps URL to display on the Google Map and locate the
actual position using Google Earth.
Author Information:
Pong Ke Xin
UCSI University Malaysia
Lot 12734, Tamn Taynton View
Cheras 56000
Malaysia
Tel: 012 3771238
inierce@hotmail.com

Figure 1 Block Diagram of System Overview

4/7

www.ni.com

Figure 2 Sub VI of GPS Data Acquisition Using LabVIEW

Figure 3 VI of GPS Data Acquisition System

5/7

www.ni.com

Figure 4 Sub VI Front panel of GPS modules reading

Figure 5 Graphic User Interface of GPS Data Acquisition Using NI LabVIEW 2009

6/7

www.ni.com

Figure 6 Experiment Setup of GPS Data Acquisition System Using NI LabVIEW 2009

Next Steps
Learn More About LabVIEW
Download LabVIEW
Legal
This case study (this "case study") was developed by a National Instruments ("NI") customer. THIS CASE STUDY IS PROVIDED "AS IS"
WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN
NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).

7/7

www.ni.com

Das könnte Ihnen auch gefallen