The Linux Channel

TUTORIALS :: Using a GPS Sensor

Written by: Saumitra Kapoor, edited by Kiran Kankipati
Published: 28-Jul-2017

 

A GPS receiver uses satellites to pinpoint locations, so as long as you have a GPS receiver and a clear view of the sky, you'll never be lost again!

Have a look at this amazing site to know more about a GPS Sensor: http://electronics.howstuffworks.com :: How GPS Receivers Work

I would suggest have a look at how the GPS receiver generates a Pseudo Random Code which has a mention in the given site. The GPS system uses an array of satellites orbiting around the earth and sending time information. It picks up the signal transmitted from the satellites, calculates the time it took for the signal to arrive, and by identifying the position of satellites, triangulates the position on the surface of the globe. It uses the standard NMEA protocol (http://www.nmea.org) to transmit the position data via serial port. Let us start exploring the world of GPS!

GPS Satellites


Here is a list of components needed:


Here are some images of this module:


Image Source: http://www.alselectro.com/images/GPS_3_thumb_0cdckk0l.jpg


Image Source: https://cdn.instructables.com/F0J/9T8J/IOT2UO46/F0J9T8JIOT2UO46.MEDIUM.jpg


Image Source: http://module143.com/image/cache/catalog/skg13bl-500x500.jpg


The connections are as follows:

Skylab SKG13BL GPS Receiver



GND of GPS ------------ GND of Arduino
3.3V of GPS ------------- 3.3V on Arduino

Note: Skylab SKG13BL: It is always a good practice to read the Datasheet. So here you go: http://www.alselectro.com/files/SkyLab_Datasheet.pdf
Note : You can even use a 12V Power source, but here we are using 3.3V.

Most microcontrollers these days have built in UARTs (universally asynchronous receiver/transmitter) that can be used to receive and transmit data serially. UARTs transmit one bit at a time at a specified data rate (i.e. 9600bps, 115200bps, etc.). This method of serial communication is sometimes referred to as TTL serial (transistor-transistor logic).

The last simple connection involves connecting the TLL from GPS to Arduino Board:
Rx of GPS -------- Tx of Arduino (Pin 3)
Tx of GPS --------- Rx of Arduino (Pin 4)

* Refer Pg.8 of the Datasheet.

Now, connect the G Mouse to the GPS Receiver and connect the Arduino board to the PC via USB.


Libraries/Dependencies:
Here are the required libraries we need to install.
Install the TinyGPS Library from here: http://arduiniana.org/libraries/tinygps/
Install the Software Serial Library: https://www.arduino.cc/en/Reference/SoftwareSerial


Please take care of the following:

  • Do not connect the GPS Module to Multiple Power Supplies.
  • Place the G Mouse at a spot where it can see the sky.
  • Please go through the Datasheet.
  • You can even use Putty to obtain output (in Windows) - http://www.putty.org/
  • If the code shows error, make sure to keep the Baud Rate to 9600.
  • If you face port or driver problem,
    Do this (in Windows): Control Panel > System and Security > System > Device Manager > Ports > Arduino UNO > Update Driver Software > Browse computer manually and choose the Arduino IDE folder.


Source code:
Download the code HERE.
Kindly remember to refer the previous step in case of Port Error.


Output:
The code will give the Latitude and Longitude. Make sure to divide the output by 10^6 to get correct coordinates.

You can also visit sites likes to map the points:


So here is the output it generates:

Position: lat: 26865785 lon: 80906375 Position: lat: 26865785 lon: 80906375 Position: lat: 26865785 lon: 80906375 Position: lat: 26865783 lon: 80906375 Position: lat: 26865783 lon: 80906375 Position: lat: 26865783 lon: 80906375 Position: lat: 26865783 lon: 80906375 Position: lat: 26865783 lon: 80906373 Position: lat: 26865783 lon: 80906373 Position: lat: 26865783 lon: 80906373 Position: lat: 26865783 lon: 80906373 Position: lat: 26865783 lon: 80906373 Position: lat: 26865783 lon: 80906373 Position: lat: 26865783 lon: 80906373 Position: lat: 26865783 lon: 80906373 Position: lat: 26865783 lon: 80906372 Position: lat: 26865783 lon: 80906372 Position: lat: 26865783 lon: 80906370 Position: lat: 26865783 lon: 80906370 Position: lat: 26865783 lon: 80906370 Position: lat: 26865783 lon: 80906370 Position: lat: 26865783 lon: 80906372 Position: lat: 26865783 lon: 80906372 Position: lat: 26865783 lon: 80906375


About me: Saumitra Kapoor
My name is Saumitra Kapoor and I am in love with Electronics, Circuits, Wires and Devices. I started learning everything about it long back from wherever I could and I haven’t stopped since. I try to read a lot, build fun projects and come up with tutorials.



Suggested Topics:

Network Software Development:
UDP sample socket code for Systems and Network software developers
02-Feb-2017

Research Projects:
Research Socket overhead in Linux vs Message Queues and benchmarking
21-Jun-2017

Linux (user-space), Systems Architecture:
Dynamic linking without STDLIB in Linux user-space C programming
05-May-2017
Linux user-space Atomic Operations via GCC Atomic builtins
22-Mar-2017
A Linux system call in C without a standard library
10-Mar-2017

Linux Kernel Software Development:
How to submit your Linux Kernel Patch
07-Feb-2017

Embedded Projects:
Using a GPS Sensor
28-Jul-2017
GPS Geo-tracking system using LinkIt ONE
11-Jan-2017



The Linux Channel - v5.45 :: Updated: 11-Oct-2017 :: © 2017 :: Author: Kiran Kankipati
Your IP: 54.157.81.13 :: Browser: CCBot/2.0 (http://commoncrawl.org/faq/)