Instructables
loading
loading
Bring out your 3D glasses and enjoy viewing in a novel way! I have added a new dimension to my instructable. If you do not have 3D glasses, then you can make one yourself. The following link explains how to make 3D glasses ( link ).

Please Note: This instructable contains 3D images which are best viewed with Red and Cyan 3D Glasses. However, for those of you who do not have 3D glasses, this instructable also contains 2D images.




Every year about 700,000 vehicles get stolen in US. In fact, a car is stolen every 45 seconds.

We all love our cars and whether it is a roaring Lamborghini or a purring Prius, we are attached to it and wish that it never gets stolen.

I am very attached to my family car and take lots of precaution that I do not park my car in secluded places or double check that I always lock my car when I park it anywhere and always carry my car keys with me. However, I am still worried whether my car is safe. In order to get rid of these genuine worries, I decided to design my own low cost car tracking system.

In this instructable, I have explained the process of building one's very own Global Car Tracking System -'Athena' - for a cost of just 100$. The steps for building this device is very simple and explained in a lucid manner. The skills required for you to build this is minimum (Basic knowledge about electronics and the Arduino IDE).

I have christened this device by the name 'Athena' because Athena is the Greek Goddess of navigation. 

So what are we waiting for.....let's get started.......

    
 
Remove these adsRemove these ads by Signing Up

Step 1: Parts Needed:

The following is a list of parts needed to build 'Athena' :-

Supplies :
  1. Arduino Uno
  2. Arduino GSM Shield (I have used a SIM900 GSM/GPRS Shield Module)
  3. GPS Module
  4. Adapter Plug for powering the Arduino
  5. 4pcs of LM7805 IC
  6. PCB
  7. Wires
  8. Male Header Pins
  9. Female Header Pins
  10. Project Enclosure
Tools :
  1. Soldering Iron
  2. Solder
  3. Soldering Wax
  4. Drill
  5. Hacksaw



 

Step 2: The Circuit: Voltage Regulator Circuit

Picture of The Circuit: Voltage Regulator Circuit
3D Regu.jpg
100_0786.JPG
3D Regu Down.jpg
100_0790.JPG
Voltage Regulator Schematic.png
The Arduino and GSM shield operate at voltages between 5 volts and 12 volts. Although the car has a 12 volt battery and electrical system, the voltage can sometimes spike up and damage the Arduino if connected directly. Hence to be on the safer side, I have decided to use an LM7805 Voltage regulator to regulate the 12 volts input voltage to 5 volts. The LM7805 IC generates an output of 5 volts 0.5 amps. Since the GSM module can sometimes draw upto 2 Amperes of current, I have used 4 pcs of LM7805 IC to meet the requirement.

The Circuit :
  1. Cut the PCB using a hacksaw into a piece large enough to fit the 4pcs of LM7805 IC (Refer to Pic. 1).
  2. Arrange the LM7805 in a parallel connection on the PCB (Refer to Pic. 1) and bend the leads of the IC to connect them in parallel(Refer to Pic. 3)
  3. Solder Wires to the 12v Input of LM7805, Ground Input, 5v Output of LM7805 and Ground Output.
  4. Connect the Adapter plug to the 5v Output and Ground Output Wires. The final product should look like Pic. 5 

Step 3: Preparing the Project Enclosure: Drilling Holes

Picture of Preparing the Project Enclosure: Drilling Holes
3D 100_0780.jpg
In this step you will drill the holes to mount the Arduino and the GSM Antenna to the project enclosure.
  1. Drill four holes at the bottom of the project enclosure to secure the Arduino Uno in it.
  2. Drill a hole on the left wall of the enclosure big enough for the USB cable to connect to the Arduino. 
  3. Drill a hole on the right wall for the GSM Module Antenna.
  4. Drill two holes on the right wall for the Power Input wires.

Step 4: Wiring the GPS Module

