Wearables & IoTTechnician

Pocket GPS Tracker and Trip Logger

Record your route while hiking, biking or boating and upload it over Wi-Fi when you get home.

LevelTechnician
Time2 h
Est. cost~$73
Steps5

A GPS module speaks simple text sentences (NMEA) over serial. The Pico reads them, stores your position every few seconds in its flash memory and syncs when it sees your home Wi-Fi.

⚠ SAFETY
Tracking another person without consent can be illegal. This build is for logging your own trips and equipment you own.

Video tutorial

▶ Circuit DigestWatch on YouTube ↗

Video by Circuit Digest, embedded from YouTube. The written steps below are our own and match the parts list.

Mission steps

  1. Wire the GPS

    GPS TX to Pico GP1 (UART0 RX), GPS RX to GP0, power from 3V3 and GND.

  2. Get a fix

    Go outside. A cold start can take a minute or more; the module's LED usually blinks once it has a fix.

  3. Parse NMEA

    Read $GNRMC/$GPRMC sentences for latitude, longitude, speed and time.

  4. Log efficiently

    Write one line every 5–10 seconds. Flash memory has limited write cycles, so buffer and write in batches.

  5. Respect privacy

    Only track yourself or people who clearly agree to it. Hidden tracking of others is illegal in many places.

Code

# MicroPython on Pico 2 W
from machine import UART, Pin
import time

gps = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1))

def to_deg(v, d):
    if not v: return None
    deg = int(float(v) / 100); mins = float(v) - deg * 100
    val = deg + mins / 60
    return -val if d in ('S', 'W') else val

buf = []
while True:
    line = gps.readline()
    if line and (line.startswith(b'$GNRMC') or line.startswith(b'$GPRMC')):
        f = line.decode('ascii', 'ignore').split(',')
        if len(f) > 6 and f[2] == 'A':                    # A = valid fix
            buf.append('%s,%.6f,%.6f\n' % (f[1], to_deg(f[3], f[4]), to_deg(f[5], f[6])))
    if len(buf) >= 12:
        with open('track.csv', 'a') as out:
            out.write(''.join(buf))
        buf = []
        time.sleep(5)

Tip: test every script on the bench before installing it in a moving machine.

Questions

Can it send live position?

Over Wi-Fi only when in range. For live tracking far away, pair it with LoRa (Meshtastic) or a cellular module.