# Microcontroller and GPS

#### Ronda123

Joined Feb 3, 2023
8
Hello

I am looking for help. I am trying to understand that how any object is tracked with the help of GPS. I am not talking about any specific microcontroller or GPS right now because my primary focus is to understand how the location of an object is detected by GPS using microcontroller.

I have read many articles, I found in my research that we need microcontroller, GPS transmitter and GPS receiver to detect the location of the object. GPS transmitter continuously sends the location of the object to the receiver. The receiver communicates with the microcontroller to store the object data.

I am trying to understand what information the microcontroller gets from the receiver and how it decodes the information to get the location of the object.

#### MrChips

Joined Oct 2, 2009
28,129
Welcome to AAC!

There are numerous sources on the internet which describe GPS. I am sure you can find the information there.
If there is one source that comes close to answering your questions then you can come here with a specific question with a link to the source.

#### Papabravo

Joined Feb 24, 2006
19,847
AFAIK objects are not tracked with GPS. The GPS transmitters are located on multiple satellites in circular orbits, in the equatorial plane, at an altitude of 35,786 km. The GPS receiver is used by an individual or vehicle to navigate from one position to another on the surface of the globe. Tracking your cellphone is an altogether different proposition.

#### Ronda123

Joined Feb 3, 2023
8
Welcome to AAC!

If there is one source that comes close to answering you questions then you can come here with a specific question with a link to the source.
Thank you very much for helping me. I'm looking for help understanding the material in the link below.
https://circuitdigest.com/microcontroller-projects/gps-interfacing-with-pic16f877a.

I want to understand at what time interval the GPS transmitter sends the data to receiver and how the microcontroller is decoding it.

#### Ronda123

Joined Feb 3, 2023
8
AFAIK objects are not tracked with GPS. The GPS transmitters are located on multiple satellites in circular orbits, in the equatorial plane, at an altitude of 35,786 km.
The object moves from one place to another, can come under multiple satellites.

Does it mean that whatever satellite the object comes under, that satellite sends object information to the receiver.

#### MrChips

Joined Oct 2, 2009
28,129
As already stated, GPS satellites do not send location information to a GPS receiver.

There are many GPS satellites in orbit of which at least 24 are operational. At any place on earth, a GPS receiver should be able to receive signals from 4 satellites. Each satellite transmits information pertaining to its location and time of transmission. The satellite knows nothing about your GPS receiver nor its location. The GPS satellite does not know that your GPS receiver has moved from one location to another.

https://www.howtogeek.com/137862/htg-explains-how-gps-actually-works/

#### Papabravo

Joined Feb 24, 2006
19,847
As already stated, GPS satellites do not send location information to a GPS receiver.

There are many GPS satellites in orbit of which at least 24 are operational. At any place on earth, a GPS receiver should be able to receive signals from 4 satellites. Each satellite transmits information pertaining to its location and time of transmission. The satellite knows nothing about your GPS receiver nor its location. The GPS satellite does not know that your GPS receiver has moved from one location to another.

https://www.howtogeek.com/137862/htg-explains-how-gps-actually-works/
To continue with this description, the GPS receiver uses orbital data of the known geosynchronous orbits and looks at the phase differences in the arrival times of signals with known times of transmission and can process at least 4 of them to create an accurate fix on the location of the receiver. ALL of the computations are done in the receiver and the GPS unit you use for navigation does not have a transmitter that can "phone home". Your cellphone is the thing that CAN be tracked by pinging it from multiple cell towers.

#### WBahn

Joined Mar 31, 2012
28,177
AFAIK objects are not tracked with GPS. The GPS transmitters are located on multiple satellites in circular orbits, in the equatorial plane, at an altitude of 35,786 km. The GPS receiver is used by an individual or vehicle to navigate from one position to another on the surface of the globe. Tracking your cellphone is an altogether different proposition.
Uh...no.

The GPS constellation uses 24 operational satellites in six orbital planes at an altitude of 20,180 km MSL. They are in medium Earth orbit, not geosync.

#### Papabravo