Picture of Wiring the GPS Module
3D GPS.jpg
100_0792.JPG
100_0793.JPG
3D Wire GSM.jpg
100_0796.JPG
The GPS module must be connected in a detachable manner to the Arduino Uno. If wires are soldered to the module, then the module cannot be reused for some other application or project. Hence I have used header pins to create a detachable connection between the GPS module and the Arduino. The following are the steps to create a detachable connection:-
  1. Cut four pieces of wire and solder the male header pins to one end of the wire. Wrap the soldered ends of the wire in insulation tape(Refer to Pic. 3).
  2. If female header pins are available, then solder the other ends of the wire to the female header pins. (Top tip: If female header pins are not available, then briefly heat the ends of the wire over a candle to partially melt and loosen up the insulation on the wire. Then force each of the wires into the Vcc, Gnd , Tx and Rx pins of the GPS Module. Refer to the Pic. 4)
  3. After connecting the wires to the Vcc, Gnd , Tx and Rx pins, the GPS module should look like Pic. 6  

Step 5: Final Assembly

Now you can assemble all the parts of the Global Tracking System.
  1. Place the Arduino Uno in the project enclosure and fasten it with screws or zip tie(Refer to Pic. 1).
  2. Insert the Adapter plug into the Arduino and place the Voltage Regulator Circuit into the enclosure. Insert the Input Voltage wires through the two holes drilled in the enclosure(Refer to Pic. 3).
  3. Screw the GSM antenna in place(Refer to Pic. 5). Insert SIM card into the GSM module and place the module over the the Arduino Uno( Refer to Pic. 7).
  4. Place the GPS module in the project enclosure and connect it to the GSM shield in the following manner. Connect the Vcc pin from the GPS module to 5v on the GSM Shield. Connect the Gnd pin from the GPS module to Gnd pin on the GSM Shield. Connect the RXD pin from the GPS module to Pin 5 on the GSM Shield. Connect the TXD pin from the GPS module to Pin 4 on the GSM Shield. 

Step 6: Programming the Arduino:

Picture of Programming the Arduino:
Before you can program the Arduino Uno, you must first install the Tiny GPS library for the GPS Module.
These are the steps to install the library :-
  1. Download the Tiny GPS library for the Arduino. (link)
  2. Extract the zip file to the folder: " Libraries/Documents/Arduino/libraries "
  3. Now you would see the library under   " Sketch --> Import Library "  in the Arduino IDE.
  4. You can proceed with the Arduino Uno programming.

The following is the source code for the Arduino. Copy the code below and load it on the Arduino :-

//Program written for Global Car Tracking System by Jayvis Gonsalves
#include <SoftwareSerial.h>
#include <string.h> 
#include <TinyGPS.h>
SoftwareSerial Sim900Serial(2, 3);
byte buffer[64];                             // buffer array for data recieve over serial port
int count=0;                                 // counter for buffer array
SoftwareSerial GPS(4, 5);
TinyGPS gps;
unsigned long fix_age;
long lat, lon;
float LAT, LON;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
void setup()
{
  Sim900Serial.begin(19200);     // the SIM900 baud rate
  GPS.begin(9600);                   // GPS module baud rate  
  Serial.begin(9600);                  // the Serial port of Arduino baud rate.
  delay(500);
  Sim900_Inti();
}
 
