Difference between revisions of "B0.8051 Interfacing GPS"
(22 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:8051 tutorials]] | [[Category:8051 tutorials]] | ||
+ | [[Category:GPS Module]] | ||
The Global Positioning System (GPS) is a satellite-based navigation system that provides location and time information of the GPS device in all weather conditions, anywhere on or near the Earth, where there is an unobstructed line of sight to four or more GPS satellites.<br> | The Global Positioning System (GPS) is a satellite-based navigation system that provides location and time information of the GPS device in all weather conditions, anywhere on or near the Earth, where there is an unobstructed line of sight to four or more GPS satellites.<br> | ||
A GPS module is a device that uses Global Positioning System to determine the location of a vehicle or person. GPS receivers are used to provide reliable navigation, positioning and timing services to the users at anytime and anywhere on the earth. This Global positioning system uses a minimum of 4 satellites to provide the data to the receivers. If the GPS receiver is only able to get signals from 3 satellites, you can still get your position, but it will be less accurate. As mentioned above, the GPS receiver needs 4 satellites to determine the position in 3-dimensions. | A GPS module is a device that uses Global Positioning System to determine the location of a vehicle or person. GPS receivers are used to provide reliable navigation, positioning and timing services to the users at anytime and anywhere on the earth. This Global positioning system uses a minimum of 4 satellites to provide the data to the receivers. If the GPS receiver is only able to get signals from 3 satellites, you can still get your position, but it will be less accurate. As mentioned above, the GPS receiver needs 4 satellites to determine the position in 3-dimensions. | ||
− | |||
[[File:0Gps.png]] | [[File:0Gps.png]] | ||
+ | <br> | ||
+ | |||
+ | =GPS Module Specs= | ||
+ | {| class="table table-striped table-hover table-condensed table-bordered" | ||
+ | |-class="info" | ||
+ | |Name || Description | ||
+ | |- | ||
+ | |Volatge || Vmin=3.6v and Vmax=6v (Tested with 5v) | ||
+ | |- | ||
+ | |Time To Start || Cold Start 29s(Average under Open Sky)<br> | ||
+ | Warm Start 28s(Average under Open Sky)<br> | ||
+ | Hot Start 1s(Average under Open Sky)<br> | ||
+ | <b>InDoor: GPS modules take more time to get valid data and some times won't work.</b> | ||
+ | |- | ||
+ | |Interface || Full Duplex Serial Interface(UART) | ||
+ | |- | ||
+ | |Baud Rate || Default-9600, Also supports 4800/9600/38400/115200 | ||
+ | |- | ||
+ | |Start Bit || 1-bit | ||
+ | |- | ||
+ | |Stop Bit || 1-bit | ||
+ | |- | ||
+ | |Data Bits || 8-bit | ||
+ | |- | ||
+ | |Parity || None | ||
+ | |- | ||
+ | |Update Rate || Default 1Hz, Also supports 1/2/4/5/8/10 | ||
+ | |- | ||
+ | |Ouput Frames|| GPGGA, GPGSA, GPGSV, GPRMC and GPVTG | ||
+ | |} | ||
+ | <br> | ||
=GPS Frame Formats= | =GPS Frame Formats= | ||
The serial interface protocol is based on the National Marine Electronics Association’s NMEA 0183 ASCII | The serial interface protocol is based on the National Marine Electronics Association’s NMEA 0183 ASCII | ||
interface specification. | interface specification. | ||
+ | [[File:GpsLog.png]] | ||
===GGA-GLOBAL POSITIONING SYSTEM FIX DATA=== | ===GGA-GLOBAL POSITIONING SYSTEM FIX DATA=== | ||
Time, position and fix related data for a GPS receiver. | Time, position and fix related data for a GPS receiver. | ||
− | $GPGGA,hhmmss.sss,ddmm.mmmm,a,dddmm.mmmm,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh<CR><LF> | + | <b>$GPGGA,hhmmss.sss,ddmm.mmmm,a,dddmm.mmmm,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh<CR><LF></b> |
===GLL - LATITUDE AND LONGITUDE, WITH TIME OF POSITION FIX AND STATUS=== | ===GLL - LATITUDE AND LONGITUDE, WITH TIME OF POSITION FIX AND STATUS=== | ||
Latitude and longitude of current position, time, and status. | Latitude and longitude of current position, time, and status. | ||
− | $GPGLL,ddmm.mmmm,a,dddmm.mmmm,a,hhmmss.sss,A,a*hh<CR><LF> | + | <b>$GPGLL,ddmm.mmmm,a,dddmm.mmmm,a,hhmmss.sss,A,a*hh<CR><LF></b> |
===GSA - GPS DOP AND ACTIVE SATELLITES=== | ===GSA - GPS DOP AND ACTIVE SATELLITES=== | ||
GPS receiver operating mode, satellites used in the navigation solution reported by the GGA or GNS sentence | GPS receiver operating mode, satellites used in the navigation solution reported by the GGA or GNS sentence | ||
− | and DOP values. | + | and DOP values.<br> |
− | $GPGSA,A,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,x.x,x.x,x.x*hh<CR><LF> | + | <b>$GPGSA,A,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,x.x,x.x,x.x*hh<CR><LF></b> |
===GSV - GPS SATELLITE IN VIEW=== | ===GSV - GPS SATELLITE IN VIEW=== | ||
Numbers of satellites in view, PRN number, elevation angle, azimuth angle, and C/No. Four satellites details | Numbers of satellites in view, PRN number, elevation angle, azimuth angle, and C/No. Four satellites details | ||
are transmitted per message. Additional satellite in view information is sent in subsequent GSV messages. | are transmitted per message. Additional satellite in view information is sent in subsequent GSV messages. | ||
− | $GPGSV,x,x,xx,xx,xx,xxx,xx,…,xx,xx,xxx,xx *hh<CR><LF> | + | <b>$GPGSV,x,x,xx,xx,xx,xxx,xx,…,xx,xx,xxx,xx *hh<CR><LF></b> |
===RMC - RECOMMENDED MINIMUM SPECIFIC GPS/TRANSIT DATA=== | ===RMC - RECOMMENDED MINIMUM SPECIFIC GPS/TRANSIT DATA=== | ||
Time, date, position, course and speed data provided by a GNSS navigation receiver. | Time, date, position, course and speed data provided by a GNSS navigation receiver. | ||
− | $GPRMC,hhmmss.sss,A,dddmm.mmmm,a,dddmm.mmmm,a,x.x,x.x,ddmmyy,x.x,a,a*hh<CR><LF> | + | <b>$GPRMC,hhmmss.sss,A,dddmm.mmmm,a,dddmm.mmmm,a,x.x,x.x,ddmmyy,x.x,a,a*hh<CR><LF></b> |
===VTG - COURSE OVER GROUND AND GROUND SPEED=== | ===VTG - COURSE OVER GROUND AND GROUND SPEED=== | ||
The Actual course and speed relative to the ground. | The Actual course and speed relative to the ground. | ||
− | $GPVTG,x.x,T,x.x,M,x.x,N,x.x,K,a*hh<CR><LF> | + | <b>$GPVTG,x.x,T,x.x,M,x.x,N,x.x,K,a*hh<CR><LF></b> |
− | + | <br><br> | |
=GPRMC Frame Decoding= | =GPRMC Frame Decoding= | ||
− | We will be using this frame for GPS data (time, lat-long). | + | We will be using this frame for GPS data (time, lat-long). Below table provides the informtion encoded in the GPS frame.<br> |
− | + | ||
$GPRMC,hhmmss.sss,A,dddmm.mmmm,a,dddmm.mmmm,a,x.x,x.x,ddmmyy,x.x,a,a*hh<CR><LF> | $GPRMC,hhmmss.sss,A,dddmm.mmmm,a,dddmm.mmmm,a,x.x,x.x,ddmmyy,x.x,a,a*hh<CR><LF> | ||
$GPRMC,110831.000,A,1304.8763,N,07733.6457,E,0.79,303.84,010116,,,A*68 | $GPRMC,110831.000,A,1304.8763,N,07733.6457,E,0.79,303.84,010116,,,A*68 | ||
Line 76: | Line 107: | ||
|13 || Checksum || 68 || | |13 || Checksum || 68 || | ||
|} | |} | ||
+ | |||
+ | Below is the sample code to decode the above frame | ||
+ | <html><script src="https://gist.github.com/SaheblalBagwan/1f78f20eb0d06df4de176f28a51dafae.js"></script></html> | ||
+ | <br> | ||
+ | |||
+ | =Code= | ||
+ | Below is the sample code to receive the GPS data, decode it and display it on LCD. | ||
+ | <html><script src="https://gist.github.com/SaheblalBagwan/e3f2566c938d51c050deca7aca0027c0.js"></script></html> | ||
+ | <br><br> | ||
+ | |||
+ | =Track on Google Maps= | ||
+ | Lat = 1304.8763,N = 13+(04.8763/60) = 13.0812716666666667<br> | ||
+ | Long = 07733.6457,E = 77+(33.6457/60) = 77.560761666666667<br> | ||
+ | Now lets paste these values <b>13.0812716666666667, 77.560761666666667</b> on google maps and track the location. | ||
+ | <br><br> | ||
+ | [[File:GpsMap.PNG]] | ||
+ | <br><br> | ||
+ | |||
+ | =Demo= | ||
+ | [[File:GpsDemo.png]] | ||
+ | |||
+ | =Downloads= | ||
+ | Download the sample code and design files from [https://github.com/ExploreEmbedded/8051_DevelopmentBoard this link]. | ||
+ | |||
+ | Have an opinion, suggestion , question or feedback about the article let it out here! | ||
+ | {{DISQUS}} |
Latest revision as of 10:17, 2 September 2016
The Global Positioning System (GPS) is a satellite-based navigation system that provides location and time information of the GPS device in all weather conditions, anywhere on or near the Earth, where there is an unobstructed line of sight to four or more GPS satellites.
A GPS module is a device that uses Global Positioning System to determine the location of a vehicle or person. GPS receivers are used to provide reliable navigation, positioning and timing services to the users at anytime and anywhere on the earth. This Global positioning system uses a minimum of 4 satellites to provide the data to the receivers. If the GPS receiver is only able to get signals from 3 satellites, you can still get your position, but it will be less accurate. As mentioned above, the GPS receiver needs 4 satellites to determine the position in 3-dimensions.
Contents
GPS Module Specs
Name | Description |
Volatge | Vmin=3.6v and Vmax=6v (Tested with 5v) |
Time To Start | Cold Start 29s(Average under Open Sky) Warm Start 28s(Average under Open Sky) |
Interface | Full Duplex Serial Interface(UART) |
Baud Rate | Default-9600, Also supports 4800/9600/38400/115200 |
Start Bit | 1-bit |
Stop Bit | 1-bit |
Data Bits | 8-bit |
Parity | None |
Update Rate | Default 1Hz, Also supports 1/2/4/5/8/10 |
Ouput Frames | GPGGA, GPGSA, GPGSV, GPRMC and GPVTG |
GPS Frame Formats
The serial interface protocol is based on the National Marine Electronics Association’s NMEA 0183 ASCII interface specification.
GGA-GLOBAL POSITIONING SYSTEM FIX DATA
Time, position and fix related data for a GPS receiver. $GPGGA,hhmmss.sss,ddmm.mmmm,a,dddmm.mmmm,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh<CR><LF>
GLL - LATITUDE AND LONGITUDE, WITH TIME OF POSITION FIX AND STATUS
Latitude and longitude of current position, time, and status. $GPGLL,ddmm.mmmm,a,dddmm.mmmm,a,hhmmss.sss,A,a*hh<CR><LF>
GSA - GPS DOP AND ACTIVE SATELLITES
GPS receiver operating mode, satellites used in the navigation solution reported by the GGA or GNS sentence
and DOP values.
$GPGSA,A,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,x.x,x.x,x.x*hh<CR><LF>
GSV - GPS SATELLITE IN VIEW
Numbers of satellites in view, PRN number, elevation angle, azimuth angle, and C/No. Four satellites details are transmitted per message. Additional satellite in view information is sent in subsequent GSV messages. $GPGSV,x,x,xx,xx,xx,xxx,xx,…,xx,xx,xxx,xx *hh<CR><LF>
RMC - RECOMMENDED MINIMUM SPECIFIC GPS/TRANSIT DATA
Time, date, position, course and speed data provided by a GNSS navigation receiver. $GPRMC,hhmmss.sss,A,dddmm.mmmm,a,dddmm.mmmm,a,x.x,x.x,ddmmyy,x.x,a,a*hh<CR><LF>
VTG - COURSE OVER GROUND AND GROUND SPEED
The Actual course and speed relative to the ground.
$GPVTG,x.x,T,x.x,M,x.x,N,x.x,K,a*hh<CR><LF>
GPRMC Frame Decoding
We will be using this frame for GPS data (time, lat-long). Below table provides the informtion encoded in the GPS frame.
$GPRMC,hhmmss.sss,A,dddmm.mmmm,a,dddmm.mmmm,a,x.x,x.x,ddmmyy,x.x,a,a*hh<CR><LF>
$GPRMC,110831.000,A,1304.8763,N,07733.6457,E,0.79,303.84,010116,,,A*68
Field | Name | Data | Description |
1 | UTC Time | 110831.000 | UTC Time in hhmmss.sss format (000000.000 - 235959.999) |
2 | Status | A | Data Validity A-Valid, V-Invalid(Navigation Warning) |
3 | Latitude | 1304.8763 | Latitude in dddmm.mmmm format, leading zeros transmitted |
4 | N/S Indicator | N | Latitude hemisphere indicator, N-North S-South |
5 | Longitude | 07733.6457 | Longitude in dddmm.mmmm format, leading zeros transmitted |
6 | E/W Indicator | E | Longitude hemisphere indicator, E-East W-West |
7 | Speed Over Ground | 0.79 | Speed Over Ground in Knots (000.0 ~ 999.9) |
8 | Course Over Ground | 303.84 | Course Over Ground in degrees (000.0 ~ 359.9) |
9 | UTC Date | 010116 | UTC Date in ddmmyy format |
10 | Magnetic variation | Magnetic variation in degrees(000.0 ~ 180.0) | |
11 | Magnetic variation | Magnetic variation Direction, E-East W-West | |
12 | Mode Indicator | A | N - Data Not Valid A - Autonomous Mode |
13 | Checksum | 68 |
Below is the sample code to decode the above frame
Code
Below is the sample code to receive the GPS data, decode it and display it on LCD.
Track on Google Maps
Lat = 1304.8763,N = 13+(04.8763/60) = 13.0812716666666667
Long = 07733.6457,E = 77+(33.6457/60) = 77.560761666666667
Now lets paste these values 13.0812716666666667, 77.560761666666667 on google maps and track the location.
Demo
Downloads
Download the sample code and design files from this link.
Have an opinion, suggestion , question or feedback about the article let it out here!