DIY GPRS Tracker + Firebase: From Hardware to Real-Time Dashboard
Build a low-cost GPRS GPS tracker and stream live location to Google Firebase. Step-by-step guide with hardware list, code examples, and dashboard setup.Harness the power of mmWave radar technology for precise motion detection and distance measurement
Introduction
In this tutorial, we’ll learn how to build a GPRS GPS tracking device that sends real-time location data to Google Firebase . This project combines a GPS module for position detection and a GPRS module (such as SIM800 or SIM900) for wireless data transmission. By integrating Firebase, you can view live tracking data from anywhere using a simple web or mobile dashboard.
Hello friends! As the project name suggests, this is a GPRS Tracking Device designed to monitor the live location of a car. I built this project to track my own car’s movement in real-time using an Android app. The tracking module is installed in the vehicle, and the app displays its live position on the map — simple, reliable, and effective.
To make it easy to understand, we’ve divided this project into two main parts. The first part involves building the GPRS device that will be placed inside the car, and the second part focuses on developing the Android app for live location tracking. To enable communication between both parts, we’re using Google Firebase as a real-time database. This means you don’t need any paid server — Firebase handles everything for free, making the project affordable and beginner-friendly.
In this tutorial, we’ll build a real-time GPS tracking system using the ESP32 TTGO T-Call board (which includes the SIM800L GPRS module) and Google Firebase as the cloud database. This project sends live GPS coordinates from the ESP32 board to Firebase through the GPRS network, allowing you to monitor the exact location of your vehicle or asset using a simple Android app or web dashboard. — it’s compact, efficient, and supports both Wi-Fi and GSM. Plus, Firebase provides a free, real-time database, so you don’t need to purchase any hosting or external servers.
Required Components
- ESP32 TTGO T-Call with SIM800L Board -Main microcontroller with built-in GPRS modem
- GPS Module (NEO-6M / NEO-7M)-For latitude and longitude data
- Micro SIMCARD with 3G support-To connect to mobile network
- Cellphone for App installation-
- USB Cable- For programming the ESP32
Working Principle
- The GPS module sends NMEA data strings (latitude, longitude, etc.) to the ESP32.
- The ESP32 TTGO T-Call extracts this information and prepares a JSON data packet.
- Using the SIM800L GPRS module, the ESP32 connects to the internet and uploads this data to Google Firebase.
- The Firebase Realtime Database stores the data instantly.
- The Android app or web dashboard retrieves this data and displays the location on Google Maps in real time.
Part-I Setting Up Google Firebase As Server
You need to create a Google Firebase project and set up a Realtime Database to act as your server. Using HTTPS requests, the ESP32 TTGO T-Call sends location data to Firebase, where it is stored as a node. Firebase then serves as the backend from which your mobile application can fetch GSM-based location values and display them on Google Maps in real time.
- 1.Go to Firebase Console
- Click Add Project → name it (e.g., CarTrackerESP32).
- Select Realtime Database and create one in test mode.
- Copy your Database URL (e.g., https://cartrackeresp32-default-rtdb.firebaseio.com/).
- Go to Project Settings → Service Accounts → Database Secrets, and note your Database Secret Key (or generate one).
For a complete Firebase tutorial, please follow the link below.
In this blog, I explain the entire setup and configuration process for Google Firebase.
Firebase Tutorial with Realtime DatabasePart-II ESP32 Hardware Setup
We are using the ESP32 TTGO T-Call (SIM800L) module as the main tracking device and the Arduino IDE for programming. The TTGO T-Call is an ESP32 development board that integrates a SIM800L GSM/GPRS module, allowing both Wi-Fi and cellular connectivity in one compact unit. To get started, we’ll install the ESP32 Board Manager in the Arduino IDE using the link provided below:
"https://dl.espressif.com/dl/package_esp32_index.json,http://arduino.esp8266.com/stable/package_esp8266com_index.json"Its time to install library as per requirement GPRS tracking we need GSM library for communicated with SIM800L link is as
Download Arduino LibraryESP32 and SIM800L Connection:
Code Explain:
Its time to explain some coding part first need to set GPRS setting for your SIM card like following
// Your GPRS credentials (leave empty, if not needed)
const char apn[] = "internet"; // APN (example: internet.vodafone.pt) use https://wiki.apnchanger.org
const char gprsUser[] = ""; // GPRS User
const char gprsPass[] = ""; // GPRS Password
// SIM card PIN (leave empty, if not defined)
const char simPIN[] = "";
After it we need to make sure about server setting code
// Server details
// The server variable can be just a domain name or it can have a subdomain. It depends on the service you are using
const char server[] = "example.com"; // domain name: example.com, maker.ifttt.com, etc
const char resource[] = "123456/Location"; // resource path, for example: /post-data.php
const int port = 443; // server port number
int keycounter = 1;
String apiKeyValue = "DIciyfpmZuJNDuuNe7HFCWxIAO4yL4hwnMTRN2AT";
Now it’s time to define the serial interfaces — one for the SIM800L module, used to send AT commands, which we’ll call SerialAT, and another for debugging, which we’ll refer to as SerialMon.
// Set serial for debug console (to Serial Monitor, default speed 115200)
#define SerialMon Serial
// Set serial for AT commands (to SIM800 module)
#define SerialAT Serial1
Library we use for this project is TinyGSM as explain above other library to sending data on internet using mobile internet services.
"ArduinoHttpClient.h" lilbrary combine some other library as given in below code
#ifndef ArduinoHttpClient_h
#define ArduinoHttpClient_h
#include "HttpClient.h"
#include "WebSocketClient.h"
#include "URLEncoder.h"
#endif
As we need AT Command to fetch GSM location. list of AT Command are as following
Getting data string from AT Command and format is as you want to send it to server. here we use
sprintf(tmpstr, "{\"%d\" : {\"Location\" : \"%s-%s\", \"Date\" : \"%s\", \"Time\" : \"%s\"}}",
_keycounter++, parsedstr[1], parsedstr[2], parsedstr[3], parsedstr[4].c_str());
Part-III Building the Android App
Steps:
Sure! Here’s a simple Firebase + Google Maps Android app code sample that fetches live GPS coordinates from Firebase and updates a marker on Google Maps in real time. This example uses Java with Android Studio.
Prerequisites
- Create a Firebase project with a Realtime Database.
- Add your Android app to Firebase and download google-services.json.
- Add Firebase Realtime Database dependency and Google Maps API dependency in build.gradle:
// app/build.gradle
dependencies {
implementation 'com.google.firebase:firebase-database:20.3.1'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'
}
Note-Enable Google Maps SDK and get an API key.
Project Advantages
🚩 Conclusion
Building a GPRS GPS Tracker using the ESP32 TTGO T-Call and Google Firebase is an excellent IoT project for beginners and enthusiasts. This setup provides real-time location monitoring using a cost-effective board and a free cloud backend..
You can easily expand this project to add SMS alerts, Firebase Cloud Messaging, or even geo-fencing alarms. With just one board, one SIM card, and a few lines of code, you’ve created your own IoT-based vehicle tracking system — smart, scalable, and reliable!
Where is sketch code sir
ReplyDelete