void loop()
{
  Sim900Serial.listen();
  if (Sim900Serial.available())                     // If date is comming from from GSM shield)
  {
    while(Sim900Serial.available())              // reading data into char array 
    {
      buffer[count ]=Sim900Serial.read();  // writing data into array
      if(count == 64)break;
     }
    Serial.write(buffer,count);                     // if no data transmission ends, write buffer to hardware serial port
    Cmd_Read_Act();                               //Read the 'COMMAND' sent to SIM900 through SMS
    clearBufferArray();                               // call clearBufferArray function to clear the storaged data from the array
    count = 0;                                          // set counter of while loop to zero
 
 
  }
  if (Serial.available())                       // if data is available on hardwareserial port ==> data is comming from PC or notebook
    Sim900Serial.println(Serial.read());       // write it to the GPRS shield
}
void clearBufferArray()                             // function to clear buffer array
{
  for (int i=0; i<count;i )
    { buffer[i]=NULL;}                                // clear all index of array with command NULL
}
void Sim900_Inti(void)
{
  Sim900Serial.println("AT CMGF=1");    // Set GSM shield to sms mode
  Serial.println("AT CMGF=1");
  delay(500);
  Sim900Serial.println("AT CNMI=2,2");
  Serial.println("AT CMGF=1");
  delay(500);
}
void Cmd_Read_Act(void)                       //Function reads the SMS sent to SIM900 shield.

  char buffer2[64];
  for (int i=0; i<count;i )
  { buffer2[i]=char(buffer[i]);}  
    
  if (strstr(buffer2,"INSTRUCTABLES"))    //Comparing password entered with password stored in program  
  {
      Serial.println("Password Authenticated.");
      Serial.println("Sending reply SMS. ");
      SendTextMessage();            
  }
  
}
void SendTextMessage()
{
  
  
Sim900Serial.print("AT CMGF=1\r");    //Sending the SMS in text mode
delay(100);
Sim900Serial.println("AT CMGS = \"**********\"");//The predefined phone number
delay(100);
Sim900Serial.println("Please wait while Module calculates position");//the content of the message
delay(100);
Sim900Serial.println((char)26);//the ASCII code of the ctrl z is 26
delay(100);
Sim900Serial.println();
int counter=0;
GPS.listen();


for (;;)
{
   long lat, lon;
   unsigned long fix_age, time, date, speed, course;
   unsigned long chars;
   unsigned short sentences, failed_checksum;
   long Latitude, Longitude;
    
   // retrieves /- lat/long in 100000ths of a degree
   gps.get_position(&lat, &lon, &fix_age);
   getGPS();
   Serial.print("Latitude : ");
   Serial.print(LAT/1000000,7);
   Serial.print(" :: Longitude : ");
   Serial.println(LON/1000000,7);
   if (LAT == 0 && LON == 0)
  {
    continue;    
  } 
  counter ;
  if (counter<30)
  {
    continue;    
  }
  
  Sim900Serial.print("AT CMGF=1\r");    //Sending the SMS in text mode
  delay(100);
  Sim900Serial.println("AT CMGS = \"**********\"");//The predefined phone number
  delay(100);
  Sim900Serial.print("Latitude : ");
  Sim900Serial.print(LAT/1000000,7);
  Sim900Serial.print(" :: Longitude : ");
  Sim900Serial.println(LON/1000000,7);//the content of the message
  delay(100);
  Sim900Serial.println((char)26);//the ASCII code of the ctrl z is 26
  delay(100);
  Sim900Serial.println();
  counter=0;
  break;
 }      
}

void getGPS()
{
   bool newdata = false;
   unsigned long start = millis();
   while (millis() - start < 1000)
   {
      if (feedgps ())
      {
         newdata = true;
       }
     }
     if (newdata)
   {
      gpsdump(gps);
    }
}
bool feedgps()
{
   while (GPS.available())
 {
      if (gps.encode(GPS.read()))
        return true;
      }return 0;
}
void gpsdump(TinyGPS &gps)
{
   gps.get_position(&lat, &lon);
   LAT = lat;
   LON = lon;
   {
      feedgps(); 
    }
  }









 

Step 7: Testing

Picture of Testing
3D 100_0820.jpg
Now that you have built the 'Athena', it is time to install it in your vehicle. The device can be installed anywhere in the car: the hood, cabin or trunk. Remember that the device must be hidden from view and difficult to locate by a car thief. The device must directly be connected to the 12v Car battery as it must run even when the car is switched off.

Steps to track down your vehicle using 'Athena' :-
  1. When your car is stolen and you wish to track your car, simply send a text message containing the password to your car.
  2. Athena then verifies the password you entered with the password stored in its program. If the password matches, then Athena sends an acknowledgment SMS to the predefined phone/cell number stored in it.
  3. Athena then begins to calculate its GPS position and once a GPS lock is acheived, it sends the coordinates of its location to the number stored in its program.
  4. After you receive the Coordinates in your message, copy them to the search bar in google maps to reveal the position of your stolen car.   

And there you go...congratulations!!! You have built your very own Global Car Tracking System.

If you have any difficulties building this instructable, do feel free to ask.

GREAT!!!!! NOW GO AHEAD AND CONSTRUCT ONE YOURSELF!!!!! : )
 
1-40 of 192Next »

i'm using new Arduino GSM Shield integrated antenna (telefonica/bluevia) to built this tracking device and encountered some problem. my tracking device is able to receive sms and get the coordinates. but it cannot reply the sms to the predefined number. the image is my current output.

and this is my coding program. Can someone help me figure out what seem to be the problem and how to solve it. Thanks

