Build a Private LoRa Pet Tracker (No Monthly Fees)
A complete guide to building a long-range, multi-pet tracking system that works without cellular networks.
If you've ever looked at commercial pet trackers, you know the pain: they are expensive, require a monthly subscription, and rely on cellular networks that often fail when hiking or in rural areas.
In this guide, we are building a private, long-range tracking system using LoRa. Whether you have one puppy or a whole pack, this system scales easily—one receiver can track multiple pets simultaneously.
How It Works
- Unique IDs: We assign a unique ID (e.g., "PUPPY_1") to each collar.
- The "Party Line": All pets transmit on the same frequency (865MHz for India).
- Collision Avoidance: A random delay is added before sending data to prevent pets from talking over each other.
1. Parts & Cost (India Pricing)
The beauty of this project is that the "Base Station" is a one-time cost. You only need to replicate the "Tracker Node" for each pet.
Heltec LoRa 32 V3
₹2,200The brain + radio. Handles both transmitting (pet) and receiving (home).
NEO-6M GPS
₹450Standard ceramic antenna module for location data.
1000mAh LiPo
₹500Provides power for the tracker. Ensure it's 3.7V.
High-Gain Antenna
₹800Optional for the Base Station to extend range to 5km+.
Total Estimated Cost per Pet:
~₹3,250 – ₹4,250 (depending on casing and battery choice).
3. The Wiring
The wiring is identical for every collar you build. We connect the GPS module via UART (Serial) to the Heltec board.
- GPS VCC → Heltec 3V3
- GPS GND → Heltec GND
- GPS TX → Heltec GPIO 47
- GPS RX → Heltec GPIO 48
4. Transmitter Code (The Collar)
Flash this code to the board on the pet. Important: Change the deviceID variable for each new pet (e.g., "PUPPY_1", "DAISY_2").
#include <heltec_unofficial.h>
#include <TinyGPS++.h>
// --- CONFIGURATION ---
String deviceID = "BUDDY_01"; // CHANGE THIS for pet #2
// ---------------------
#define GPS_RX 47
#define GPS_TX 48
HardwareSerial gpsSerial(1);
TinyGPSPlus gps;
void setup() {
heltec_setup();
gpsSerial.begin(9600, SERIAL_8N1, GPS_RX, GPS_TX);
// LoRa Settings for Long Range
radio.setBandwidth(125.0);
radio.setSpreadingFactor(12);
radio.setCodingRate(8);
radio.setOutputPower(22);
}
void loop() {
heltec_loop();
while (gpsSerial.available() > 0) {
gps.encode(gpsSerial.read());
}
static unsigned long lastSend = 0;
// Send every 15s + random delay to avoid collision
int randomDelay = random(0, 2000);
if (millis() - lastSend > (15000 + randomDelay)) {
if (gps.location.isValid()) {
// Packet: "ID,Lat,Lng" -> "BUDDY_01,18.5204,73.8567"
String payload = deviceID + "," + String(gps.location.lat(), 6) + "," + String(gps.location.lng(), 6);
display.clear();
display.printf("Sending: %s", payload.c_str());
radio.transmit(payload.c_str());
} else {
display.clear();
display.println("Waiting for GPS...");
}
lastSend = millis();
}
}
5. Receiver Script (Base Station)
This Python script runs on your PC (connected to the Receiver Heltec board via USB). It logs the location of all your pets into a CSV file.
import serial
import csv
import time
SERIAL_PORT = '/dev/ttyACM0'
LOG_FILE = "tracker_logs.csv"
def main():
ser = serial.Serial(SERIAL_PORT, 115200, timeout=1)
print(f"Tracking System Active on {SERIAL_PORT}...")
with open(LOG_FILE, mode='a', newline='') as file:
writer = csv.writer(file)
# Write Header if file is empty
if file.tell() == 0:
writer.writerow(["Timestamp", "Pet_ID", "Latitude", "Longitude", "RSSI"])
while True:
if ser.in_available():
try:
# Expecting: "BUDDY_01,18.5204,73.8567"
line = ser.readline().decode('utf-8').strip()
if "," in line:
parts = line.split(",")
if len(parts) >= 3:
pet_id = parts[0]
lat = parts[1]
lng = parts[2]
timestamp = time.strftime("%Y-%m-%d %H:%M:%S")
print(f"[{timestamp}] {pet_id} is at {lat}, {lng}")
writer.writerow([timestamp, pet_id, lat, lng])
file.flush()
except Exception as e:
print(f"Signal Glitch: {e}")
if __name__ == "__main__":
main()
Summary & Tips
📡 Frequency Check
Ensure you buy 868MHz boards. While 865-867MHz is the license-free band for India, 868MHz boards are widely available and work perfectly for hobby use.
🔋 Battery Safety
If your puppy is a chewer, use a 3D-printed case with 3mm thick walls or wrap the battery in Kapton tape to prevent punctures.