An SMS based GPS tracker using the Adafruit Ultimate GPS module http://www.adafruit.com/products/746 and the Seeed Studio GPRS shield (Sim900 chipset) http://www.seeedstudio.com/depot/gprs-shield-p-779.html?cPath=132_134

Dependencies:   GPS MODSERIAL mbed-rtos mbed

SMS based GPS tracker

This is an SMS based GPS tracker using using the Adafruit Ultimate GPS module and the Seeed studio GPRS arduino shield [SIM900 chipset]. The idea of this project is to leverage the free SMS between Virgin mobile prepaid SIM cards in Australia for long distance communication.

Currently the GPRS shield is switched on manually, and should be done about 10 seconds before powering the mbed/GPS in order to disable echo properly during start up. This could easily be fixed by switching the GPRS shield with the mbed at start up, waiting the 10 seconds, set the echo then flush the buffer.

The mbed can read all 160 ASCII chars sent in a message for control.

http://i47.tinypic.com/35alpue.png http://i48.tinypic.com/2mi3y0z.png http://i45.tinypic.com/jkeyvt.png

The Seeed GPRS shield http://www.seeedstudio.com/depot/gprs-shield-p-779.html?cPath=132_134

The Adafruit Ultimate GPS http://www.adafruit.com/products/746

Revision:
3:a5df4bd224ad
Parent:
2:2b2c785c6627
Child:
4:0e55a4620f5e
diff -r 2b2c785c6627 -r a5df4bd224ad main.cpp
--- a/main.cpp	Sun Oct 07 02:05:15 2012 +0000
+++ b/main.cpp	Sun Oct 07 20:28:32 2012 +0000
@@ -10,6 +10,7 @@
 const string GoogleChunk = "https://maps.google.com.au/maps?q=";
 const string GoogleExtras = "&z=20";
 char GPRSbuffer[512];
+string dump;
 int index;
 int i = 0;
 
@@ -46,7 +47,7 @@
     GPRS.printf("AT+CMGF=1\r\n");
     wait(1);
     // Set the phone number
-    GPRS.printf("AT+CMGS=\"+614<<NUMBER>>\"\r\n");
+    GPRS.printf("AT+CMGS=\"+61435404829\"\r\n");
     wait(1);
     // Write out the GPS data in a message
     GPRS.printf("Time: %4.2f \nAltitude: %3.2fm\nSpeed: %3.2f Kn\nHeading: %3.2f Deg\nValidity: %c\nFix: %s\nSatellites: %d", gps.time, gps.altitude, gps.speed, gps.heading,gps.validity,gps.fixtype,gps.satellites);
@@ -56,11 +57,12 @@
     wait(3);
     GPRS.printf("AT+CMGF=1\r\n");
     wait(1);
-    GPRS.printf("AT+CMGS=\"+614<<NUMBER>>\"\r\n");
+    GPRS.printf("AT+CMGS=\"+61435404829\"\r\n");
     wait(1);
     GPRS.printf("Find me at....\n %s%f,%f%s", GoogleChunk, gps.latitude, gps.longitude, GoogleExtras);
     wait(1);
     GPRS.putc(0x1A);
+    wait(1);
 }
 
 void parseSms()
@@ -94,13 +96,32 @@
         memset(GPRSbuffer, '0', 512);
         // Reset the char counter
         i = 0;
+    } 
+   if (sscanf(GPRSbuffer, "$$NO CARRIER%s%*d", &dump)>0) {
+        //dump = "fixed";
+       // GPRS.printf("ATH0\r\n");
+        wait(1);
+        GPRS.rxBufferFlush();
+        wait(1);
+        pc.printf("\nCall recieved");
+        wait(3);
+        // Do the send SMS routine...
+        sendSms();
+        // Wait for the cascade of \r\nOK\r\n\r\nOK\r\n's from the SMS's to finish
+        //wait(4);
+        // Flush out any left in the serial buffer
+        //GPRS.rxBufferFlush();
+        // Reset the GPRS buffer
+        //memset(GPRSbuffer, '0', 512);
+        // Reset the char counter
+        //i = 0;
     } else {
         GPRS.rxBufferFlush();
         // Reset the GPRS buffer
         memset(GPRSbuffer, '0', 512);
         // Reset the char counter
         i = 0;
-        pc.printf("\nWaiting for SMS...\n");
+        pc.printf("\nWaiting for SMS or call...\n");
     }
 }
 
@@ -128,9 +149,6 @@
         // Process any recieved data
         parseSms();
         // Process / check GPS data
-        if(gps.parseData()) {
-            pc.printf("\nGo to %s%f,%f%s\n", GoogleChunk, gps.latitude, gps.longitude, GoogleExtras);
-            pc.printf("\n\nLocation: %f%c, %f%c \nTime: %4.2f \nSatellites: %d \nAltitude: %3.2f\nSpeed: %3.2f\nHeading: %3.2f\nValidity: %c\n",gps.latitude, gps.ns, gps.longitude, gps.ew, gps.time, gps.satellites, gps.altitude, gps.speed, gps.heading,gps.validity);
-        } else pc.printf("Aquiring Satellites...\n");
+        gps.parseData();
     }
 }