#include <SoftwareSerial.h>

#include <string.h>

#include <TinyGPS.h>

SoftwareSerial Sim900Serial(2,3);

byte buffer[128]; // buffer array for data recieve over serial port

int count=0; // counter for buffer array

SoftwareSerial GPS(4,5);

TinyGPS gps;

unsigned long fix_age;

long lat, lon;

float LAT, LON;

void gpsdump(TinyGPS &gps);

bool feedgps();

void getGPS();

void SIM900power() // software equivalent of pressing the GSM shield "power" button

{

digitalWrite(9, HIGH);

delay(1000);

Sim900_Inti();

}

void setup()

{

Sim900Serial.begin(19200); // the SIM900 baud rate

GPS.begin(9600); // GPS module baud rate

Serial.begin(19200); // the Serial port of Arduino baud rate.

delay(500);

Sim900_Inti();

}

void loop()

{

Sim900Serial.listen();

if (Sim900Serial.available()) // If date is comming from from GSM shield)

{

while(Sim900Serial.available()) // reading data into char array

{

buffer[count++]=Sim900Serial.read(); // writing data into array

if(count == 64)break;

}

Serial.write(buffer,count); // if no data transmission ends, write buffer to hardware serial port

Cmd_Read_Act(); //Read the 'COMMAND' sent to SIM900 through SMS

clearBufferArray(); // call clearBufferArray function to clear the storaged data from the array

count = 0; // set counter of while loop to zero

}

if (Serial.available()) // if data is available on hardwareserial port ==> data is comming from PC or notebook

Sim900Serial.println(Serial.read()); // write it to the GPRS shield

}

void clearBufferArray() // function to clear buffer array

{

for (int i=0; i<count;i++)

{ buffer[i]=NULL;} // clear all index of array with command NULL

}

void Sim900_Inti(void)

{

Sim900Serial.println("AT+CMGF=1"); // Set GSM shield to sms mode

Serial.println("AT+CMGF=1");

delay(500);

Sim900Serial.println("AT+CNMI=2,2");

Serial.println("AT CMGF=1");

delay(500);

}

void Cmd_Read_Act(void) //Function reads the SMS sent to SIM900 shield.

{

char buffer2[64];

for (int i=0; i<count;i++)

{ buffer2[i]=char(buffer[i]);}

if (strstr(buffer2,"TRACK")) //Comparing password entered with password stored in program

{

Serial.println("Password Authenticated.");

Serial.println("Sending reply SMS. ");

SendTextMessage();

}

}

void SendTextMessage()

{

Sim900Serial.print("AT+CMGF=1\r"); //Sending the SMS in text mode

delay(100);

Sim900Serial.println("AT + CMGS = \"+60103843894\"");//The predefined phone number

//Sim900Serial.print("AT+CMGS=");

//Sim900Serial.println("+60174432599");

delay(100);

Sim900Serial.println("Please wait while Module calculates position");//the content of the message

delay(100);

Sim900Serial.println((char)26);//the ASCII code of the ctrl z is 26

delay(100);

Sim900Serial.println();

delay(5000);

int counter=0;

GPS.listen();

for (;;)

{

long lat, lon;

unsigned long fix_age, time, date, speed, course;

unsigned long chars;

unsigned short sentences, failed_checksum;

long Latitude, Longitude;

// retrieves /- lat/long in 100000ths of a degree

gps.get_position(&lat, &lon, &fix_age);

getGPS();

Serial.print("Latitude : ");

Serial.print(LAT/1000000,7);

Serial.print(" :: Longitude : ");

Serial.println(LON/1000000,7);

/*if (LAT == 0 && LON == 0)

{

continue;

}

counter ;

if (counter<30)

{

continue;

}

*/

Sim900Serial.print("AT+CMGF=1\r"); //Sending the SMS in text mode

delay(100);

Sim900Serial.println("AT + CMGS = \"+60103843894\"");//The predefined phone number

delay(100);

Sim900Serial.print("Latitude : ");

Sim900Serial.print(LAT/1000000,7);

Sim900Serial.print(" :: Longitude : ");

Sim900Serial.println(LON/1000000,7);//the content of the message

delay(100);

Sim900Serial.println((char)26);//the ASCII code of the ctrl z is 26

delay(5000);

Sim900Serial.println();

counter=0;

break;

}

}

