├── DFRobot_SIM808-master.zip ├── FormatFactoryVID_20170716_122553.mp4 ├── README.md ├── SoftwareSerial.zip ├── Updated_Vehicle_Tracking.ino └── Vehicle_Tracking.ino /DFRobot_SIM808-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mewanindula/GPS-Tracking-System/3d833f96988ab9e92e8ff1ea47c8a51098d06330/DFRobot_SIM808-master.zip -------------------------------------------------------------------------------- /FormatFactoryVID_20170716_122553.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mewanindula/GPS-Tracking-System/3d833f96988ab9e92e8ff1ea47c8a51098d06330/FormatFactoryVID_20170716_122553.mp4 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GPS-Tracking-System 2 | 3 | This Is YouTube Tutorials 4 | 5 | https://youtu.be/mvfTxRGTHWc 6 | https://youtu.be/mFgn9BqN9nQ 7 | -------------------------------------------------------------------------------- /SoftwareSerial.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mewanindula/GPS-Tracking-System/3d833f96988ab9e92e8ff1ea47c8a51098d06330/SoftwareSerial.zip -------------------------------------------------------------------------------- /Updated_Vehicle_Tracking.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define MESSAGE_LENGTH 160 5 | char message[MESSAGE_LENGTH]; 6 | int messageIndex = 0; 7 | char MESSAGE[300]; 8 | char lat[12]; 9 | char lon[12]; 10 | char wspeed[12]; 11 | 12 | char phone[16]; 13 | char datetime[24]; 14 | 15 | #define PIN_TX 10 16 | #define PIN_RX 11 17 | SoftwareSerial mySerial(PIN_TX,PIN_RX); 18 | DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR, 19 | 20 | void sendSMS(); 21 | void getGPS(); 22 | void readSMS(); 23 | 24 | void setup() 25 | { 26 | mySerial.begin(9600); 27 | Serial.begin(9600); 28 | 29 | //******** Initialize sim808 module ************* 30 | while(!sim808.init()) 31 | { 32 | Serial.print("Sim808 init error\r\n"); 33 | delay(1000); 34 | } 35 | delay(3000); 36 | 37 | Serial.println("SIM Init success"); 38 | 39 | Serial.println("Init Success, please send SMS message to me!"); 40 | } 41 | 42 | void loop() 43 | { 44 | //*********** Detecting unread SMS ************************ 45 | messageIndex = sim808.isSMSunread(); 46 | 47 | //*********** At least, there is one UNREAD SMS *********** 48 | if (messageIndex > 0) 49 | { 50 | 51 | readSMS(); 52 | getGPS(); 53 | sendSMS(); 54 | 55 | //************* Turn off the GPS power ************ 56 | sim808.detachGPS(); 57 | 58 | Serial.println("Please send SMS message to me!"); 59 | } 60 | } 61 | 62 | void readSMS() 63 | { 64 | Serial.print("messageIndex: "); 65 | Serial.println(messageIndex); 66 | 67 | sim808.readSMS(messageIndex, message, MESSAGE_LENGTH, phone, datetime); 68 | 69 | //***********In order not to full SIM Memory, is better to delete it********** 70 | sim808.deleteSMS(messageIndex); 71 | Serial.print("From number: "); 72 | Serial.println(phone); 73 | Serial.print("Datetime: "); 74 | Serial.println(datetime); 75 | Serial.print("Recieved Message: "); 76 | Serial.println(message); 77 | } 78 | 79 | void getGPS() 80 | { 81 | while(!sim808.attachGPS()) 82 | { 83 | Serial.println("Open the GPS power failure"); 84 | delay(1000); 85 | } 86 | delay(3000); 87 | 88 | Serial.println("Open the GPS power success"); 89 | 90 | while(!sim808.getGPS()) 91 | { 92 | 93 | } 94 | 95 | Serial.print(sim808.GPSdata.year); 96 | Serial.print("/"); 97 | Serial.print(sim808.GPSdata.month); 98 | Serial.print("/"); 99 | Serial.print(sim808.GPSdata.day); 100 | Serial.print(" "); 101 | Serial.print(sim808.GPSdata.hour); 102 | Serial.print(":"); 103 | Serial.print(sim808.GPSdata.minute); 104 | Serial.print(":"); 105 | Serial.print(sim808.GPSdata.second); 106 | Serial.print(":"); 107 | Serial.println(sim808.GPSdata.centisecond); 108 | Serial.print("latitude :"); 109 | Serial.println(sim808.GPSdata.lat); 110 | Serial.print("longitude :"); 111 | Serial.println(sim808.GPSdata.lon); 112 | Serial.print("speed_kph :"); 113 | Serial.println(sim808.GPSdata.speed_kph); 114 | Serial.print("heading :"); 115 | Serial.println(sim808.GPSdata.heading); 116 | Serial.println(); 117 | 118 | float la = sim808.GPSdata.lat; 119 | float lo = sim808.GPSdata.lon; 120 | float ws = sim808.GPSdata.speed_kph; 121 | 122 | dtostrf(la, 4, 6, lat); //put float value of la into char array of lat. 4 = number of digits before decimal sign. 6 = number of digits after the decimal sign. 123 | dtostrf(lo, 4, 6, lon); //put float value of lo into char array of lon 124 | dtostrf(ws, 6, 2, wspeed); //put float value of ws into char array of wspeed 125 | 126 | sprintf(MESSAGE, "Latitude : %s\nLongitude : %s\nWind Speed : %s kph\nMy Module Is Working. Mewan Indula Pathirage. Try With This Link.\nhttp://www.latlong.net/Show-Latitude-Longitude.html\nhttp://maps.google.com/maps?q=%s,%s\n", lat, lon, wspeed, lat, lon); 127 | } 128 | 129 | void sendSMS() 130 | { 131 | Serial.println("Start to send message ..."); 132 | 133 | Serial.println(MESSAGE); 134 | Serial.println(phone); 135 | 136 | sim808.sendSMS(phone,MESSAGE); 137 | } 138 | 139 | -------------------------------------------------------------------------------- /Vehicle_Tracking.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define MESSAGE_LENGTH 160 5 | char message[MESSAGE_LENGTH]; 6 | int messageIndex = 0; 7 | char MESSAGE[300]; 8 | char lat[12]; 9 | char lon[12]; 10 | char wspeed[12]; 11 | 12 | char phone[16]; 13 | char datetime[24]; 14 | 15 | #define PIN_TX 10 16 | #define PIN_RX 11 17 | SoftwareSerial mySerial(PIN_TX,PIN_RX); 18 | DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR, 19 | 20 | void setup() 21 | { 22 | mySerial.begin(9600); 23 | Serial.begin(9600); 24 | 25 | //******** Initialize sim808 module ************* 26 | while(!sim808.init()) 27 | { 28 | Serial.print("Sim808 init error\r\n"); 29 | delay(1000); 30 | } 31 | delay(3000); 32 | 33 | if( sim808.attachGPS()) 34 | Serial.println("Open the GPS power success"); 35 | else 36 | Serial.println("Open the GPS power failure"); 37 | 38 | Serial.println("Init Success, please send SMS message to me!"); 39 | } 40 | 41 | void loop() 42 | { 43 | //*********** Detecting unread SMS ************************ 44 | messageIndex = sim808.isSMSunread(); 45 | 46 | //*********** At least, there is one UNREAD SMS *********** 47 | if (messageIndex > 0) 48 | { 49 | Serial.print("messageIndex: "); 50 | Serial.println(messageIndex); 51 | 52 | sim808.readSMS(messageIndex, message, MESSAGE_LENGTH, phone, datetime); 53 | 54 | //***********In order not to full SIM Memory, is better to delete it********** 55 | sim808.deleteSMS(messageIndex); 56 | Serial.print("From number: "); 57 | Serial.println(phone); 58 | Serial.print("Datetime: "); 59 | Serial.println(datetime); 60 | Serial.print("Recieved Message: "); 61 | Serial.println(message); 62 | 63 | while(!sim808.getGPS()) 64 | { 65 | 66 | } 67 | 68 | 69 | Serial.print(sim808.GPSdata.year); 70 | Serial.print("/"); 71 | Serial.print(sim808.GPSdata.month); 72 | Serial.print("/"); 73 | Serial.print(sim808.GPSdata.day); 74 | Serial.print(" "); 75 | Serial.print(sim808.GPSdata.hour); 76 | Serial.print(":"); 77 | Serial.print(sim808.GPSdata.minute); 78 | Serial.print(":"); 79 | Serial.print(sim808.GPSdata.second); 80 | Serial.print(":"); 81 | Serial.println(sim808.GPSdata.centisecond); 82 | Serial.print("latitude :"); 83 | Serial.println(sim808.GPSdata.lat); 84 | Serial.print("longitude :"); 85 | Serial.println(sim808.GPSdata.lon); 86 | Serial.print("speed_kph :"); 87 | Serial.println(sim808.GPSdata.speed_kph); 88 | Serial.print("heading :"); 89 | Serial.println(sim808.GPSdata.heading); 90 | Serial.println(); 91 | 92 | float la = sim808.GPSdata.lat; 93 | float lo = sim808.GPSdata.lon; 94 | float ws = sim808.GPSdata.speed_kph; 95 | 96 | dtostrf(la, 6, 2, lat); //put float value of la into char array of lat. 6 = number of digits before decimal sign. 2 = number of digits after the decimal sign. 97 | dtostrf(lo, 6, 2, lon); //put float value of lo into char array of lon 98 | dtostrf(ws, 6, 2, wspeed); //put float value of ws into char array of wspeed 99 | 100 | sprintf(MESSAGE, "Latitude : %s\nLongitude : %s\nWind Speed : %s kph\nMy Module Is Working. Mewan Indula Pathirage. Try With This Link.\nhttp://www.latlong.net/Show-Latitude-Longitude.html\nhttp://maps.google.com/maps?q=%s,%s\n", lat, lon, wspeed, lat, lon); 101 | 102 | 103 | Serial.println("Sim808 init success"); 104 | Serial.println("Start to send message ..."); 105 | 106 | Serial.println(MESSAGE); 107 | Serial.println(phone); 108 | 109 | sim808.sendSMS(phone,MESSAGE); 110 | 111 | //************* Turn off the GPS power ************ 112 | sim808.detachGPS(); 113 | 114 | 115 | } 116 | } 117 | --------------------------------------------------------------------------------