1. You can now buy finished microcontroller project from us, Check out the Store for the complete list of projects.
  2. Need a custom project, Send us some details about your project. So that we can quote the price for it.

Connecting GPS to PC using Visual Basic 1.0

Connecting GPS to PC using Visual Basic through serial port.

  1. Binu
    This tutorial is about Serial Communications using Visual Basic with Trimble's LassenLP GPS reciever. This GPS reciever can be intefaced and controlled via a computer using a serial cable. The GPs system provides nearly accurate information on the position (i.e latitude, longtitute , Altitude) or Velocity of an object on earth. This messsage on the computer can be extracted from the Lassen LP system using Windows Hyperterminal. Using Hyperterminal is not an easy way to understand the message as it has to be extracted and converted for a ordinary person to be able to understand. This tutorial provides an visual basic code to serially extract the data, convert it appropriately and display it on an screen

    Advantages of Using Lassen LP GPS Module
    The LassenLP is a miniature, low- powered, high performance GPS receiver module. It uses only 3.3 volts. Because of its miniature size and low power operations, it can be embedded into many portable devices such as the palm, laptop computers, handheld radios, cell phones, automobile navigation systems and space navigation systems. . Because of its micro-sized board, the system integrator can easily fit GPS functionality into portable products. Lassen LP GPS module allows portable device developers to balance operational frequency and power consumption for a particualar application.

    Motivation and Audience
    Gps systems are an important aspect of life today. Today they are incorporated in any mobile equipment right from an cell phone to an automobile to a ship or also an Aeroplane. GPS systems aids in Naigation by providing the position (i.e latitude, longtitute , Altitude) or Velocity of an object.
    This tutorial explains an visual basic code to interface serially with an LAssenLP GPS reciever and extract positional and velocity information from it. IT doesnot discuss about the GPS theory or the protocols used.

    The rest of the tutorial is presented as follows:

    Using HyperTerminal with an GPS Reciever
    HyperTerminal is an program on an windows machine used to display information that is recieved on the serial port of an computer. The Lassen LP is connected to the serial port of a computer with communication setting being 4800 baud 8bit , 1 stop bit and no flow control. The information from the gps system is updated every few seconds and is as displayed in the hyper terminal window.
    [​IMG]
    Understand and Simplify the GPS Code
    A sample positon and velocity information from the GPS receiver is shown below. The ">" informs the beginning of the message and "<" indicates the end of the message. The letter RPV tells us that it is an response from the GPS reciever about position/velocity.

    >RPV07559+4026178-0748913800000012;*76<

    This is an Position/ Velocity information from the GPS receiver. IT could be dissected as follows. The DataString similiar to above

    AAAAABBBCCCCCDDDDEEEEEFFFGGGHI


    AAAAA This indicates the GPS time of the Day and it is in secs

    BBB,CCCCC This indicates the Latitude in Degrees

    DDDD,EEEEE This indicates the Longtitude in Degrees

    FFF This indicates the velocity of the speed if the reciever is moving

    GGG This indicates the direction in degrees.

    HThis indicates the source of data

    I This indicats the Age of Data whether it is Current or archieved

    Visual Basic Source Code and a Brief Explanation
    Here is a code with an easy to understand front end GUI as shown in the pic. The code can be downloaded LassenLP.zip rather then cutting and pasting from here.

    The GUI is like this
    [​IMG]
    The source code is as follows
    Code (Text):
    1. Private Sub cmdClose_Click()
    2. MSComm1.PortOpen = False
    3. End Sub
    4.  
    5. Private Sub cmdQuery_Click()
    6. MSComm1.Output = ">QPV<" 'to query the position"
    7. Dim mystring
    8. mystring = MSComm1.Input
    9. ' From this string we need to get the needed data
    10. Dim time
    11. time = Mid(mystring, 5, 5)
    12. txttime.Text = time
    13. Dim Latitude
    14. Latitude = Mid(mystring, 11, 8)
    15. txtLatitude.Text = Latitude
    16. Dim Longtitude
    17. Longtitude = Mid(mystring, 20, 9)
    18. txtLongtitude.Text = Longtitude
    19. Dim Velocity
    20. Velocity = Mid(mystring, 30, 3)
    21. txtVelocity.Text = Velocity
    22. Dim heading
    23. heading = Mid(mystring, 34, 3)
    24. txtheading.Text = heading
    25. End Sub
    26.  
    27. Private Sub cmdStart_Click()
    28. MSComm1.PortOpen = True
    29. End Sub
    In the above program, as seen from the GUI, We would first open the com port. Then we would query the data from the Lassen LP reciever by sending the command ">QPV<". This is done when we hit the GET DATA button. Once the data is got from the reciever it is stored in an string and needed information such as time,postion, velocity is extracted as shown in the program.
    The above program showed us how to capture position/velocity information, similiarly we can get information on altitude as well. Also in the above program, we would collect data only when we needed, i.e by clicking on the GET DATA button. We could also automate the process whereby the data would kee[ updating itself every 3 seconds or so.A whole lot can be done with this GPs system. This is just a part of it.
    Final Words
    We have presented here a tutorial on how to program using visual basic to interface a GPS system to a computer using Serial Port. With this basics in mind, now we can now implement GPS systems for Navigational purposes.
    References and Links
    Current Information on GPS
    Trimbles Website Manufacturer of the LAssen LP GPS
    A very good online tutorial on GPS
Loading...