Providing Smart Technology Solutions


Hi  friends, you have seen how to use simple piezo element from  piezo buzzer to use as a crash sensor in my previous post. If you hadn’t then you can read it at:


After detection of crash, we have to find the location of the vehicle which will be done by a GPS. A GPS is a device that locates the its position by making use of timing signals from the 24 set of medium earth orbit satellites. I will not discuss the working of GPS (you can read it from Wikipedia) over here but coming to the point I used “GR 87” GPS receiver for my project. I brought it from the local shop for Rs 2000 or 45 $ approx. It consists of a long external antenna, which can be fitted at the roof top of the car.

Some images of the GR-87 is shown below:

Its external antenna-

Its connector:-

Fully connected:-

Fully Connected

In the first picture you can see a db9 port is given to the GPS. This port uses rs 232 standard i.e 0 to 9 or 12 volt logic level. This can not be given directly to the microcontroller because it is too high. So we have to make an interfacing circuit using max 232 which will convert this high voltage level into the range of 0 to 5 volt for our controller. But to save time, I found the ttl (transistor-transistor level) level form the GPS and soldered a wire through it which is also shown in the picture above. Thus I directly connected the receive pin of my arduino to the tx (transmit) pin of GPS.

This was all about the hardware connections. Now we have to work on the software part.

A GPS receiver always receives signals from the satellite, calculates its position and transmits it from its tx pin. So all we have to do is to receive the data from the GPS ad use it.

The information send by the GPS receiver is in the form of NMEA standard and along with latitude and longitude, it gives more information like UTC time, height above sea level, north or south, east or west ,data valid(A) or invalid (V), etc.

To read these data, first connect the GPS receiver with a db 9 cable to the pc. Use terminal software to read the incoming data coming from the GPS receiver. A sample which I received is shown below:

























On reading the NMEA manual you will find which part of data will give you the desired information.



If you don’t have the connecting cable and the db 9 port, you can use arduino for reading the data. Connect the arduino to the computer and the GPS receiver. Run the code shown below and open the serial monitor to see the data. The code is given below:-


//include the software serial library.

#include <SoftwareSerial.h>


//declare the transmit and receive pins.

SoftwareSerial  GPS = SoftwareSerial(2,3);


void setup(){

// Set baud rate for communicating with pc.



//Set baud rate of the software port which we just created.

GPS.begin (9600);



void loop() {

Serial.print(GPS.read(), BYTE);



Now I will be giving the code which I used for GPS in my project. It is given below:-



// include the SoftwareSerial library

#include <SoftwareSerial.h>


// Constants

#define rxPin 9      //rx pin in gps connection

#define txPin 8      //tx pin in gps connection


// set up the serial port


SoftwareSerial gps = SoftwareSerial(rxPin, txPin);


// variables

byte byteGPS = 0;

int i = 0;

int h = 0;


// Buffers for data input

char inBuffer[300] = “”;

char GPS_RMC[100]=””;



void setup(){


//setup for mySerial port

pinMode(rxPin, INPUT);

pinMode(txPin, OUTPUT);



//setup for Serial port






void loop(){


// Read the RMC sentence from GPS

byteGPS = 0;

byteGPS = gps.read();

while(byteGPS != ‘R’){

byteGPS = gps.read();







i = 4;

while(byteGPS != ‘*’){

byteGPS = gps.read();





// print the RMC sentence to USB

Serial.print(“Location Is: “);

h = 0;

while(GPS_RMC[h] != 42){







Running the program on our setup will give us the latitude and the longitude information.


Now, I will tell you my work on GSM the third part of “VEHICLE CRASH MONITORING SYSTEM, PART- 2

” .


Please comment …



  1. Pingback: VEHICLE CRASH MONITORING SYSTEM, PART- 3 « Abishai Singh

  2. vengai
    October 15, 2012


    February 17, 2013

    Instead of GR-87 am using skg13c GPS module , and am having difficulty in recognising the pin connection of the module with arduino using TTL . Please help in establishing ttl connection for this board SKG13C
    Thanking You

    • Abishai
      February 17, 2013

      Hi Avishek, I don’t know about skg13c GPS module, but when I googled it I found something which I would like to paraphrase over here. It says that the serial connections work at 2.85v LVTTL .e low voltage transistor transistor logic levels. So I guess, the use of a level convertor is mandatory over here.

  4. Shifalika
    March 18, 2014

    do u use a lcd display with gps too?

  5. Pulkit
    April 28, 2014

    Hi Abishai, I tried using your code but for some reason I’m getting the GPS output in the wrong encoding format.

    Location Is: $GPRMC¬°°°•”‘.055¬Ö¬¸™–ž˜˜˜˜,N,0°°°°Ž˜”¡–0.00,°®°°Œ–‘˜,,,N

    How do I correct this? Please help! I’m using GTPA006 antenna & arduino mega board.

  6. vignesh
    January 25, 2015

    Nice project..can u help me.. I am doing final year cse.. I wish to do this project for this semester..can u send me the report and full instructions..

  7. Amr
    February 28, 2015

    it’s make any different that using grove collision sensor
    and if it’s not make any different
    tell me please how to adjust the sensitivity
    this is my code :

    int Led = 7 ;
    int buttonpin = A0; //
    int threshold = 1000;//
    void setup ()
    pinMode (Led, OUTPUT) ;
    pinMode (buttonpin, INPUT) ;
    void loop ()
    int sensorState = analogRead(A0);

    if (sensorState <= threshold)
    digitalWrite (Led, LOW);
    digitalWrite (Led, HIGH);

    it's working but doesn't give me the result

  8. newbie
    May 9, 2015

    change Serial.print(xxxx, BYTE) by Serial.write(xxxx) and the program will work fine. also when you are copy pasting the prog be careful while you put ” ” . Thanks BTW.

  9. niyas
    March 19, 2016

    error: stray ‘\342’ in program char inBuffer[300] = “â€?
    wht is the error

  10. Esra'a
    April 20, 2016


    Sir, I do exactly like your project , and I used GPS module but unfortunately she didn’t work I don’t know whay

    Can you help me, and given me a solution

Leave a Reply...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


This entry was posted on June 17, 2012 by in Uncategorized.

Physical Computing Mini-Projects


fun and learning with electronics


Providing Smart Technology Solutions

%d bloggers like this: