nbpr_gpsd
GPS/GNSS and AIS receiver monitoring daemon (
gpsd), client tools, and libgps.
gpsd packaged for Nerves. Tracks the upstream Buildroot gpsd package — this release wraps 3.27.5.
Licence: BSD-2-Clause.
Usage
Add this package to your Nerves project's mix.exs:
{:nbpr_gpsd, "~> 3.0"}
Run mix deps.get, then mix firmware. The full consumer flow —
including the firmware: alias that pulls binaries ahead of the
firmware build, and supervision-tree wiring for daemon-bearing
packages — lives in the NBPR Getting Started
guide. The fastest
path to a working setup is mix igniter.install nbpr.
Add the daemon to your own supervision tree:
children = [
{NBPR.Gpsd.Gpsd, devices: ["/dev/ttyAMA0"]}
]
Then query it over the JSON protocol on localhost:2947, or shell out
to the client tools:
{json, 0} = System.cmd("gpspipe", ["-w", "-n", "5"])
See NBPR.Gpsd.Gpsd's @moduledoc for the full runtime options schema.
Receiver support
With no build options set you get NMEA0183, u-blox (UBX), MTK3301, NTRIP and RTCM v2/v3 — gpsd compiles those unconditionally. That covers every u-blox module and effectively all generic NMEA receivers, USB pucks included.
Buildroot exposes toggles for 22 further vendor binary protocols
(Trimble TSIP, SiRF, Skytraq, Garmin, AIS/AIVDM, NMEA2000, ...), all
defaulting off. Enable what you need in config/target.exs:
config :nbpr_gpsd, build_opts: [
aivdm: true,
trimble_tsip: true
]
Any non-default build option changes the artefact cache key, so the build falls back from a prebuilt tarball to a source build.
Configuring a u-blox receiver
gpsd's gpsctl handles baud rate, NMEA/UBX mode switching, and version
and configuration dumps:
System.cmd("gpsctl", ["-f", "-s", "115200", "/dev/ttyAMA0"])
ubxtool is not included — upstream ships it as a Python script, so
it would need python3 and pyserial in the firmware, and an nbpr
artefact only carries its own Buildroot files-list so the interpreter
wouldn't come with it. For UBX message-level work, drive the port from
Elixir with Circuits.UART, or use gpsd's JSON protocol.
Client binaries
With clients: true (the default), under /usr/bin/: gpsctl,
gpsdecode, gpspipe, gps2udp, gpsrinex, gpssnmp, gpxlogger,
lcdgps, ntpshmmon and ppscheck. gpsdctl, which adds and removes
devices over the daemon's control socket, installs alongside the daemon in
/usr/sbin/.
The interactive cgps and gpsmon come too. Buildroot builds them when
ncurses is enabled, which every Nerves system in the prebuild matrix already
does — verified against the built system artefacts, all of which carry
libncurses.so.6 in staging, so the clients link the base system's copy.
Companion packages
:nbpr_pps_tools— setpps: truefor gpsd'sHAVE_SYS_TIMEPPS_Htiming paths, which is what makesppscheckreport real pulse timings. Needs aCONFIG_PPSkernel.:nbpr_chrony— discipline the system clock from this receiver via chrony's SHM refclock.
Source: https://github.com/jimsynz/nbpr.