void getGPS()

{

bool newdata = false;

unsigned long start = millis();

while (millis() - start < 1000)

{

if (feedgps ())

{

newdata = true;

}

}

if (newdata)

{

gpsdump(gps);

}

}

bool feedgps()

{

while (GPS.available())

{

if (gps.encode(GPS.read()))

return true;

}return 0;

}

void gpsdump(TinyGPS &gps)

{

gps.get_position(&lat, &lon);

LAT = lat;

LON = lon;

{

feedgps();

}

}

2nd result.jpg

Hi I was wondering if you ever got this to work. for some reason I am having the same exact issue as you.

i found the solution. if you want my sketch coding, just provide your email.

please send the code to vivekpk007@gmail.com or vivekpk007@live.in

@ MUHAMMAD ABDUH I would love your sketch coding because I am working on building this now and I looking over this coding and I don't understand some of it. I would like to know that once I am done putting the code and phone number in and am finally ready to test the GPS, where am I sending my password to? Is there a certain code I put in my phone to actually text my car if so what is it? My email address is happy_2_work@yahoo.com. Any suggestions you have to help me would be greatly appreciated.

THANKS

can you please send me your coding "phalozeka@gmail.com"

salam, bro can you share your sketch coding with me, zaf_unknown_11@yahoo.com

Could you email your sketch to me? alvin.jin2000@gmail.com

Hello Muhammad ,

What's the solution? alpharoboticsteam@gmail.com

Best regards , Nelu

Hey Nice job......could you please share the code with me....my mailid is sumitsw123@gmail.com

Best Regards

hey can u please send me the correct code as its not working for me as well.

My id is: madhavaggarwal55@gmail.com

good day, you could pass me the correct code too, because I'm having the same problem with the coordinates, I get only 00000000, thanks. my email is henriqro@gmail.com

Hey guy i have much Problems pls can u send me your sketch too.

settari.d@sbg.at

Dark_eye Seaha10 months ago

didi you het the sketch to send it to me, i can get his working to

Seaha Dark_eye10 months ago

Hey guy thanks alot here is my sketch.

My Problem is that i get an SMS but the Coordinates are ever 0.00000 0.00000

i dont receive the wright coordinates.

I use the Adafruit gps Breakoutboard

maybe i have a problem with the tiny gps library

#include <SoftwareSerial.h>

#include <string.h>

#include <TinyGPS.h>

SoftwareSerial Sim900Serial(2,3);

byte buffer[128]; // buffer array for data recieve over serial port

int count=0; // counter for buffer array

SoftwareSerial GPS(4,5);

TinyGPS gps;

unsigned long fix_age;

long lat, lon;

float LAT, LON;

void gpsdump(TinyGPS &gps);

bool feedgps();

void getGPS();

void SIM900power() // software equivalent of pressing the GSM shield "power" button

{

digitalWrite(9, HIGH);

delay(1000);

Sim900_Inti();

}

void setup()

{

Sim900Serial.begin(19200); // the SIM900 baud rate

GPS.begin(9600); // GPS module baud rate

Serial.begin(19200); // the Serial port of Arduino baud rate.

delay(500);

Sim900_Inti();

}

void loop()

{

Sim900Serial.listen();

if (Sim900Serial.available()) // If date is comming from from GSM shield)

{

while(Sim900Serial.available()) // reading data into char array

{

buffer[count++]=Sim900Serial.read(); // writing data into array

if(count == 64)break;

}

Serial.write(buffer,count); // if no data transmission ends, write buffer to hardware serial port

Cmd_Read_Act(); //Read the 'COMMAND' sent to SIM900 through SMS

clearBufferArray(); // call clearBufferArray function to clear the storaged data from the array

count = 0; // set counter of while loop to zero

}

if (Serial.available()) // if data is available on hardwareserial port ==> data is comming from PC or notebook

Sim900Serial.println(Serial.read()); // write it to the GPRS shield

}

void clearBufferArray() // function to clear buffer array

{

for (int i=0; i<count;i++)

{ buffer[i]=NULL;} // clear all index of array with command NULL

}

void Sim900_Inti(void)

