GPS Module Interfacing With Raspberry Pi

GPS plays a prominent role in the present day navigation systems, starting out with smartphones and automobiles to much complex missile guidance systems. Yes!! the GPS is indispensable. That was, just to remind ourselves the importance of GPS and to understand how painstaking the navigation, without GPS, will be; plotting a course, getting lost, and finally finding the way.

Actual topic here, as the title says, is communication between the Pi and a GPS module and there by reading the latitude and longitude. This quick learning guide will be helpful to add position tracking to your Pi project. So lets start on the topic here.

Raspberry Pi, interfaced with a GPS module, can be used for developing an advanced real-time navigation system. Incorporating the Pi’s image processing, audio processing and web interface capabilities along with the GPS data  we can develop advanced navigation schemes for real-time implementation.

Modules Needed

  1. Raspberry Pi
  2. GPS Module
  3. Connecting wires
  4. Power supply (5v 100mA)

GPS module has four connection pins, namely: Vcc, GND, TX and RX. It requires a power input 5V 100mA ,which can be provided using any suitable supply source. The RX pin of Pi, i.e the 10th GPIO pin on the RPi board, should be connected to the TX pin of the GPS module. The GND pin of the GPS module and the GND pin of the RPi board (6th pin) should be grounded properly.

Once the connection are made and the modules are powered, make sure that the  GPS module is kept in a place where the GPS has a clear view to the sky or at least near a window for reliable signal integrity. We may find problem receiving signals in indoor area, the GPS signal can get blocked by metal, deep forest, mountains etc.

Now open the python editor and program your Pi, to receive the serial data from the GPS module. A sample code is given below, which can be used as it is or you can modify it to suit your project.

To check out more details on the GPS  module, follow this link. If you are interested to  know more about serial communication in RPi, there is ‘Arduino-RPi Serial Communication‘ to go through.

 

So thats the code to locate your Pi. Once the Pi is on with this code, it will receive the location coordinates from the GPS and the same can viewed in the Python Shell.

Using this GPS data we can pinpoint the corresponding location on Google maps. If you are using ‘midori’ web browser, then the code given below can be used to locate the coordinates.

call(“midori https://www.google.co.in/maps/@latitude,longitude“)

The latitude and longitude values, received from the GPS module, should be concatenated with the address link. An example is shown below.

call(“midori https://www.google.co.in/maps/@9.6385,77.0059″)

The ‘call‘ function is used to run terminal commands using Python. To import the call function add the following code at the beginning of your program.

from subprocess import call

We can also get the location address using the GPS data. The following link gives the location address for corresponding GPS data

http://maps.google.com/maps/api/geocode/json?address=lattitude,longitude

Open up this link on your browser, using the ‘call‘ function, and you will get the location address.

Shop With Us

  • Click here to buy Raspberry Pi 2 from RhydoLabz.
  • Click here to buy Raspberry Pi 2 Starter Kit from RhydoLabz.
  • Click here to buy Raspberry Accessories from RhydoLabz.
  • Click here to buy GPS Receiver with Antenna (5V TTL SERIAL) from RhydoLabz.

Resources

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">