On-line vehicle tracking system
6.6k

Components Used
Powered by


ESP8266 is a system on chip (SoC) which provides WIFI capability for embedded applications. This enables internet connectivity to embedded applications. ESP8266 modules are mostly used in Internet of Things(IoT) applications.
909-MOD-WIFI-ESP8266
Introduction
On-line vehicle tracking system track the location and speed of vehicle. It shows the real-time location and speed of vehicle on Dashboard created on Adafruit IO. For tracking location and speed GPS receiver is used. This tracking data send to the cloud using wi-fi module ESP8266.
Circuit Diagram

Project Working
- GPS module read the frame from satellites continuously. By reading this GPS information serially using MBED controller and extracted the required information like Latitude, Longitude, Speed, Altitude.
- Latitude, Longitude, Speed, Altitude these parameters are calculated from valid frame(GPRMC, GPGGA NMEA string).
- These tracking parameter along with vehicle speed are uploaded to Adafruit IO's Dashboard. On Adafruit Dashboard, we can see on-line vehicle tracking.
Latitude & Longitude Extraction
if(sscanf(msg, "GPRMC,%f,%c,%f,%c,%f,%c,%f,%d", &time,&m, &latitude, &ns, &longitude, &ew,&speed, &lock) >= 1) {
{
if(!lock) {
longitude = 0.0;
latitude = 0.0;
return 0;
} else {
sscanf(msg,"GPGGA,%f,%f,%c,%f,%c,%d,%d,%*f,%d", &time, &latitude1, &ns, &longitude1, &ew, &fq, &nst, &tst, &altitude);
if(ns == 'S') { latitude *= -1.0; }
if(ew == 'W') { longitude *= -1.0; }
float degrees = trunc(latitude / 100.0f);
float minutes = latitude - (degrees * 100.0f);
latitude = degrees + minutes / 60.0f;
degrees = trunc(longitude / 100.0f); //* 0.01f);
minutes = longitude - (degrees * 100.0f);
longitude = degrees + minutes / 60.0f; - In above code latitude and longitude converted in to degree and minutes and then using this degree and minutes latitude and longitude are calculated.
Speed Calculation
- Speed given by GPS is in knots to convert it into kmph multiply it by 1.85.
float a=gps.spd*1.85; //converting speed in to kmphConnect to Internet
- System is connected to internet using ESP8266 wifi-module.
NetworkInterface* network = easy_connect(true);
if (!network) {
return -1;
}Adafruit IO
- System is connected to io.adafruit.com
const char* hostname = "io.adafruit.com";
int port = 1883;
logMessage("Connecting to %s:%d\r\n", hostname, port);
int rc = mqttNetwork.connect(hostname, port);
if (rc != 0)
logMessage("rc from TCP connect is %d\r\n", rc);- Create Dashboard and create feeds on io.adafruit.com.
- Mention feed path, username, AIO key to connect system to your dashboard.
data.clientID.cstring = "username/feed/name/csv";
data.username.cstring = "username";
data.password.cstring = "AIO key";
if ((rc = client.connect(data)) != 0)
logMessage("rc from MQTT connect is %d\r\n", rc);- This data is published to adafruit using MQTT protocol.
//publishing latitude, longitude and altitude
char buf[200];
sprintf(buf, "%f,%f,%f,%d",a,b,c,d);
message.qos = MQTT::QOS0;
message.retained = false;
message.dup = false;
message.payload = (void*)buf;
message.payloadlen = strlen(buf)+1;
rc = client.publish(topic, message);
output.printf("rc=%d",rc);
//Publishing speed
sprintf(buf,"%f",a);
message.qos = MQTT::QOS0;
message.retained = false;
message.dup = false;
message.payload = (void*)buf;
message.payloadlen = strlen(buf)+1;
rc = client.publish(topic1, message);
output.printf("rc=%d",rc);
Adafruit Dashboard
Video
Credits
Built by 1 contributor

Comments13
Join the discussion — share a question or tip.
Very nice project
hello sir i have making a project GSM and GPS with i2c coding also with help of controller ARM7 LPC2148 so u need to be help me this project i want coding by header file..and also both coding making a inside one main file so could u help me
Is there any video Tutorial on how to execute this program on mbed compiler. i'm confused of executing which one first
I have one doubt..how will you provide wifi in continuous moving vechile? And also in remote locations?? Else,why you don't use gprs module i.e iot sim??
I used online mbed compiler ...but still am unable to get out put
did you solved the issue??
Pls how can I import whole GPS folder into mbed compiler
Try this link: https://www.electronicwings.com/mbed/getting-started-with-arm-mbed-with-online-compiler-and-keil-uvision-ide May you will get your answer here.
Gsm code interface with mbed
Tqsm Pls help send me Gsm code
GSM code for which platform? You can search for GSM which will provide you result for respective platform.
please upload code
it is provided in the attachment.