{

Sim900Serial.println("AT+CMGF=1"); // Set GSM shield to sms mode

Serial.println("AT+CMGF=1");

delay(500);

Sim900Serial.println("AT+CNMI=2,2");

Serial.println("AT CMGF=1");

delay(500);

}

void Cmd_Read_Act(void) //Function reads the SMS sent to SIM900 shield.

{

char buffer2[64];

for (int i=0; i<count;i++)

{ buffer2[i]=char(buffer[i]);}

if (strstr(buffer2,"Seda")) //Comparing password entered with password stored in program

{

Serial.println("Password Authenticated.");

Serial.println("Sending reply SMS. ");

SendTextMessage();

}

}

void SendTextMessage()

{

Sim900Serial.print("AT+CMGF=1\r"); //Sending the SMS in text mode

delay(100);

Sim900Serial.println("AT + CMGS = \"06601524106\"");//The predefined phone number

//Sim900Serial.print("AT+CMGS=");

//Sim900Serial.println("+60174432599");

delay(100);

Sim900Serial.println("Bitte warten Sie bis das Modul die Position ihres Fahrzeugs berechnet hat");//the content of the message

delay(100);

Sim900Serial.println((char)26);//the ASCII code of the ctrl z is 26

delay(100);

Sim900Serial.println();

delay(5000);

int counter=0;

GPS.listen();

for (;;)

{

long lat, lon;

unsigned long fix_age, time, date, speed, course;

unsigned long chars;

unsigned short sentences, failed_checksum;

long Latitude, Longitude;

// retrieves /- lat/long in 100000ths of a degree

gps.get_position(&lat, &lon, &fix_age);

getGPS();

Serial.print("Breitengrad : ");

Serial.print(LAT/1000000,7);

Serial.print(" :: Längengrad : ");

Serial.println(LON/1000000,7);

/*if (LAT == 0 && LON == 0)

{

continue;

}

counter ;

if (counter<30)

{

continue;

}

*/

Sim900Serial.print("AT+CMGF=1\r"); //Sending the SMS in text mode

delay(100);

Sim900Serial.println("AT + CMGS = \"06601524106\"");//The predefined phone number

delay(100);

Sim900Serial.print("Breitengrad : ");

Sim900Serial.print(LAT/1000000,7);

Sim900Serial.print(" :: Längengrad : ");

Sim900Serial.println(LON/1000000,7);//the content of the message

delay(100);

Sim900Serial.println((char)26);//the ASCII code of the ctrl z is 26

delay(5000);

Sim900Serial.println();

counter=0;

break;

}

}

void getGPS()

{

bool newdata = false;

unsigned long start = millis();

while (millis() - start < 1000)

{

if (feedgps ())

{

newdata = true;

}

}

if (newdata)

{

gpsdump(gps);

}

}

bool feedgps()

{

while (GPS.available())

{

if (gps.encode(GPS.read()))

return true;

}return 0;

}

void gpsdump(TinyGPS &gps)

{

gps.get_position(&lat, &lon);

LAT = lat;

LON = lon;

{

feedgps();

}

}

hi, can you send me your solutions to this problem, i am having the same problem, thank ou very much. my email is: ivancalusic@gmail.com

If you don't mind, could you also send me the sketch? dlutz058@gmail.com. Thanks!

hgaston8893@gmail.com thank you so much and btw what power supply did you end up using?

Hey ! I would really appreciate if you could email me your solution aswell , thank you very much ! My email is : iraklis.stratigis@gmail.com

Hi, Could you email your sketch coding.. Here's my email: jonellbalanay@gmail.com Thanks btw :)

JeremyI JonellB18 months ago

Hi, could I also have the code?

Email is jeremyishi@gmail.com

thanks

vivekpk0073 days ago

Hi Jayvis Vineet Gonsalves: can you send me the the code to my mail Id : vivekpk007@gmail.com or vivekpk007@live.in the code uploaded here has lots of bugs

Terry Jack7 days ago

Is it necessary that RXD pin goes to pin 5 and TXD pin goes to pin 4 on GSM board or can i be to any digital pin?

Guyak658 days ago

One stupid question.....do you need a cell phone provider to activate the SIM card with on the SIM900 GSM/GPRS Shield Module

Guy

guy@guyaks.com

ThrashMatic16 days ago