Joined Feb 24, 2006
19,847
Uh...no.

The GPS constellation uses 24 operational satellites in six orbital planes at an altitude of 20,180 km MSL. They are in medium Earth orbit, not geosync.
My mistake, but their actual orbit hardly matters when it comes to their operation. That is why the need more than a few so that there are a sufficient number to provide continuous coverage.

#### WBahn

Joined Mar 31, 2012
28,177
Thank you very much for helping me. I'm looking for help understanding the material in the link below.
https://circuitdigest.com/microcontroller-projects/gps-interfacing-with-pic16f877a.

I want to understand at what time interval the GPS transmitter sends the data to receiver and how the microcontroller is decoding it.
All of the GPS satellites are simply broadcast stations. They each transmit a slightly different signal continuously. The receiver examines all of the signals and uses them to determine their position from that information. The satellites do NOT communicate directly with a receiver -- the satellites are completely unaware of who is listening to their signals.

Imagine that you had three radio stations on the ground and each one of them, on a different frequency, simply sent out a signal that counted up, say, "One, Two, Three, Four....", when they get to some high number, say a thousand, they start over. They are all coordinated so that they each say the same value at the same time. You are standing at some location and listening to all three broadcasts and you notice that you hear Station A say, "Twelve" at the same time that you hear Station B say, "Ten". From this you can conclude that you must be closer to Station B than Station A. If you the exact time that the stations were supposed to start their sequence over, along with the rate at which they advance their count, and you know the exact time that you heard them, you can figure out how far you are from each station. If you know the exact location of each station, you can then just use a bunch of trig and algebra to calculation where you are located.

But what if you didn't know the exact time where you are at (or your watch just wasn't accurate enough)? Simple. Just add a fourth station to the mix and then treat time as a fourth unknown and solve for it as well as your three-dimensional location.

That's basically how GPS works. It is constantly broadcasting information about the orbital path of each satellite and that signal is modulated with a pseudorandom bit stream that the receiver locks onto and which serves the purpose of the counter in the example above. The orbital path information allows the receiver to determine exactly where the satellites were when they broadcast the signal that was received. It also includes information that allows the receiver to compensate for atmospheric conditions that affect the signal as well as relativistic effects due to the relative velocities of the satellites compared to the receiver.

#### djsfantasi

Joined Apr 11, 2010
8,783
I want to understand at what time interval the GPS transmitter sends the data to receiver and how the microcontroller is decoding it
The GPS Satellite (transmitter) is continuously sending data, so the time interval is not used by the microcontroller. And the microcontroller is not decoding the data. The GPS Receiver does all that.

The Receiver presents latitude, longitude and height data directly to the microcontroller in preformatted messages. Several messages are not typically used; the $GPGGA message contains the position data. The microcontroller DOES have to serially read the data from the Receiver, identify the GPGGA message and parse the message to retrieve the position data. #### camerart Joined Feb 25, 2013 3,376 Hello I am looking for help. I am trying to understand that how any object is tracked with the help of GPS. I am not talking about any specific microcontroller or GPS right now because my primary focus is to understand how the location of an object is detected by GPS using microcontroller. I have read many articles, I found in my research that we need microcontroller, GPS transmitter and GPS receiver to detect the location of the object. GPS transmitter continuously sends the location of the object to the receiver. The receiver communicates with the microcontroller to store the object data. I am trying to understand what information the microcontroller gets from the receiver and how it decodes the information to get the location of the object. Hi R, Hopefully from earlier replies, you now understand what the GPS satellites are doing. Connect the GPS module to the Microcontroller, (Usually) using the RX PIN. A sentence like this:$GPRMC,191410,A,4735.5634,N,00739.3538,E,0.0,0.0,181102,0.4,E*19
arrives. The red section shows the time, and the blue section shows the Location, of your GPS module. There are lots of other inputs, like Altitude etc.

The microcontroller then PARSES these DATA into usefull forms for you to use.
C

#### Jon Chandler

