Search Site

Where’s my wheels? – A GPS and GSM collaborative project

This project allows you to use the functionalities of a GPS alongside a GSM module.

It was based on the idea that this product could sit in your car, and if you ever lost it (in a busy car park say) you’d simply be able to text a number and it would give you directions.

To do this we need to combine a GPS, (so the project can know where it is), and a GSM module, (so it can send and receive texts).

GSM (or Global System for Mobile) is the network that allows your phone to send and receive texts, make calls, and even access the internet.

In our project we are using the Arduino GSM Shield ( to access this network.

This will allow us to send and receive texts from the Arduino.

GPS (or Global Positioning System) is the satellite location system that enables us to find out where on the planet we are.

In our project we use the Adafruit Ultimate GPS ( to allow the Arduino to connect to the GPS network.

Above you can see our setup, we have the Arduino (UNO) with the GSM shield attached, and a miniature breadboard attached to the shield where our GPS module is sitting. The Vin and ground connections to the GPS go to 5V and ground respectively. The Rx pin goes to pin 9 on the Arduino, and the Tx pin to pin 8.

This is all the hardware required for the project! The rest is all in software!

In the code (which you can download free from this website), we use several libraries to interface with the different modules.

We use the GSM library to interface with the GSM shield, and the AltSoftSerial and TinyGPS++ libraries to talk to the GPS.

We chose these libraries because they all work effectively together and the TinyGPS++ library is incredibly easy to use and effective.

However, because we are using the AltSoftSerial library, it requires the use of pins 8 and 9 for the GPS Rx and Tx, so the Adafruit GPS logger shield won’t work with these libraries.

The basic principle of the code is that it receives any texts sent to it, and if they contain the password (“Location” by default – you can edit it in the code) then the Arduino will send a text to whichever number texted it, with it’s current GPS coordinates.

The GPS coordinates will automatically update every second, and so you will always have an updated and accurate location whenever it sends.

All the code is available from this site,


though you have to treat them as a product and “check-out” with them, simply because of how the site works! They are all completely free though, and you can also download all the libraries required alongside them. The GSM library should be included in the Arduino IDE already if you have the most up to date version.

the Code;

/* --------------------------------------------------------------------------------------- */
/*                Where's my wheels - A GPS and GSM collaboration project                  */
/*                                                                                         */
/* Designed to send an sms with the current GPS coordinates of the Arduino to any phone    */
/* number which sends it the correct password.                                             */
/*                                                                                         */
/* Uses the AltSoftSerial library:  */
/* Uses the TinyGPS++ library:                */
/* Uses the in built GSM libary                                                            */
/* Download from the links above and unzip into your /ibraries folder.                     */
/* Follow the tutorial here:                          */
/*                                                                                         */
/* Uses an Adafruit Ultimate GPS:                     */
/* Uses an Arduino GSM shield:                  */
/*                                                                                         */
/* Created by Andrew Mallinson, Jacob Rawson and Tom Cousins                               */
/* --------------------------------------------------------------------------------------- */

#include <AltSoftSerial.h> //Include all relevant libraries - see above
#include <TinyGPS++.h>
#include <GSM.h>
#define PINNUMBER "" // PIN Number for the SIM - leave blank unless your SIM has a pin, this is inserted between ""

static const uint32_t GPSBaud = 9600; //Baud rate for communication with the GPS, Adafruit GPS = 9600, your GPS may well be 4800, check the spec

TinyGPSPlus gps; // The TinyGPS++ object for interfacing with the GPS

AltSoftSerial ss; // The serial connection object to the GPS device

String yourPassword = "Location"; // Put the password here between the ""
String password; // Temporary variable used for comparison of passwords

GSM gsmAccess; // Initialise the library instances
GSM_SMS sms;

char senderNumber[20]; // Array to hold the number a SMS is retreived from

void setup()
  ss.begin(GPSBaud); // begin the GPS serial connection
  Serial.begin(9600); // begin Serial communication with the computer at 9600 baud rate

  Serial.println("Where's my wheels?"); // Print to the computer
  boolean notConnected = true; // connection state

  while(notConnected) // until it connects
    if(gsmAccess.begin(PINNUMBER)==GSM_READY) // if it succeeds connecting
      notConnected = false; // connected
      Serial.println("Not connected"); // print to the computer
      delay(1000); //delay

  Serial.println("GSM initialized");      // print to the computer
  Serial.println("Waiting for messages");

void loop()
  while (ss.available() > 0) //while there is stuff in the buffer
    if (gps.encode( //if it can successfully decode it, do it. Else try again when more charachters are in the buffer
  if (sms.available()) // if a text has been recieved
    Serial.println("Message received from:"); // print to the computer

    sms.remoteNumber(senderNumber, 20); // assign the sender number to the "senderNumber" variable
    Serial.println(senderNumber); // print the sender number to the computer
    password = ""; // flush the temporary variable

    char c;
      password += c; // append the sms to the "password" variable

    Serial.println(password); // print the contents of the sms
    Serial.println("\nEND OF MESSAGE"); // print to the computer

    sms.flush(); // delete message from modem buffer
    Serial.println("MESSAGE DELETED"); // print to the computer

    if (password == yourPassword) // if the sms contains the correct password
      Serial.println("\nPASSWORD VALID"); // print to the computer
      sms.beginSMS(senderNumber); // begin an sms to the sender number
      sms.print(, 6); // append the lat to the sms
      sms.print(","); // append a comma
      sms.print(gps.location.lng(), 6); // append the lon to the sms
      sms.endSMS(); //send the sms
    else Serial.println("\nPASSWORD NOT VALID"); // print to the computer

  delay(1000); // delay

Back to top