# 01 - RouteTrack Pi — Initial Setup & Networking

#### **Date:** December 21st, 2025   
**Category:** Raspberry Pi / Linux / Networking  
**Backlink:** [RouteTrack Pi Overview](https://docs.natenetworks.com/books/06-raspberry-pi-python-linux-tips/chapter/project-routetrack-pi)

---

## Project Overview

This page documents the **initial setup and networking foundation** for a Raspberry Pi–based GPS logging and mapping project designed for in-vehicle use.

The long-term goal of this project is to build a reliable, headless system capable of:

- GPS route logging
- Automatic stop detection
- Time-on-site tracking
- Mileage calculation
- Syncing data to a VPS for web-based visualization

This entry focuses on **hardware bring-up, OS selection, headless access, and resilient Wi-Fi configuration**.

---

## Hardware Used (Initial Phase)

- **Raspberry Pi 3 B+**
- **128 GB microSD card**
- Active **cooling fan** (wired directly to 5 V)
- Phone hotspot (temporary network access)
- Home Wi-Fi (persistent network access)
    
    <table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.244%;"></col><col style="width: 33.244%;"></col><col style="width: 33.244%;"></col></colgroup><tbody><tr><td>[![PXL_20251221_143834980.jpg](https://docs.natenetworks.com/uploads/images/gallery/2025-12/scaled-1680-/JjA9WeUs2g6asUud-pxl-20251221-143834980.jpg)](https://docs.natenetworks.com/uploads/images/gallery/2025-12/JjA9WeUs2g6asUud-pxl-20251221-143834980.jpg)</td><td>[![PXL_20251221_144014396.jpg](https://docs.natenetworks.com/uploads/images/gallery/2025-12/scaled-1680-/XQ2hmktEk5WegRrm-pxl-20251221-144014396.jpg)](https://docs.natenetworks.com/uploads/images/gallery/2025-12/XQ2hmktEk5WegRrm-pxl-20251221-144014396.jpg)</td><td>[![PXL_20251221_144535466.jpg](https://docs.natenetworks.com/uploads/images/gallery/2025-12/scaled-1680-/veLerZmba0dE9ADw-pxl-20251221-144535466.jpg)](https://docs.natenetworks.com/uploads/images/gallery/2025-12/veLerZmba0dE9ADw-pxl-20251221-144535466.jpg)</td></tr><tr><td>[![PXL_20251221_144757810.jpg](https://docs.natenetworks.com/uploads/images/gallery/2025-12/scaled-1680-/a7kQFDPh3KSMo2x2-pxl-20251221-144757810.jpg)](https://docs.natenetworks.com/uploads/images/gallery/2025-12/a7kQFDPh3KSMo2x2-pxl-20251221-144757810.jpg)</td><td>[![PXL_20251221_150315849.jpg](https://docs.natenetworks.com/uploads/images/gallery/2025-12/scaled-1680-/y6Tx5mk6S50mtusc-pxl-20251221-150315849.jpg)](https://docs.natenetworks.com/uploads/images/gallery/2025-12/y6Tx5mk6S50mtusc-pxl-20251221-150315849.jpg)</td><td>[![PXL_20251221_150509809.jpg](https://docs.natenetworks.com/uploads/images/gallery/2025-12/scaled-1680-/8bmBrtif7jwsLIqk-pxl-20251221-150509809.jpg)](https://docs.natenetworks.com/uploads/images/gallery/2025-12/8bmBrtif7jwsLIqk-pxl-20251221-150509809.jpg)</td></tr><tr><td>[![PXL_20251221_151938820.jpg](https://docs.natenetworks.com/uploads/images/gallery/2025-12/scaled-1680-/iGeLchRjz3xVX1Rg-pxl-20251221-151938820.jpg)](https://docs.natenetworks.com/uploads/images/gallery/2025-12/iGeLchRjz3xVX1Rg-pxl-20251221-151938820.jpg)</td><td>[![PXL_20251221_151936565.jpg](https://docs.natenetworks.com/uploads/images/gallery/2025-12/scaled-1680-/vBKRIKJgmbFLzwmS-pxl-20251221-151936565.jpg)](https://docs.natenetworks.com/uploads/images/gallery/2025-12/vBKRIKJgmbFLzwmS-pxl-20251221-151936565.jpg)</td><td>[![PXL_20251221_152951942.jpg](https://docs.natenetworks.com/uploads/images/gallery/2025-12/scaled-1680-/YzM5K8QT3rfRoRWL-pxl-20251221-152951942.jpg)](https://docs.natenetworks.com/uploads/images/gallery/2025-12/YzM5K8QT3rfRoRWL-pxl-20251221-152951942.jpg)</td></tr></tbody></table>

---

## Cooling &amp; Power Verification

The cooling fan was wired directly to the Raspberry Pi’s 5 V rail:

- **Pin 4** → 5 V (red wire)
- **Pin 6** → Ground (black wire)

Results:

- Fan spins immediately on power-up
- No GPIO or software control required
- Consistent airflow suitable for a vehicle environment

An always-on fan was chosen for simplicity and reliability.

---

## Operating System Selection

**Installed OS:**

- **Raspberry Pi OS Lite (64-bit)**

**Reasoning:**

- Lower memory overhead (ideal for Pi 3 B+ with 1 GB RAM)
- Headless by design (no desktop services running)
- Best compatibility with:
    
    
    - `gpsd`
    - Python and Node.js tooling
    - systemd services
    - Networking utilities
- Proven stability for long-running deployments

The OS was written using **Raspberry Pi Imager** with Advanced Options enabled:

- SSH enabled
- Username and password set
- Wi-Fi configured for initial hotspot access
- Custom hostname configured (`pi-gps`)

---

## Headless SSH Access

After first boot:

- The Pi appeared on the phone hotspot
- SSH access was established using **JuiceSSH (Android)**
- No monitor or keyboard was required

This confirmed:

- OS integrity
- Network stack functionality
- Full remote administration capability

---

## Wi-Fi Management (Scanning, Adding, Deleting)

This project uses **NetworkManager** on Raspberry Pi OS, so Wi-Fi is managed using the `nmcli` command-line tool.

### Scan for available Wi-Fi networks

```bash
sudo nmcli connection show
```

```bash
sudo nmcli dev wifi rescan
sudo nmcli dev wifi list
```

[![2025-12-21 13_39_55-Greenshot.png](https://docs.natenetworks.com/uploads/images/gallery/2025-12/scaled-1680-/nz9sCXRdIl4D8kU4-2025-12-21-13-39-55-greenshot.png)](https://docs.natenetworks.com/uploads/images/gallery/2025-12/nz9sCXRdIl4D8kU4-2025-12-21-13-39-55-greenshot.png)

### Check current network status

```bash
sudo nmcli device status
sudo nmcli -f GENERAL.CONNECTION,GENERAL.STATE dev show wlan0
```

### Add / connect to a Wi-Fi network

(This also saves the network for future use.)

```bash
sudo nmcli dev wifi connect "SSID" password "PASSWORD"
```

If the SSID is hidden:

```bash
sudo nmcli dev wifi connect "SSID" password "PASSWORD" hidden yes
```

### List saved Wi-Fi connections

```bash
sudo nmcli -f NAME,TYPE,DEVICE connection show
```

### Switch networks manually (useful for testing)

```bash
sudo nmcli connection up "HomeWiFi"
# or
sudo nmcli connection up "PhoneHotspot"
```

### Rename a saved connection

(Helps keep connection names readable.)

```bash
sudo nmcli connection modify "OldName" connection.id "NewName"
```

### Delete a saved Wi-Fi connection

Delete by **connection NAME** (from `nmcli connection show`), not necessarily the SSID.

```bash
sudo nmcli connection delete "ConnectionName"
```

### Set auto-connect priorities

(Higher number = preferred when multiple known networks are available.)

```bash
sudo nmcli connection modify "HomeWiFi" connection.autoconnect yes
sudo nmcli connection modify "HomeWiFi" connection.autoconnect-priority 10

sudo nmcli connection modify "PhoneHotspot" connection.autoconnect yes
sudo nmcli connection modify "PhoneHotspot" connection.autoconnect-priority 1
```

[![image.png](https://docs.natenetworks.com/uploads/images/gallery/2025-12/scaled-1680-/M1YZElVIL1o8yoJO-image.png)](https://docs.natenetworks.com/uploads/images/gallery/2025-12/M1YZElVIL1o8yoJO-image.png)

### Restart networking (if things get weird)

```bash
sudo systemctl restart NetworkManager
```

## Multi-Wi-Fi Configuration

The Pi is intended to operate across **multiple networks**:

- Home Wi-Fi when taken home
- Phone hotspot while mobile

Wi-Fi management is handled by **NetworkManager**, allowing:

- Multiple saved Wi-Fi profiles
- Automatic reconnection
- Priority-based network selection

Saved connections:

- **HomeWiFi**
- **PhoneHotspot**

Verified using:

```bash
sudo nmcli connection show
```

---

## Automatic Network Failover

Network priorities were configured to prefer home Wi-Fi:

```bash
sudo nmcli connection modify HomeWiFi connection.autoconnect-priority 10
sudo nmcli connection modify PhoneHotspot connection.autoconnect-priority 1
```

Behavior:

- Home Wi-Fi is preferred when available
- Phone hotspot is used automatically when mobile
- Switching occurs without reboot or manual intervention

Failover was verified by disabling the hotspot and confirming the Pi automatically connected to the home network.

---

## Wi-Fi Band Notes (Pi 3 B+)

- The Pi 3 B+ supports **dual-band Wi-Fi (2.4 GHz and 5 GHz)**
- 5 GHz networks require:
    
    
    - Correct WLAN country configuration
    - Non-DFS channels (36–48)
- 2.4 GHz is preferred for mobile hotspot reliability
- Both bands were successfully tested during setup

---

## Current Status

At this stage, the system has a solid foundation:

- OS installed and verified
- SSH access confirmed
- Cooling operational
- Multiple Wi-Fi networks configured
- Automatic failover tested and working
- Network behavior stable for mobile use

The Raspberry Pi is now **ready for GPS hardware integration**.

---

## Next Steps

Upcoming phases will document:

- GPS hardware installation
- `gpsd` configuration and testing
- Route and stop logging
- Mileage calculation
- Local web UI
- VPS synchronization and map visualization