A real-time IoT-based pet tracking system built with the GeoLinker GL868_ESP32 board. It uses GPS, GSM, geofencing, an E-paper display, and cloud connectivity to monitor your pet's location and send instant alerts when they leave a safe zone.
Disclaimer: No animals were harmed during the development and testing of this project.
- Overview
- How It Works
- Components Required
- Circuit Diagram
- Hardware Assembly
- 3D Enclosure Design
- Software Setup
- Code Explanation
- Output & Demonstration
- Applications
- Troubleshooting
- FAQ
- Future Improvements
- Related Projects
- License
"Where did my pet go?" β If you have a pet, you've probably asked this question at least once. This project provides a practical solution by building a smart pet tracking collar that:
- π Tracks your pet's real-time GPS location
- π§ Monitors multiple geofence zones (Home, Garden, Park, Restricted Area)
- π± Sends SMS alerts & voice calls when boundaries are crossed
- πΊ Displays pet status on an E-paper screen (retains info even without power)
- βοΈ Uploads location data to CircuitDigest Cloud for live map tracking
Note: This is a proof-of-concept project intended for learning and experimentation. It should not be considered a replacement for commercially certified pet tracking products.
The system operates in three continuous stages:
- On power-up, the GeoLinker board initializes GPS, GSM/GPRS, E-paper display, and cloud services.
- Previously saved geofence states are restored from flash memory to avoid false alerts after restart.
- The GPS module continuously acquires latitude, longitude, speed, and other location data.
- Current coordinates are compared against all predefined geofence zones using the Haversine formula.
- Zone Entry/Exit: An SMS alert is sent with location, speed, battery %, and a Google Maps link.
- Restricted Zone: In addition to SMS, a voice call is placed to the caretaker for critical alerts.
- GPS Loss: If GPS signal is unavailable for multiple consecutive attempts, a GPS-loss alert is sent.
- On-Demand Location: The caretaker can send a
LOCATIONSMS command to receive the pet's latest coordinates. - E-paper Display:
- Normal: Shows pet name and healthy status.
- Lost/Restricted Zone: Shows "My Pet is Lost" with the caretaker's phone number.
- Retains content even when battery is fully drained.
- Periodically uploads GPS location, battery %, and signal strength to the CircuitDigest Cloud.
- Live map tracking via the cloud dashboard.
- Continuously checks for GPS updates, geofence events, incoming SMS commands, and display status.
- E-paper display refreshes only on status change to conserve power and extend display life.
| S.No | Components | Purpose | Alternatives |
|---|---|---|---|
| 1 | GeoLinker GL868_ESP32 Board | GeoLinker GL868_ESP32 is a production-ready, open-source development board that combines an ESP32-S3 and SIM868 GSM modem, used for tracking purposes. | β |
| 2 | IoT / Normal Nano SIM Card | Airtel M2M IoT SIM recommended (3 months free data with board purchase). Any 2G-compatible SIM works. | Regular 2G SIM |
| 3 | 3.7V Li-Ion Battery | Used for powering the board. | LiPo pouch battery |
| 4 | USB-C Cable | Programming, testing & charging. | β |
| 5 | E-Paper Display | For displaying different messages and retaining content even when power is out. | β |
The GeoLinker board integrates the ESP32 microcontroller, GPS, GSM, and GPRS modules on a single board, eliminating the need for multiple separate modules. Only the E-paper display needs to be externally connected via SPI.
A 3.7V lithium-ion battery connects directly to the GeoLinker board for portable operation.
The E-paper display and battery are connected to the GeoLinker board and arranged inside the 3D-printed enclosure. The compact layout allows all components to fit comfortably within the collar enclosure.
The enclosure was designed in Autodesk Fusion 360 and consists of two parts:
| Part | Description |
|---|---|
| Base | Houses the GeoLinker board, 3.7V battery, and internal wiring. |
| Lid | Features a precisely sized cutout for the E-paper display, ensuring the screen remains visible while protecting the electronics. |
Key Features:
- Collar slots on both sides for mounting onto a standard pet collar
- Lightweight and durable 3D-printed construction
- Easy assembly with secure component placement
π 3D design files are available in the /3D-Design folder of this repository. You can modify them in Fusion 360 or use them as-is for printing.
- Arduino IDE (v2.x recommended)
- GeoLinker board support package installed
- Required libraries (see code dependencies)
Update the following constants in the main code file before uploading:
#define DEVICE_ID "your_device_id"
#define API_KEY "your_api_key"
#define ALERT_NUMBER "+91XXXXXXXXXX" // Caretaker's phone number
#define PET_NAME "YourPetName"- Connect the GeoLinker board via USB-C.
- Select the correct board and port in Arduino IDE.
- Update the configuration constants above.
- Configure your geofence zones (latitude, longitude, radius).
- Upload the code to the board.
void setup() {
Serial.begin(115200);
loadZoneStates(); // Restore saved geofence states from flash
GeoLinker.begin(DEVICE_ID, API_KEY);
GeoLinker.gpsOn();
epdInit(); // Initialize E-paper display
}bool hasLoc = getValidLocation(&gps);
if (hasLoc) {
checkGeofences(&gps, hasLoc);
}
// Distance calculation using Haversine formula
double dist = haversineDistance(
gps->latitude, gps->longitude,
zones[i].latitude, zones[i].longitude
);static void sendGeofenceAlert(const char *zoneName, bool entered,
bool restricted, GPSData *gps, bool hasLoc) {
char msg[256];
buildAlertMessage(msg, sizeof(msg), entered ? "ENTERED" : "LEFT",
zoneName, gps, hasLoc);
sendReliableSMS(ALERT_NUMBER, msg);
// Schedule voice call for restricted zones
if (restricted && !callInProgress && !pendingCall) {
pendingCall = true;
pendingCallTimer = millis();
}
}static void epdUpdateIfNeeded() {
if (petIsLost == displayShowsLost) return; // No change needed
if (petIsLost)
epdShowLost(); // Shows "My Pet is Lost" + phone number
else
epdShowHealthy(); // Shows pet name + healthy status
displayShowsLost = petIsLost;
}void loop() {
GeoLinker.update();
checkIncomingSMS(); // Handle "LOCATION" SMS commands
bool hasLoc = getValidLocation(&gps);
checkGeofences(&gps, hasLoc);
// Cloud data upload at regular intervals
if (!pendingCall && !callInProgress &&
millis() - lastCloudPush >= CLOUD_SEND_INTERVAL * 1000UL) {
lastCloudPush = millis();
cloudPush(&gps, hasLoc);
}
}A spoof code is also available in this repository, allowing you to test the entire system (geofence alerts, SMS, calls, cloud upload) without physically moving β useful for development and debugging.
The cloud dashboard provides a live map showing the pet's real-time location and geofence zone status.
| Condition | Display |
|---|---|
| Normal (inside safe zone) | Pet name + owner contact details |
| Restricted zone / Lost |
- SMS Alert: Sent when the pet exits a safe zone β includes event details, location, and Google Maps link.
- Voice Call: Automatically placed when the pet enters a restricted area β ensures critical alerts are not missed.
| Application | Description |
|---|---|
| π Prevention of Pet Theft | Pet theft is an increasing problem in many regions. By providing real-time location information and instant alerts when unusual movement is detected, the Smart Pet Safety System serves as an additional layer of protection against theft. |
| πΆ Child and Elderly Safety Monitoring | The device can be used to track children, elderly individuals, or people requiring special care. Caregivers receive instant alerts if the wearer moves beyond predefined safe zones, improving safety and response times. |
| π Vehicle and Fleet Management | The solution can be integrated into vehicles for route monitoring, theft prevention, and fleet management. Real-time GPS tracking helps optimize operations and improve vehicle security. |
| π Livestock and Animal Monitoring | Farmers and animal caretakers can use the system to track livestock, working animals, or pets across large areas, ensuring they remain within designated boundaries. |
| π¦ Parcel Tracking and Delivery Management | The same geofencing and GPS tracking technology can be used for parcel tracking and last-mile delivery management. A GPS-enabled tracking device attached to a valuable package can continuously report its location while monitoring predefined geofenced areas such as warehouses, distribution centers, or delivery zones. |
| Problems | Cause | Solutions |
|---|---|---|
| GSM module fails to connect to the network | SIM card is not inserted correctly, network coverage is weak, or SIM services are inactive. | Check SIM card placement, verify network availability, and ensure the SIM card has an active plan with sufficient balance. |
| Voice call alerts are not working | Network issues, insufficient SIM balance, or incorrect call configuration. | Confirm GSM connectivity, ensure calling services are enabled, and verify emergency contact settings. |
| E-paper display remains blank | Display initialization failure, loose wiring, or power supply issues. | Verify all SPI connections, check display power requirements, and ensure the display initialization code executes correctly. |
| Battery drains faster than expected | Continuous GPS tracking, frequent GSM communication, or lack of power-saving features. | Increase update intervals, optimize code efficiency, and enable low-power modes when possible. |
| System freezes during operation | Memory overflow, software bugs, or communication conflicts between modules. | Debug the code, monitor memory usage, and test each module independently to identify the issue. |
| Whitelisted number not receiving alerts | The phone number is not added correctly, stored in an incorrect format, or the whitelist configuration has not been updated in the system. | Verify that the number is entered correctly with the appropriate country code, check the whitelist settings in the firmware, and restart the device after updating the configuration. |
1. Can multiple safe zones be configured?
Yes. The system can be programmed to monitor multiple geofenced areas depending on the application requirements.
2. What are the possible future improvements?
Future enhancements may include mobile app integration, cloud connectivity, AI-based analytics, health monitoring sensors, longer battery life, and real-time dashboard visualization.
3. What happens when the device moves outside the safe zone?
The system detects the boundary violation and automatically sends an alert message and location details to the registered contact number.
4. Why is an e-paper display used instead of a regular display?
E-paper displays consume very little power and remain visible even in bright sunlight, making them ideal for portable and battery-powered applications.
5. What is geofencing?
Geofencing is a virtual boundary created around a specific location. When the tracked object enters or exits this area, the system automatically generates alerts and notifications.
6. How are alerts sent to users?
Alerts are sent through a GSM module using SMS messages and voice calls, ensuring notifications can be received even without internet access.
- π± Mobile app integration for easier configuration and monitoring
- π€ AI-based analytics for behavior pattern detection
- π Health monitoring sensors (body temperature, heart rate)
- π Extended battery life with low-power GNSS modules
- π‘ Wi-Fi / Bluetooth for indoor tracking
- π IMU sensor for activity and collar-removal detection
- π Real-time dashboard visualization
- Arduino GPS Tracker using SIM800L and NEO-6M
- ESP32 GPS Tracker with SIM800L and NEO6M Module
- Raspberry Pi Pico GPS Tracker
- ESP32 Interactive Voice Response System using GeoLinker
- ESP32 GSM Calling Device using GeoLinker
β If you found this project helpful, please give it a star!