In order to be able to display GPS coordinates on google maps, we need to understand what GPS is. We provide some basic knowledge as follows:

       A GPS is a system of 27 satellites (including three shells) that travel across orbit around the earth. The US military developed this system for military purposes but now it has been extended for civilian purposes.

       Each satellite weighs about 2 tons, using solar energy, moving about 19300 km above the ground. Each satellite orbits around the earth 2 rounds a day and night. The orbits of satellites are calculated so that at any place on earth, at any given time, it is possible to "see" at least four satellites.




The work of a GPS receiver is to locate 4 or more satellites, calculate distances from satellites and use that information to determine its location. This process is based on a simple mathematical principle.

  • The latitude (symbol: φ) of any point on the surface of the Earth is the angle formed by the vertical line (the center of the line, whose top is at the center of the coordinate system-the center of gravity) at the point that is, and the plane created by the equator. Roads created by points of the same latitude are called latitudes, and they are concentric circles on the surface of the Earth. Each pole is 90 degrees: the north pole is 90 ° B; The south pole is 90 ° N. The 0 ° vertical is designated as the equator, an imaginary line dividing the globe into the Northern Hemisphere and the Southern Hemisphere.
  • The longitude (symbol: λ) of a point on the surface of the Earth is the angle created between the plane of the meridian passing through that point and the root plane of meridians. Longitude can be either east or west longitude, with apex at the center of coordinates, made up of a point on the surface of the Earth and a plane made up of random lines connecting north and south poles. Straight lines created by points of the same longitude are called meridians. All of the meridians are semi-circular, and not parallel: by definition they converge at north and south poles. The straight line passing through the Royal Greenwich Observatory (near London in the United Kingdom of Great Britain and Northern Ireland) is a 0 ° longitude reference line around the world known as the prime meridian. The opposite of Greenwich is 180 ° T or 180 ° E.

 By combining these two angles, one can determine the horizontal position of any point on Earth.

 There are many ways to write degrees, all of them appear in the same order Latitude - Longitude:

  • DMS (Degree: Minute: Second) Degree: Minutes: Seconds (Example: 49 ° 30'00 "-123d30m00s)
  • DM (Degree: Minute) Degree: Min (49 ° 30.0'-123d30.0m)
  • DD (Decimal Degree) Decimal Degree (Example: 49.5000 ° -123.5000d), usually with 4 decimal places.

     To switch from DM or DMS to DD, decimal degrees = degrees plus minutes divided by 60, plus the number of seconds divided by 3600. DMS is the most common format, and is standard across all charts and maps, as well as global positioning and geographic information systems.

      Back to the subject that AT-COM today would like to introduce to you, the purpose of this topic is to verify the accuracy of the GPS coordinates when received. Help you get the basics to develop the topic if you like. As for the test sequences as well as the AT Command for GPS commands we introduced in the previous article, if you forgot you can refer to here:

       Our system uses a SIM908 breakout that communicates with the PIC16f887 microcontroller to perform GPS coordinate updates. About the footprint and structure of the Sim908 Breakout you can refer to the breakout SIM908.

       The system will design the circuit based on the SIM908 breakout circuit diagram.

       The following is a detailed explanation of the system, based on this system you can fully deploy a similar application system to a greater extent, it is entirely possible.

       c. System block diagram:

       For you to imagine more than the system, you can refer to the following block diagram.




       The simple configuration consists of a central processor block communicating with the SIM908 Breakout through a UART port, the central processing unit whose most important task is to send commands requesting the SIM908 for coordinates and processing. The sequence of coordinates obtained, in addition, also checks the message request that the message user to execute the request.

       The SIM908 Breakout Block is a bridge for GPS and GSM data acquisition. Deliver content to users.

       The power supply is used to supply power to the entire system, the power supply with large currents to ensure stable system operation.

  • Power source:




       The requirement of the power supply block is to be sufficiently strong to provide the most stable system load. Here we choose to use the source with the LM2596 -ADJ source IC that can provide up to 3A load current, supplying the voltage divider up to a stable 3.3V voltage level for the SIM and microprocessor blocks with The formula is as follows:

       Vout = 1.23 (1 + R8 / R7)

       Select the value R8 = 3K9 and R7 = 2K2 to output the value Vout = 3.3V.


  • Microprocessor:




       The microprocessor carries out all important tasks in the circuit, taking care of the task of receiving the received GPS string and conducting the alarm for the user upon request.

       The microprocessor is selected using PIC16F887 as the central processing IC, interfacing with the SIM908 Breakout via two pins Tx (leg 25), Rx (pin 26). Can explain the entire process of PIC in the system as follows:

       The first step after the power supply system is definitely the SIM908 startup as well as the GPS for the SIM908.




       Here are two programs that do that job, to activate SIM908 works just like the SIM900 need to click on pin number 1 of the high-level Breakout 1, pins PWU (pin B0) of the PIC will take care of that. Once completed click on, check the SIM activity by sending the AT command to the SIM card continuously, if it returns OK then the boot is considered complete.

       Next is to start the GPS system in SIM908, to activate the GPS system to send the following commands:





    The meaning and function of each command we introduced in the previous article, to save time we will not repeat, you can refer back here:

    The next step in implementing the program is to start asking the SIM908 to collect GPS data and process that data so that it can be displayed on the Google Map.




The order requires SIM908 to capture and collect GPS coordinates of the form:

       Printf ("AT + CGPSINF = 32");

       GPS SIM908 sent to microprocessors in the form of:






      Thus, the value 1050.746637 is the latitude value, 10639.579534 is the longitude value. The task of the processor is to get the string on and separate the longitude, latitude and longitude values, change the unit to match Google Map.

      As shown above, the GPS coordinates have three different unit types, our task is to change the unit to match the standard. The coordinates of the SIM908 return we need to convert to DD, formulas like star:

GT_gps = (Toa to / 100) + [(Toa to0) / 60]

For example:

          Latitude: VD = (1050.746637 / 100) + (50.746637 / 60) = 10 + 0.845 = 10,845

          Longitude: KD = (10639.579534 / 100) + (39.579534 / 60) = 106 + 0.659 = 106.659

      So the result after change is:

              Average: 10.845

              Longitude: 106.659

      The results displayed on Google Map are as follows:





      The last function of the microcontroller to do is to send the response coordinates to the user when requested by the user to the message. The program sends the message as follows:




      When a message arrives with a syntactically correct message, the processor will send an SMS request to SIM908. The AT Command syntax is as follows:

        AT + CMGS = "xxxxxxxxxxx" (xxxxxxxxxxx: is the phone number needed for IM)

      > message content

      After entering the message content and finally Ctrl + z to simulate and send the message.

       Here is the complete description of the GPS data collection and processing system, hope this article will help you in the study of GPS. The restriction of this article is that only updated coordinates and reports via mobile phone. When you need to see the location, you need a PC with Internet connection to view, the development direction is coming, AT-COM will introduce to you interface system to receive and display location on the phone. portable and does not need to turn on the PC. It will be introduced as soon as possible, you pay attention to follow.