Hi . Can someone give me full sketch for the code ? Really need it . My email is jelatek79@gmail.com. Thank you. I'm just playing around with the code. Don't know if it's wrong or right because never received back the location code.

#include <SoftwareSerial.h>

#include <string.h>

#include <TinyGPS.h>

SoftwareSerial Sim900Serial(2, 3);

byte buffer[64]; // buffer array for data receive over serial port

int count=0; // counter for buffer array

SoftwareSerial GPS(4, 5);

TinyGPS gps;

unsigned long fix_age;

long lat, lon;

float LAT, LON;

void gpsdump(TinyGPS &gps);

bool feedgps();

void getGPS();

void setup()

{

Sim900Serial.begin(19200); // the SIM900 baud rate

GPS.begin(9600); // GPS module baud rate

Serial.begin(9600); // the Serial port of Arduino baud rate.

delay(500);

Sim900_Inti();

}

void loop()

{

Sim900Serial.listen();

if (Sim900Serial.available()) // If date is coming from from GSM shield)

{

while(Sim900Serial.available()) // reading data into char array

{

buffer[count ]=Sim900Serial.read(); // writing data into array

if(count == 64)break;

}

Serial.write(buffer,count); // if no data transmission ends, write buffer to hardware serial port

Cmd_Read_Act(); //Read the 'COMMAND' sent to SIM900 through SMS

clearBufferArray(); // call clearBufferArray function to clear the storaged data from the array

count = 0; // set counter of while loop to zero

}

if (Serial.available()) // if data is available on hardwareserial port ==> data is coming from PC or notebook

Sim900Serial.println(Serial.read()); // write it to the GPRS shield

}

void clearBufferArray() // function to clear buffer array

{

for (int i=0; i<count;i )

{ buffer[i]=NULL;} // clear all index of array with command NULL

}

void Sim900_Inti(void)

{

Sim900Serial.println("AT+CMGF=1"); // Set GSM shield to sms mode

Serial.println("AT+CMGF=1");

delay(500);

Sim900Serial.println("AT+CNMI=2,2");

Serial.println("AT+CMGF=1");

delay(500);

}

void Cmd_Read_Act(void) //Function reads the SMS sent to SIM900 shield.

{

char buffer2[64];

for (int i=0; i<count;i )

{ buffer2[i]=char(buffer[i]);}

if (strstr(buffer2,"GPSTEST")) //Comparing password entered with password stored in program

{

Serial.println("Password Authenticated.");

Serial.println("Sending reply SMS. ");

SendTextMessage();

}

}

void SendTextMessage()

{

Sim900Serial.print("AT+CMGF=1\r"); //Sending the SMS in text mode

delay(100);

Sim900Serial.println("AT+CMGS = \"+60123456789\"");//The predefined phone number

delay(100);

Sim900Serial.println("Please wait while Module calculates position;"); // The content of the message.

Sim900Serial.print("Latitude: ");

Sim900Serial.print(LAT/1000000,7);

Sim900Serial.println("° N");

Sim900Serial.print("Longitude : ");

Sim900Serial.print(LON/1000000,7);

Sim900Serial.println("° W");

Sim900Serial.println("");

Sim900Serial.println("Google Maps URL:");

Sim900Serial.print("https://maps.google.com/q=");

Sim900Serial.print(LAT/1000000,7);

Sim900Serial.print("+N+");

Sim900Serial.print(LON/1000000,7);

Sim900Serial.println("+W");

delay(100);

Sim900Serial.println((char)26);//the ASCII code of the ctrl z is 26

delay(100);

Sim900Serial.println();

int counter=0;

GPS.listen();

for (;;)

{

long lat, lon;

unsigned long fix_age, time, date, speed, course;

unsigned long chars;

unsigned short sentences, failed_checksum;

long Latitude, Longitude;

// retrieves /- lat/long in 100000ths of a degree

gps.get_position(&lat, &lon, &fix_age);

getGPS();

Serial.print("Latitude: ");

Serial.print(LAT/1000000,7);

Serial.print("° N");

Serial.print("Longitude : ");

Serial.print(LON/1000000,7);

Serial.print("° W");

Serial.print("");

Serial.print("Google Maps URL:");

Serial.print("https://maps.google.com/q=");

Serial.print(LAT/1000000,7);

Serial.print("+N+");

Serial.println(LON/1000000,7);

Serial.print("+W");

if (LAT == 0 && LON == 0)

{

continue;

}

counter ;

if (counter<30)

{

continue;

}

Sim900Serial.print("AT+CMGF=1\r"); //Sending the SMS in text mode

delay(100);

Sim900Serial.println("AT+CMGS = \"+60123456789\"");//The predefined phone number

delay(100);

Sim900Serial.print("Latitude : ");

Sim900Serial.print(LAT/1000000,7);

Sim900Serial.println("° N");

Sim900Serial.print(" :: Longitude : ");

Sim900Serial.println(LON/1000000,7);//the content of the message

Sim900Serial.println("° W");

Sim900Serial.println("");

Sim900Serial.println("Google Maps URL:");

Sim900Serial.print("https://maps.google.com/q=");

Sim900Serial.print(LAT/1000000,7);

Sim900Serial.print("+N+");

Sim900Serial.print(LON/1000000,7);

Sim900Serial.println("+W");

delay(100);

Sim900Serial.println((char)26);//the ASCII code of the ctrl z is 26

delay(100);

Sim900Serial.println();

counter=0;

break;

}

}

