Here, we don't discuss its background, we want to know how to interpret the satellite positioning data.
- There are a lot of GPS receivers in the market, we are using 3DR GPS MTK V2.0 now, as shown in Figure 1.
- Connect GPS receiver to the Arduino Mega 2560.
- Next, wrie code to Arduino Mega 2560, the code very simple.
void setup()
{
Serial.begin(38400);
Serial1.begin(38400);
Serial.flush();
Serial1.flush();
}
void loop()
{
if(Serial1.available())
{
Serial.write(Serial1.read());
}
} - Open the COM port used by Arduino Mega 2560, you will see the received data from the GPS.
$GPGGA,003121.200,0120.4690,N,10341.9579,E,1,4,2.63,-45.2,M,3.2,M,,*7E
$GPGSA,A,3,22,31,25,14,,,,,,,,,2.81,2.63,0.99*0E
$GPRMC,003121.200,A,0120.4690,N,10341.9579,E,0.00,151.76,080614,,,A*6F
$GPVTG,151.76,T,,M,0.00,N,0.00,K,A*39
$GPGGA,003121.400,0120.4690,N,10341.9579,E,1,4,2.63,-45.2,M,3.2,M,,*78
$GPGSA,A,3,22,31,25,14,,,,,,,,,2.81,2.63,0.99*0E
$GPRMC,003121.400,A,0120.4690,N,10341.9579,E,0.00,151.76,080614,,,A*69
$GPVTG,151.76,T,,M,0.00,N,0.00,K,A*39
$GPGGA,003121.600,0120.4690,N,10341.9579,E,1,4,2.63,-45.2,M,3.2,M,,*7A
$GPGSA,A,3,22,31,25,14,,,,,,,,,2.81,2.63,0.99*0E
$GPGSV,3,1,11,22,73,029,14,18,51,120,18,31,48,306,39,50,42,091,*7C
$GPGSV,3,2,11,25,33,050,28,14,24,011,29,21,22,164,,16,14,205,*7D
$GPGSV,3,3,11,29,11,117,,27,04,224,,193,,,*4B
$GPRMC,003121.600,A,0120.4690,N,10341.9579,E,0.00,151.76,080614,,,A*6B
$GPVTG,151.76,T,,M,0.00,N,0.00,K,A*39
This is a part of GPS data, it looks terrible. Starting, you may feel very afraid, confused, don't know how to read it. But in fact, you can refer to the following web site, it explains the meaning of each of the data represented in detail.
http://aprs.gids.nl/nmea/
These data have been repeat and repeat, but what I need is the location, I want to know where I am, so we need to read $GPGGA this sentence.
$GPGGA,003121.200,0120.4690,N,10341.9579,E,1,4,2.63,-45.2,M,3.2,M,,*7E
Figure 1: 3DR MTK V2.0
Figure 2: Arduino Mega 2560
Name
|
Example data
|
Description
|
---|---|---|
Sentence Identifier
|
$GPGGA
|
Global Positioning System Fix Data
|
Time
|
003121.200
|
00:31:21:200
|
Latitude
|
0120.4690, N
|
01° 20.4690' N or 01° 20' 28" 140''' N
|
Longitude
|
10341.9579, E
|
103° 41.9579' E or 103° 41' 57" 474''' E
|
Fix Quality:
- 0 = Invalid
- 1 = GPS fix
- 2 = DGPS fix
|
1
|
Data is from a GPS fix
|
Number of Satellites
|
4
|
4 Satellites are in view
|
Horizontal Dilution of Precision (HDOP)
|
2.63
|
Relative accuracy of horizontal position
|
Altitude
|
-45.2, M
|
-45.2 meters above mean sea level
|
Height of geoid above WGS84 ellipsoid
|
3.2, M
|
3.2 meters
|
Time since last DGPS update
|
blank
|
No last updateZ
|
DGPS reference station id
|
blank
|
No station id
|
Checksum
|
*7E
|
Used by program to check for transmission errors
|
-
From the above table, know that I am at 01° 20' 28" 140 North and 103° 41' 57" 474 East.
Next, you can enter the location return by GPS receiver into the Google map: 1°20'28.140'' 103°41'57.474'' , it show that there is my home.
No comments:
Post a Comment