ESP32 GPS Motion Tracker: Robotics

ESP32 GPS Motion Tracker: Robotics Project for Kids | MakeMindz
ESP32 Project · Beginner Friendly

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.

Ages 9–14 with adult help for wiring
~2.5 hrs build time
₹1,700–1,900 total parts cost
11.23°N 76.96°E ESP32 + GPS + ADXL335

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.

₹550
🛰️

NEO-6M GPS Module

Picks up satellite signals to work out latitude and longitude.

₹450
📐

ADXL335 Accelerometer

Senses tilt and movement on three axes: X, Y and Z.

₹180
🔋

12V Battery Pack

Gives the tracker enough power to run untethered for hours.

₹300
⚡

DC-DC Buck Converter

Safely steps 12V down to the 5V the electronics actually need.

₹120
🔔

Small Buzzer

Beeps whenever the accelerometer detects sudden movement.

₹30
🧵

Jumper Wires & Breadboard

For a tidy, beginner-friendly build with no soldering required.

₹150
📦

Small Project Box

Keeps everything protected and portable once wiring is tested.

₹100

Build 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.

Important: never connect the 12V battery directly to the ESP32 or GPS module — both only accept up to 5V and will be damaged by 12V.

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.

Tip: the ADXL335 is an analog sensor — it outputs a changing voltage, not digital data, so it must connect to ADC pins.

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.

Circuit Diagram

Here's how every part connects back to the ESP32, powered down from the 12V pack.

ESP32 Dev Board 12V Battery Pack Buck: 12V→5V NEO-6M GPS Module ADXL335 Accelerometer Buzzer Motion alert Project Box GPS antenna faces upward, toward sky
ModuleModule PinESP32 Pin
NEO-6M GPS ModuleTXGPIO16 (RX2)
RXGPIO17 (TX2)
VCC5V (from buck converter)
GNDGND
ADXL335 AccelerometerX-OUTGPIO34
Y-OUTGPIO35
Z-OUTGPIO32
VCC / GND3.3V / GND
BuzzerSignal pinGPIO25
Buck Converter12V in / 5V outBattery+ / 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.

gps_motion_tracker.ino
// ===== 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

📶 Add Wi-Fi to send live location to a phone app
🗺️ Plot the tracked path on a map using the logged coordinates
🔋 Add deep sleep to stretch battery life to several days
📳 Swap the buzzer for a small vibration motor
💾 Log GPS points to an SD card for a full day's journey

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.

MakeMindz

Hands-on robotics projects for curious kids.

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
★★★★★ Young inventors love it!
🖨️
3D Print
All parts
⚡
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 ₹300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
★★★★★ Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 ₹200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course