Skip to content

PE5PVB/TenMeg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TenMeg GPSDO

GPS-disciplined 10 MHz OCXO with stratum-1 NTP server, flip-clock, and a graphical UI for the Raspberry Pi Pico 2 W (RP2350).

Features

GPSDO control loop

  • 10 MHz OCXO with GPS-disciplined frequency correction
  • Resolution: 1 Hz single-sample (100 ppb), <1 ppb after averaging
  • Drift: typically below 10 ppb when locked
  • PI controller with gain scheduling (ACQUIRE for large errors, TRACKING after convergence)
  • Median-of-5 filter on the 1PPS samples for robustness against GPS jitter
  • Holdover mode on GPS signal loss (DAC frozen at the average of the last 300 s)

Display (ST7789V2 320×170)

Nine pages reachable with the rotary encoder:

  1. Main — EFC / UTC time / drift / temperature / lat-lon
  2. GPS satellites — PRN, elevation, azimuth, SNR per satellite
  3. BeiDou / GNSS satellites — multi-constellation overview
  4. Phase graph — cumulative TIE in nanoseconds over time
  5. EFC graph — DAC value history
  6. ADEV — Allan Deviation at τ = 10, 100, 300, 1000 s
  7. Network — WiFi status / IP / NTP request counter
  8. Flip-clock — full-screen digital clock with split-flap animation
  9. GPS Info — Maidenhead 12-character locator, lat/lon precision, altitude/geoid, HDOP/VDOP/PDOP, fix type

NTP server

  • Stratum 1 on UDP/123
  • Precision: ~1 µs (PPS-anchored to the OCXO-disciplined cycle counter)
  • Auto-sync of the Unix second on every fresh GPS timestamp
  • Reachable over both WiFi and USB Ethernet

NMEA TCP server

  • Port 10110, forwards GPS NMEA sentences to up to 4 clients

HTTP status dashboard

  • Web interface on port 80, JSON polled every second by the embedded JS
  • Shows lock status, EFC, frequency error, drift, satellites per constellation, ADEV values, NTP request counter, uptime
  • Reachable via the WiFi IP (shown on the Network page) or http://192.168.7.1 via USB
  • Multilingual (EN / NL / DE / FR), follows the language selected in the on-device menu

Watchdog

  • 8 s timeout via the RP2350 hardware watchdog
  • Resets on hangs (e.g. lwIP deadlock, infinite reconnect loop)
  • Auto-pauses when a debugger is attached

USB composite device

The Pico enumerates as two devices on Windows 10/11 with no driver install required:

  1. COM port (CDC ACM) — debug serial output
  2. Network adapter "TenMeg Network" (CDC-NCM) — virtual ethernet
    • Pico IP: 192.168.7.1
    • Host receives 192.168.7.2 via DHCP
    • All services (NTP, NMEA TCP, HTTP) are reachable without WiFi
    • CDC-NCM is native on Windows 10 (1809+), Windows 11, Linux and macOS

WiFi captive portal

  • AP TenMeg_Setup for first-time configuration
  • Scans available networks and shows signal strength
  • Rescan button in the web UI
  • Credentials are stored in flash

Hardware

GPIO pinout

Pin Function
GP0 / GP1 UART0 TX/RX to ATGM336H GPS
GP2 1PPS input from GPS
GP3 10 MHz OCXO signal (PWM counter input)
GP4 / GP5 I2C0 SDA/SCL to MCP4725 DAC
GP6–9 Status LEDs (Lock, GPS, WiFi, Power)
GP10–15 SPI1 to ST7789V2 display
GP16–18 Rotary encoder (CW, SW, CCW)
GP28 ADC2 — EFC voltage monitoring

Key components

  • Raspberry Pi Pico 2 W (RP2350)
  • ATGM336H-5N GPS module (1PPS + NMEA)
  • 10 MHz OCXO (user-supplied, e.g. Isotemp OCXO 134)
  • MCP4725 12-bit I²C DAC (0–4.096 V EFC)
  • ST7789V2 1.9" 320×170 IPS TFT

Usage

First boot

  1. Flash the firmware over USB (drag-and-drop the .uf2 from Firmware/build/)
  2. The device starts in AP mode if no WiFi credentials are stored yet
  3. Connect a phone or laptop to TenMeg_Setup
  4. The captive portal opens automatically
  5. Pick a WiFi network, enter the password, save

Menu navigation

  • Rotate in page mode: switches between the nine pages
  • Press in page mode: opens the settings menu
  • Rotate in the menu: scrolls through items
  • Press in the menu: selects an item

Menu items

  1. Brightness — display brightness (0–100%)
  2. Language — EN / NL / DE / FR
  3. UTC offset — time zone for the flip-clock (−12 to +14 hours)
  4. WiFi Setup — start the configuration portal
  5. Close — save all settings and return

Serial mode

  • Default: NMEA passthrough on the USB CDC port (compatible with VisualGPSView, etc.)
  • Debug mode: boot with the encoder button held, or type debug over the CDC link

Flash-persisted settings

Stored automatically:

  • Brightness
  • Language
  • UTC offset
  • WiFi credentials
  • Last visited page (3 s debounce after the last change)
  • Last lock DAC value (every 10 minutes while locked, for fast recovery after reboot)

NTP client examples

# Verify the server is reachable
ntpdate -q <pico_ip>

# Windows Time sync
w32tm /stripchart /computer:<pico_ip>

# Permanent chrony entry
server <pico_ip> iburst

Building

Requires the Raspberry Pi Pico SDK 2.2.0+ and the ARM GCC toolchain 14.2.Rel1.

Before the first build, copy the WiFi credentials template:

cp Firmware/src/wifi_config.h.example Firmware/src/wifi_config.h

Edit Firmware/src/wifi_config.h to fill in any SSID and password. These values are only used as a compile-time fallback; the captive portal stores user-entered credentials in flash and overrides them from the second boot onward. wifi_config.h is git-ignored so it never reaches a public repository.

Then build:

cd Firmware/build
cmake ..
ninja

The output Firmware/build/tenmeg.uf2 can be drag-dropped onto a Pico in BOOTSEL mode.

Flashing without BOOTSEL (VS Code Run button)

For automated picotool flashing on Windows the reset interface needs a WinUSB driver:

  1. Flash once manually via BOOTSEL (drag-drop tenmeg.uf2)
  2. Install ZadigOptions → List All Devices
  3. Select TenMeg GPSDO (Interface 4) (USB id 2E8A:000A MI_04)
  4. Choose WinUSB driver → Install Driver

After that the VS Code Run button works, or use:

picotool reboot -f -u
picotool load build/tenmeg.elf -x

Note: picotool load -fx in a single command is broken on Windows. The VS Code tasks split the operation into reboot -f -u followed by load -x.

Suggested OCXO

Any 10 MHz OCXO with an EFC input (0–5 V) and a TTL output works. Typical choices include:

  • Isotemp OCXO 134-10
  • Morion MV89
  • Vectron MX-060
  • Oscilloquartz BVA 8607

The EFC input is driven from the MCP4725 DAC output (0–4.096 V). A 100 µF electrolytic from the DAC output to GND acts as a noise filter.

About

10MHz digital GPS reference

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors