{"id":26280,"date":"2019-01-11T16:12:32","date_gmt":"2019-01-12T00:12:32","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=26280"},"modified":"2021-06-09T13:34:50","modified_gmt":"2021-06-09T20:34:50","slug":"exploring-gps-systems-with-the-pmodgps","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/exploring-gps-systems-with-the-pmodgps\/","title":{"rendered":"Exploring GPS Systems with the PmodGPS"},"content":{"rendered":"<p>Fall quarter 2018 at UW Bothell, I took my first EE elective course: Sensors and Sensor Systems. The course was project based, meaning half of our time and grade involved a group project. In my opinion, we were rather rushed into deciding a project and ordering parts for it. Not only did we have to make-up a problem to fix, but we had to order the parts for it within a week. We decided we wanted to try and develop a system for group GPS tracking and local environmental data reporting. We thought this could be a useful system for people exploring the outdoors where signs and other means of location reference might not be available or obvious and help group member locate each other or a reference location like a base camp. Due to incompatibility with some of the parts we ordered and learning curves associated with using Wifi, we had to make many modifications and patches with our system and hardware to make it work by the end of the quarter. I have posted two projects on Hackster.io illustrating the <a href=\"https:\/\/www.hackster.io\/ian-etheridge\/group-gps-tracking-and-environmental-data-system-0c46e5\">overall project<\/a>&nbsp;(using Arduino Mega and Raspberry Pi microcontrollers) and a more <a href=\"https:\/\/www.hackster.io\/ian-etheridge\/gps-tracking-system-with-arduino-uno-and-digilent-pmodgps-ccee81\">focused project<\/a>&nbsp;(using an Arduino Uno microcontroller) about the GPS with all code available via Github. Now, back to the article.<\/p>\n<p>The <a href=\"https:\/\/digilent.com\/shop\/pmod-gps-gps-receiver\/\">Pmod GPS<\/a> has quite a bit of functionality to it. On top of reporting latitude and longitude, you can report altitude, speed, time, number of connected satellites, and heading. With all this, you can do some computation and report even more like the distance between you and some other point, the angle in which you are to that point, how fast you are approaching that point, what time you will arrive at that point, and whatever else you can think of!<\/p>\n<figure id=\"attachment_26309\" aria-describedby=\"caption-attachment-26309\" style=\"width: 427px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-26309\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/12\/Pmod_GPS__75878.1456866475.1280.1280.png\" alt=\"\" width=\"427\" height=\"427\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/12\/Pmod_GPS__75878.1456866475.1280.1280.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/12\/Pmod_GPS__75878.1456866475.1280.1280-150x150.png 150w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/12\/Pmod_GPS__75878.1456866475.1280.1280-300x300.png 300w\" sizes=\"auto, (max-width: 427px) 100vw, 427px\" \/><figcaption id=\"caption-attachment-26309\" class=\"wp-caption-text\">The PmodGPS in all its glory.<\/figcaption><\/figure>\n<p><span style=\"font-weight: 400\">There are 24 satellites orbiting the Earth at about 20,000 km for the purpose <\/span><span style=\"font-weight: 400\">of GPS. These satellites are the transmitters and our PmodGPS is a receiver. <\/span><span style=\"font-weight: 400\">GPS satellites broadcasts two carrier waves: L1 (1575.42MHz) and L2 (1227.60MHz). <\/span><span style=\"font-weight: 400\">These frequencies are chosen such that they eliminate what is called ionospheric dispersion, <\/span><span style=\"font-weight: 400\">which causes systematic range errors due to properties of waves passing through the ionosphere. <\/span><span style=\"font-weight: 400\">What is called the pseudorange is a calculation of the distance between the satellite and the <\/span><span style=\"font-weight: 400\">receiver. The pseudorange is not the actual distance from satellite to receiver, there are many <\/span><span style=\"font-weight: 400\">7 <\/span><span style=\"font-weight: 400\">biases and environmental conditions that affect this calculation. Our report in the<a href=\"https:\/\/www.hackster.io\/ian-etheridge\/group-gps-tracking-and-environmental-data-system-0c46e5\"> overall project<\/a> shows the pseudorange <\/span><span style=\"font-weight: 400\">equation and a description of its variables. Multipath takes into account the transmitted signal <\/span><span style=\"font-weight: 400\">bouncing off objects before getting to the receiver.&nbsp;<\/span><span style=\"font-weight: 400\">There are two pseudorandom noise codes (PRN) that are modulated onto the carrier <\/span><span style=\"font-weight: 400\">frequencies. The Course\/Acquisition-code (C\/A-code, wavelength of 300 meters) is modulated <\/span><span style=\"font-weight: 400\">onto L1 and the Precision-code (P-code, wavelength of 30 meters) is modulated onto L1 and L2. <\/span><span style=\"font-weight: 400\">The P-code is not authorized for civilian use so that the government can control the level of <\/span><span style=\"font-weight: 400\">accuracy available to the public. <\/span><span style=\"font-weight: 400\">To transmit the signals from the satellites involves transmitting a carefully formulated <\/span><span style=\"font-weight: 400\">code called pseudo-random sequences. The received signals and the transmitted sequences are <\/span><span style=\"font-weight: 400\">compared, and the travel time for the signal is found by measuring when the two signals are most <\/span><span style=\"font-weight: 400\">closely correlated.<\/span><\/p>\n<figure id=\"attachment_26307\" aria-describedby=\"caption-attachment-26307\" style=\"width: 240px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-26307 size-full\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/12\/ConstellationGPS.gif\" alt=\"\" width=\"240\" height=\"192\"><figcaption id=\"caption-attachment-26307\" class=\"wp-caption-text\">Cool GIF from: https:\/\/en.wikipedia.org\/wiki\/Talk%3AGlobal_Positioning_System\/Archive_6<\/figcaption><\/figure>\n<p><span style=\"font-weight: 400\">Determining the position of an object on Earth is called ranging. For a GPS receiver to <\/span><span style=\"font-weight: 400\">accurately determine its position, a minimum of four satellites are needed. Three are needed for <\/span><span style=\"font-weight: 400\">the three physical dimensions but a fourth satellite is needed to help compensate for the effect of <\/span><span style=\"font-weight: 400\">spacetime relativity. <\/span><span style=\"font-weight: 400\">The satellite orbits are such that at least 4 are visible at anytime from any point on Earth <\/span><span style=\"font-weight: 400\">and every satellite uses an atomic clock with a nominal period of 1 nanosecond. To harness such <\/span><span style=\"font-weight: 400\">resolution, the actual period must be determined with an accuracy of about 20 nanoseconds and <\/span><span style=\"font-weight: 400\">requires taking into account General and Special Relativity theories.<\/span><\/p>\n<figure id=\"attachment_26308\" aria-describedby=\"caption-attachment-26308\" style=\"width: 960px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-26308 size-full\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/12\/gps-1826792_960_720.png\" alt=\"\" width=\"960\" height=\"587\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/12\/gps-1826792_960_720.png 960w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/12\/gps-1826792_960_720-600x367.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/12\/gps-1826792_960_720-768x470.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/12\/gps-1826792_960_720-800x489.png 800w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><figcaption id=\"caption-attachment-26308\" class=\"wp-caption-text\">Four satellites are needed to include solving for the variable time. Photo from here: https:\/\/pixabay.com\/en\/gps-satellite-navigator-scheme-1826792\/<\/figcaption><\/figure>\n<p><span style=\"font-weight: 400\">General Relativity predicts that being farther from the Earth\u2019s mass results in less <\/span><span style=\"font-weight: 400\">spacetime curvature and thus clocks on the satellites would appear to move faster than clocks on <\/span><span style=\"font-weight: 400\">Earth, leading by 45 microseconds per day due to the satellite\u2019s distance from the surface of the <\/span><span style=\"font-weight: 400\">Earth. Special Relativity predicts that since the satellites are moving relative to an observer on <\/span><span style=\"font-weight: 400\">the ground, the clocks on the satellites would appear to move slower and would lag clocks on <\/span><span style=\"font-weight: 400\">Earth by 7 microseconds per day due to the satellite\u2019s distance from the surface of the Earth. <\/span><span style=\"font-weight: 400\">The combination of these two effects results in a net difference of satellite clocks leading <\/span><span style=\"font-weight: 400\">Earth clocks by 38 microseconds per day. Engineers took this into account before the satellites <\/span><span style=\"font-weight: 400\">were deployed by designing the satellite atomic clocks frequency to slow down appropriately as <\/span><span style=\"font-weight: 400\">they approached their designated orbit to match the atomic clock frequency on Earth. <\/span><\/p>\n<p><span style=\"font-weight: 400\">GPS receivers also contain circuitry to calculate the 3D trilateration and compensate for <\/span><span style=\"font-weight: 400\">the effects of Relativity. Further, the signals that the satellites transmit are microwaves, which <\/span><span style=\"font-weight: 400\">move at the speed of light; this means that the wave\u2019s velocity is known. The GPS receiver <\/span><span style=\"font-weight: 400\">compares the time the signal left the satellite to the time it receives the signal and multiplies that <\/span><span style=\"font-weight: 400\">offset by the known velocity of the signal to calculate the distance to the satellite. <\/span><span style=\"font-weight: 400\">Trilateration is the process the GPS receivers use to determine their position on the Earth <\/span><span style=\"font-weight: 400\">by comparing the distances between at least 4 satellites to pinpoint a location that satisfies those <\/span><span style=\"font-weight: 400\">distances. Exactly how the receiver calculates this information given the sensed GPS satellite <\/span><span style=\"font-weight: 400\">signals was indeterminable from our research. Our report in the <a href=\"https:\/\/www.hackster.io\/ian-etheridge\/group-gps-tracking-and-environmental-data-system-0c46e5\">overall project<\/a> shows the system of equations to <\/span><span style=\"font-weight: 400\">determine position based on data from at least 4 satellites<\/span><span style=\"font-weight: 400\">. GPS receivers are constructed such that <\/span><span style=\"font-weight: 400\">they know the codes sent from each satellite and can distinguish between them.<\/span><\/p>\n<p>Pretty wild, huh? That&#8217;s what I was able to learn about GPS and the <a href=\"https:\/\/digilent.com\/shop\/pmod-gps-gps-receiver\/\">PmodGPS<\/a> in the time I had available. I had a big happy nerd moment getting to write about Relativity Theories. If you have anything to add or can clarify any muddy points, please comment below!<\/p>\n<p>Here&#8217;s links to the posted projects again:<\/p>\n<p><a href=\"https:\/\/www.hackster.io\/ian-etheridge\/group-gps-tracking-and-environmental-data-system-0c46e5\">Group GPS Tracking and Environmental Data System<\/a>&nbsp;&#8211; (overall project using Arduino Mega and Raspberry Pi microcontrollers)<\/p>\n<p><a href=\"https:\/\/www.hackster.io\/ian-etheridge\/gps-tracking-system-with-arduino-uno-and-digilent-pmodgps-ccee81\">GPS Tracking System with Arduino Uno and Digilent PmodGPS<\/a> &#8211; (focused project using an Arduino Uno microcontroller)<\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-26280 jlk' data-task='like' data-post_id='26280' data-nonce='ac068a413b' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-26280 lc'>+1<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-26280 jlk' data-task='unlike' data-post_id='26280' data-nonce='ac068a413b' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-26280 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-26280 status align-left'><\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Discover how GPS systems work with the PmodGPS!<\/p>\n","protected":false},"author":49,"featured_media":26307,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[38,4327],"tags":[],"ppma_author":[4459],"class_list":["post-26280","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-expansion-modules","category-projects"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2018\/12\/ConstellationGPS.gif","jetpack_sharing_enabled":true,"authors":[{"term_id":4459,"user_id":49,"is_guest":0,"slug":"ian","display_name":"Ian Etheridge","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/04e89e2073e59253a0b117ef28da1c647ca307c1e5f7bf024c1c3e8289c2e026?s=96&d=mm&r=g","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/26280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/49"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=26280"}],"version-history":[{"count":0,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/26280\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/26307"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=26280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=26280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=26280"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=26280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}