void getGPS()

{

bool newdata = false;

unsigned long start = millis();

while (millis() - start < 1000)

{

if (feedgps ())

{

newdata = true;

}

}

if (newdata)

{

gpsdump(gps);

}

}

bool feedgps()

{

while (GPS.available())

{

if (gps.encode(GPS.read()))

return true;

}return 0;

}

void gpsdump(TinyGPS &gps)

{

gps.get_position(&lat, &lon);

LAT = lat;

LON = lon;

{

feedgps();

}

}

here we are this one works well this is what you need for uno

Sim908 Module GSM Gprs GPS Quad Band Development Board & GPS Antenna

http://www.ebay.co.uk/itm/Sim908-Module-GSM-Gprs-GPS-Quad-Band-Development-Board-GPS-Antenna-UK-Seller-/291352511756?pt=LH_DefaultDomain_3&var=&hash=item43d5f6850c

Hi Neil,

I have the same module as the one you have. Can you post or send your wiring diagram and codes? I am having problems with this module.

Thanks

khaliunb1 month ago

Hello Jayvis Vineet Gonsalves. It's a nice thing that you are doing. I too am trying to start up with Arduino. But can't find the shield for reasonable price. Could you please refer me to your dealer (or dealers) that provided with this project's parts? Also, if it is not too much trouble, could you send PDF instruction to my email? It is lofraigh731n37@yahoo.com. Thank you.

dunc22 months ago
henningr2 months ago

hi

Check out the following company, I got all my stuff from them.

South African based company in Gauteng.

https://www.robotics.org.za/index.php?route=produc...

robotmen2 months ago

Hi neil.fleetwood. Thank you for your share.

In my country, I can find only "Shield Telit Click GSM Modul" (http://www.mikroe.com/click/gsm/) . It uses (#include <GSM.h>) library.

Is it possible to use this shield in your project? Thanks for your answer.

And, what do you think about old cell phones GSM Modules' Also, is it possible to use that modules?

iMouDa942 months ago

hey, i bought this and i want code for it.
http://store.fut-electronics.com/gps-gprs-gsm-sim908-module/dp/1498

SinAmos4 months ago

Yeah, what is the cost? Numbers anyone?

for all bits in uk cost me £50 for uno /gps module / sim900 module

rbehera23 months ago

Hey,

Can anyone whose GPS has finally worked tell me the process from scratch and tell me the approximate price of the above GPS project please.my email id is Rajat.vintage@gmail.com

working hard on the case

cpravăţ4 months ago
@neil.fleetwood: you don't need to unplug module's power! Only need this:
http://arduino.cc/en/Tutorial/TwoPortReceive

Yes i have tried this, it is a fail same issue by conflict data . i need a serial module with 2 serial hardware ports not software made up ports . i know the arduino mega will sort it, as it has these ports.

kijocreative4 months ago

Hi, is there anyway to program this to send data using its cellular data connection and not sms. I have it reporting via SMS but would like ammend it so my server can ask for location uisng cellular data. Kind Regards hello@kijo.co

mlliarm4 months ago

Hello, this looks like a cool project. But how much is it going to cost?

1-40 of 192Next »