A Little Tracker That Always Knows Where It Is
This pocket-sized gadget picks up its own location from GPS satellites and feels when it's being moved, carried or bumped. It's the same idea behind fitness bands and delivery trackers — built from parts you can hold in your hand.
What This Tracker Can Do
At its heart is an ESP32 — a small but powerful microcontroller — paired with two sensors. A GPS module listens to satellites overhead to work out exactly where the tracker is. An accelerometer feels tilt, shake and sudden movement, the same way a phone knows when you flip it over.
- Finds its own location using live GPS satellite signals.
- Feels motion — tilting, shaking or sudden bumps — using the ADXL335 accelerometer.
- Sounds an alert through a buzzer when strong motion is detected.
- Runs portably from a 12V battery pack, stepped down safely to power every part.
Parts You'll Need
Everything here is easy to find online or at a local electronics store.
ESP32 Dev Board
The brain of the tracker — reads both sensors and can add Wi-Fi later.
₹550NEO-6M GPS Module
Picks up satellite signals to work out latitude and longitude.
₹450ADXL335 Accelerometer
Senses tilt and movement on three axes: X, Y and Z.
₹18012V Battery Pack
Gives the tracker enough power to run untethered for hours.
₹300DC-DC Buck Converter
Safely steps 12V down to the 5V the electronics actually need.
₹120Small Buzzer
Beeps whenever the accelerometer detects sudden movement.
₹30Jumper Wires & Breadboard
For a tidy, beginner-friendly build with no soldering required.
₹150Small Project Box
Keeps everything protected and portable once wiring is tested.
₹100Build It Step by Step
Build and test on a breadboard first — fit everything into the project box only once it's all working.
Gather the parts and plan the box
Lay out all the parts and decide how they'll fit inside the project box, with the GPS antenna facing a side that can see the sky.
Wire the power supply first
Connect the 12V battery to the buck converter, and set its output to exactly 5V with a multimeter before connecting anything else.
Connect the GPS module
Wire the NEO-6M to the ESP32's second hardware serial port (UART2), so it doesn't clash with the USB programming connection.
Connect the accelerometer
Wire the ADXL335's X, Y and Z pins to three of the ESP32's ADC-capable pins, and power it from 3.3V.
Add the motion buzzer
Wire a small buzzer to a spare digital pin so the tracker can beep whenever it detects a sudden movement.
Upload the code
Install the required libraries in the Arduino IDE, select your ESP32 board, and upload the sketch from the code section below.
Calibrate and test outdoors
GPS modules need a clear view of the sky to get a location fix — test outdoors or near a window, and give it 30-60 seconds on first power-up.
| Module | Module Pin | ESP32 Pin |
|---|---|---|
| NEO-6M GPS Module | TX | GPIO16 (RX2) |
| RX | GPIO17 (TX2) | |
| VCC | 5V (from buck converter) | |
| GND | GND | |
| ADXL335 Accelerometer | X-OUT | GPIO34 |
| Y-OUT | GPIO35 | |
| Z-OUT | GPIO32 | |
| VCC / GND | 3.3V / GND | |
| Buzzer | Signal pin | GPIO25 |
| Buck Converter | 12V in / 5V out | Battery+ / ESP32 VIN |
Arduino Code
Install the TinyGPS++ library through the Arduino IDE's Library Manager, then select an ESP32 board from the Boards Manager before uploading.
// ===== ESP32 GPS MOTION TRACKER ===== // Reads live GPS coordinates and watches for sudden // movement using the ADXL335 accelerometer. #include <HardwareSerial.h> #include <TinyGPS++.h> // ---- Pins ---- #define GPS_RX 16 // ESP32 receives GPS data here #define GPS_TX 17 #define ACCEL_X 34 #define ACCEL_Y 35 #define ACCEL_Z 32 #define BUZZER 25 TinyGPSPlus gps; HardwareSerial gpsSerial(2); // use ESP32's UART2 // ---- Motion detection settings ---- float restingMagnitude = 0; // baseline "at rest" reading const float MOTION_THRESHOLD = 0.35; // how big a change counts as motion void setup() { Serial.begin(115200); gpsSerial.begin(9600, SERIAL_8N1, GPS_RX, GPS_TX); pinMode(BUZZER, OUTPUT); digitalWrite(BUZZER, LOW); Serial.println("Calibrating... keep the tracker still for 3 seconds"); delay(3000); restingMagnitude = readAccelMagnitude(); Serial.println("Tracker ready!"); } void loop() { // Feed any incoming GPS bytes to the parser while (gpsSerial.available() > 0) { gps.encode(gpsSerial.read()); } if (gps.location.isUpdated()) { printLocation(); } checkMotion(); delay(200); } void printLocation() { Serial.print("Lat: "); Serial.print(gps.location.lat(), 6); Serial.print(" Lng: "); Serial.print(gps.location.lng(), 6); Serial.print(" Satellites: "); Serial.println(gps.satellites.value()); } float readAccelMagnitude() { int rawX = analogRead(ACCEL_X); int rawY = analogRead(ACCEL_Y); int rawZ = analogRead(ACCEL_Z); // Convert raw ADC readings (0-4095) into roughly -1g to +1g float gx = (rawX - 2048) / 2048.0; float gy = (rawY - 2048) / 2048.0; float gz = (rawZ - 2048) / 2048.0; return sqrt(gx * gx + gy * gy + gz * gz); } void checkMotion() { float currentMagnitude = readAccelMagnitude(); float change = abs(currentMagnitude - restingMagnitude); if (change > MOTION_THRESHOLD) { Serial.println("Motion detected!"); digitalWrite(BUZZER, HIGH); delay(150); digitalWrite(BUZZER, LOW); } }
Troubleshooting
GPS and power issues are the most common hiccups — here's what to check first.
GPS never gets a fix
Move to a spot with a clear view of the sky and wait up to a minute — GPS modules take longer to lock on indoors or near tall buildings.
ESP32 keeps restarting
This usually means the buck converter isn't supplying enough current. Confirm it's rated for at least 1A and set to exactly 5V.
Motion alerts trigger constantly
Increase MOTION_THRESHOLD slightly in the code, and make sure the tracker was held still during the 3-second calibration step.
No GPS data in Serial Monitor
Double-check the GPS TX wire goes to the ESP32's RX pin (and vice versa) — these two are easy to swap by mistake.
Accelerometer readings look random
Add a small 0.1µF capacitor across each ADXL335 output pin and ground to smooth out electrical noise on the analog signal.
Battery drains quickly
Use esp_deep_sleep between GPS reads to cut power use significantly when continuous tracking isn't needed.
Fun Upgrades to Try
Frequently Asked Questions
Is it safe for a 9-year-old to wire up 12V?
Yes, with adult supervision. A 12V battery pack is low-voltage and not dangerous to touch, but it's still important an adult checks the buck converter output before anything is connected to the ESP32.
Why does the GPS module need its own serial port?
The ESP32's main USB connection is used for uploading code and viewing the Serial Monitor. A second hardware serial port (UART2) lets the GPS module talk to the board at the same time without interference.
Does this work indoors?
GPS signals are weak indoors, so the location fix may be slow or missing. The motion detection part of the project works fine indoors regardless.
Can I use a 9V battery instead of 12V?
Yes — just make sure your buck converter's input range covers 9V, and double-check its output is still set to 5V before connecting the ESP32.
What's the difference between this and a phone's GPS?
The same idea, at a smaller scale — a phone combines GPS with Wi-Fi and cell towers for extra accuracy, while this tracker relies on GPS satellites alone, which is slower to lock on but needs far less hardware.

Comments
Post a Comment