Car GPS Tracking System and Overspeed Notification Using Blynk App
by samiobi in Circuits > Microcontrollers
1220 Views, 4 Favorites, 0 Comments
Car GPS Tracking System and Overspeed Notification Using Blynk App
Automobile demand increases daily even in countries with very good transportation system, vehicles are valuable asset to families, vehicles are used by all family members for number of activates like going to school or shopping etc.. Adults similarly uses parents cars for their activities, this makes the parents worry about their sons or daughters for their safety at road and wish they can monitor their driving while they are using the vehicle .
This project is to make a system that can monitor a vehicle's position and speed when in use, similarly the system alert through notification when the car speed acceded a predetermined value. The system uses a WIFI network to access to the internet (this means can be provided by portable WIFI device or driver's phone hotspot).
Supplies
- Node MCU ESP8266
- GPS module GY NEO 06
- Plastic case
- USB power connector
- A Switch
Concept of Operation
The system is a friendly, portable and has low power consumption , initially the owner of the car plugs in the system in the vehicle's USB port for power supply. Then the system automatically connects to the WIFI once the GPS data received by the system. Next the system connects to the Blynk server and sends the data of the car to the user. The owner car monitor the car's position and speed constantly through the App, if the car exceeded the pre determined limit the Blynk app will send a notification to the owner smart phone. The system has good position accuracy and very good speed measurement.
Block Diagram

The system consists of three main elements Node MCU esp8266 , GPS module and power supply. The power supply provides 5 V power supply to both units. The 5V input to Node MCU is connected to Vo and ground to ground pin, the GPS module Vcc and Grd are connected to the Node MCU grd. The TX of the GPS is connected to D2 and Rx to D1. The block diagram shows the interconnections between the units.
System Operation




The system fits in the car easily, after connecting the system to the power it will pair with the car WIFI or phone hotspot. When the GPS gives red blinking it indicates that GPS module is locked to the satellites (this may take sometime depends on the weather and position). Then once the GPS is locked data is gathered by the MCU then send the data to Blynk server and eventually to the user's account. The user can monitor the vehicle position and speed though the map, once the car exceed the the speed set in the code a notification is send to the Blynk user app. The above photos shows the installation and the layout of the app page. The system was connected to the smart phone hotspot.
Coding
The coding is done through Arduino IDEt, the IDE should be configured to host the Node MCU ESP8266 (refer to pervious projects) then load the code which requires charging the SSID , password and authentication key. The system currently set to give notification when the speed reaches 80 Km/h and above. Also make sure to load the libraries stated in the include functions.
Coding
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
static const int RXPin = 4, TXPin = 5; // GPIO 4=D2(connect Tx of GPS) and GPIO 5=D1(Connect Rx of GPS
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps; // The TinyGPS++ object
WidgetMap myMap(V0); // V0 for virtual pin of Map Widget
SoftwareSerial ss(RXPin, TXPin); // The serial connection to the GPS device
BlynkTimer timer;
float spd; //Variable to store the speed
float sats; //Variable to store no. of satellites response
String bearing; //Variable to store orientation or direction of GPS
char auth[] = "XXXXXXXXXXXXXXX"; //Your Project authentication key
char ssid[] = "XXXXXX"; // Name of your network
char pass[] = "XXXXXXX";// Password
//unsigned int move_index; // moving index, to be used later
unsigned int move_index = 1; // fixed location for now
void setup()
{
Serial.begin(115200);
Serial.println();
ss.begin(GPSBaud);
Blynk.begin(auth, ssid, pass);
timer.setInterval(5000L, checkGPS); // every 5s check if GPS is connected, only really needs to be done once
}
void checkGPS(){
if (gps.charsProcessed() < 10)
{
Serial.println(F("No GPS detected: check wiring."));
Blynk.virtualWrite(V4, "GPS ERROR"); // Value Display widget on V4 if GPS not detected
}
}
void loop()
{
while (ss.available() > 0)
{
// sketch displays information every time a new sentence is correctly encoded.
if (gps.encode(ss.read()))
displayInfo();
}
Blynk.run();
timer.run();
}
void displayInfo()
{
if (gps.location.isValid() )
{
float latitude = (gps.location.lat()); //Storing the Lat. and Lon.
float longitude = (gps.location.lng());
Serial.print("LAT: ");
Serial.println(latitude, 6); // float to x decimal places
Serial.print("LONG: ");
Serial.println(longitude, 6);
Blynk.virtualWrite(V1, String(latitude, 6));
Blynk.virtualWrite(V2, String(longitude, 6));
myMap.location(move_index, latitude, longitude, "GPS_Location");
spd = gps.speed.kmph(); //get speed
if (spd>=80) // if the speed is measured is equal or greater than 80 km
{ Blynk.notify("Alert: CAR over speed"); // send this notification to blynk
}
Blynk.virtualWrite(V3, spd); // this is virtual to pair with blynk APP
sats = gps.satellites.value(); //get number of satellites
Blynk.virtualWrite(V4, sats); // this is virtual to pair with blynk APP
bearing = TinyGPSPlus::cardinal(gps.course.value()); // get the direction
Blynk.virtualWrite(V5, bearing); // this is virtual to pair with blynk APP
Serial.println();
}}
Finally



.jpeg)
.jpeg)

Finally after loading the code in the Node MUC, open Blynk App then create a new project and select device as Node MCU then name your project. After that in the work space add the following widgets (the photos explains the process in sequence):
- Select MAP then set virtual pin V0 as input and select both options on.
- For latitude select value display name LAT and select virtual pin V1 and update every second.
- For longitude select value display name LON and select virtual pin V2 and update every second
- For speed select Gauge and select input as virtual pin V3 and name it as speed, also max speed as 240 Km or as your vehicle limit.
- For the number of satellite lock to your system it is an option you can view it using value display and select V4 as input and update every seconds.
- Add notification widget.
Note that you can customize the workspace as you wish but the parameters that should not be changed is the virtual pins inputs as they are part of the coding.
After that just test the system on the road , its very useful and very nice project.
Hope you enjoyed this project and tell us about your experience
Best regards