A MicroPython GPS navigation device built on the Raspberry Pi Pico. An 8-LED NeoPixel ring acts as a directional indicator — pointing north in compass mode, or toward the nearest trail waypoint in navigation mode.
| Component | Connection |
|---|---|
| 8x NeoPixel ring | GPIO 0 |
| GPS module (UART) | RX → GPIO 5, 9600 baud |
| HMC5883L magnetometer | SDA → GPIO 28, SCL → GPIO 29 |
Compass mode (COMPASS_MODE = True): one LED always points magnetic north.
Navigation mode (COMPASS_MODE = False): once a GPS fix is acquired, the device loads trail waypoints from yosemite-trails.geojson within a 2 km radius and points the LED toward the nearest one.
- 10-second magnetometer calibration — slowly rotate the device through a full circle while the LEDs chase around the ring.
- North LED blinks 5 times so you can orient the device physically.
- Main loop begins.
Edit the constants at the top of main.py:
NUM_LEDS = 8 # number of LEDs in the ring
NORTH_LED = 4 # which LED index faces "forward" on the device
COMPASS_MODE = True # True = compass, False = navigate to waypoint
NEARBY_RADIUS_M = 2000 # radius in metres to scan for waypoints
REFRESH_EVERY_MS = 10000 # how often to re-scan the waypoint fileTrail data is stored in yosemite-trails.geojson (standard GeoJSON format). The parser streams the file in 256-byte chunks to keep RAM usage low, so large files are fine. To use a different area, swap in any GeoJSON file with LineString or MultiLineString features and update the GEOJSON filename constant.
Use the MicroPico VS Code extension (.micropico config is included). Copy main.py and yosemite-trails.geojson to the root of the Pico's filesystem.