Joined Jun 12, 2008
506
A simplified description might be that the GPS triangulates the signals sent at the same instant from a number of satellites. The difference in time the signals are received from each satellite allows computing the position of the receiver, which is sent to the microcontroller in terms of latitude and longitude.

#### Ronda123

Joined Feb 3, 2023
8
Thanks to all of you for your help.

I understood that GPS receiver continuously transmit the GPS data to microcontroller via UART. GPS transmit One character at a time. The microcontroller store the data received from the receiver in buffer.

In in a program we have to define the buffer size that how much capacity of string we want to store.

What is the maximum length of string that GPS receiver transfer to the microcontroller via UART ?

#### ericgibbs

Joined Jan 29, 2010
17,157
Hi Ronda,
Is this a college or homework assignment.?

I use an 80 byte buffer for the GPS message, test for the EOL <crlf>
Typical 9600,N,8,1
It is transmitted at a One Second rate from the satellite.
E

#### camerart

Joined Feb 25, 2013
3,376
Thanks to all of you for your help.

I understood that GPS receiver continuously transmit the GPS data to microcontroller via UART. GPS transmit One character at a time. The microcontroller store the data received from the receiver in buffer.

In in a program we have to define the buffer size that how much capacity of string we want to store.

What is the maximum length of string that GPS receiver transfer to the microcontroller via UART ?
Hi R,
As E says 80 is fine for whole sentences, as I only need TIME and LOCATION, I use 45. Between $and W. I use U-blox and U-centre where I have changed the sentence output to 5/sec. C. Thread Starter #### Ronda123 Joined Feb 3, 2023 8 Hi Ronda, Is this a college or homework assignment.? I am a mechanical engineer but I have interest in electronics. I use an 80 byte buffer for the GPS message, test for the EOL <crlf> Typical 9600,N,8,1 It is transmitted at a One Second rate from the satellite. E Hi R, As E says 80 is fine for whole sentences, as I only need TIME and LOCATION, I use 45. Between$ and W.
https://en.m.wikipedia.org/wiki/NMEA_0183#:~:text=NMEA 0183 is a combined,Marine Electronics Association (NMEA).

I am getting confused between the message and the sentence. I think there may many sentence in one message

Code:
$GPGGA,092750.000,5321.6802,N,00630.3372,W,1,8,1.03,61.7,M,55.2,M,,*76$GPGSA,A,3,10,07,05,02,29,04,08,13,,,,,1.72,1.03,1.38*0A
$GPGSV,3,1,11,10,63,137,17,07,61,098,15,05,59,290,20,08,54,157,30*70$GPGSV,3,2,11,02,39,223,19,13,28,070,17,26,23,252,,04,14,186,14*79
$GPGSV,3,3,11,29,09,301,24,16,09,020,,36,,,*76$GPRMC,092750.000,A,5321.6802,N,00630.3372,W,0.02,31.66,280511,,,A*43
$GPGGA,092751.000,5321.6802,N,00630.3371,W,1,8,1.03,61.7,M,55.3,M,,*75$GPGSA,A,3,10,07,05,02,29,04,08,13,,,,,1.72,1.03,1.38*0A
$GPGSV,3,1,11,10,63,137,17,07,61,098,15,05,59,290,20,08,54,157,30*70$GPGSV,3,2,11,02,39,223,16,13,28,070,17,26,23,252,,04,14,186,15*77
$GPGSV,3,3,11,29,09,301,24,16,09,020,,36,,,*76$GPRMC,092751.000,A,5321.6802,N,00630.3371,W,0.06,31.66,280511,,,A*45
Does the micro controller store all the sentences or store the specific sentence that is needed

#### ericgibbs

Joined Jan 29, 2010
17,157
hi R,
This is the Message of interest for position.$GPGGA,$GPGGA,092751.000,5321.6802,N,00630.3371,W,1,8,1.03,61.7,M,55.3,M,,*75

These are the Coordinates you need.
5321.6802,N,00630.3371,W. ie: Lat and Long

One technique to parse [select a parameter] from the full message is to count the 'Commas' location.

E