ECLIPTIC Protocols — the seams NMEA telemetry

Protocols · the seams

NMEA telemetry — beacon to tablets

The beacon forwards the phone's own GNSS NMEA verbatim and adds seven synthesized sentence types. Every tablet on the fleet parses the same stream. There is no rate limiting and no change detection, which is what makes the stream self-healing for a tablet that just joined.

Framing

Every synthesized sentence has exactly this shape:

$<BODY>*<CC>\r\n
  • $ start delimiter
  • <BODY> — the comma-separated sentence, starting with the 5-character sentence identifier
  • * checksum delimiter
  • <CC> — two uppercase hex digits, the XOR of every character of <BODY> (i.e. strictly between $ and *)
  • terminator \r\n (0x0D 0x0A)

Encoded US-ASCII on the wire. All numeric formatting is pinned to Locale.US — on a comma-decimal device an unpinned format would emit 12,3 and split the field, taking the whole fleet's telemetry down.

The tablet's parser (NmeaParser) accepts a one or two digit checksum, a deliberate tolerance for third-party receivers that emit a single digit below 0x10. A sentence with no * fails. Dispatch is on the last three characters of the identifier, so $GP / $GN / $GL / $GA / $GB talkers all match the same handler.

Raw GNSS passthrough

The phone's own GNSS NMEA is forwarded verbatim — no filtering by talker or type, no re-checksumming. The only modification is appending \r\n when the OS hands over a message with no trailing newline.

The broadcaster also sniffs passing GGA sentences for fix quality and satellite count to populate $ZBCN, but does not alter them.

While GPS test mode is armed the passthrough is suppressed entirely: no real GNSS sentence is forwarded or sniffed.

What the tablet consumes

SentenceSourceConsumed as
GGARaw GNSSPosition, fix quality, HDOP → accuracy estimate
RMCRaw GNSSPosition, speed, course
GPHDTSynthesizedTrue heading (preferred over course)
ZTLMSynthesizedPitch, roll, speed
ZAUD ZENV ZSHK ZBCN ZODOSynthesizedThe five sensor channels
VTG, HDG and HDM are deliberately rejected

VTG carries GPS course, not compass heading. Android chips emit it every epoch and the beacon forwards raw NMEA verbatim, so treating it as heading would interleave with $GPHDT in a last-writer-wins race and flip-flop a stopped vehicle's heading — and it would keep the heading-freshness clock alive, defeating the dead-compass watchdog. RMC's own course field is the correct course source.

HDG / HDM are magnetic heading; magnetic variation at Black Rock City is roughly 13° east, so applying them as true heading would be silently wrong by that much.

GLL, GSA and GSV are simply not parsed.

Standard sentence field use

Only the fields the tablet actually reads are listed.

GGA — minimum 10 fields

FieldMeaning
2, 3Latitude DDMM.MMMM, hemisphere N/S
4, 5Longitude DDDMM.MMMM, hemisphere E/W
6Fix quality — must be > 0 or the sentence is discarded. Quality 8 = NMEA “Simulation mode”, emitted only by GPS test mode
8HDOP → accuracy estimate as hdop × 5.0 metres

RMC — minimum 9 fields

FieldMeaning
2Status — must be A (valid)
3–6Latitude / hemisphere / longitude / hemisphere
7Speed over ground in knots → × 1.852 for kph
8Course over ground, degrees true, normalised to [0, 360)

Coordinates are DDMM.MMMM: degrees = integer part / 100, minutes = remainder. Minutes outside [0, 60) are rejected, latitude is range-checked to ±90 and longitude to ±180, and the hemisphere letter must be one of the four valid characters. A negative or non-finite speed yields null rather than zero.

$GPHDT — true compass heading

$GPHDT,<heading>,T*CC
FieldTypeRange / format
1Heading, degrees true%.1f, normalised to [0, 360)
2Literal TFixed — true, not magnetic

Example: $GPHDT,123.4,T*31

The only builder that normalises: 365.0 emits 5.0, -90.0 emits 270.0. Emitted every tick (~4 Hz) only when a heading is available — a device with no rotation-vector sensor emits nothing on this channel rather than a fabricated 0.0.

Caveat worth knowing

Heading is derived from the rotation vector and corrected to true north with GeomagneticField, which needs a position. Until the first GPS fix arrives, $GPHDT carries magnetic heading labelled T.

$ZTLM — IMU tilt and speed

$ZTLM,<pitch>,<roll>,<speedKph>*CC
FieldTypeUnitsFormat
1Pitchdegrees, −90…90%.1f
2Rolldegrees, −180…180%.1f
3Ground speedkph%.1f

Example: $ZTLM,-2.5,1.0,8.4*2A

No clamping or normalisation is applied by the builder — the ranges come from the sensor. Speed is the GNSS fix's speed × 3.6, and is 0.0 when there is no fix.

Emitted every tick (~4 Hz) unconditionally, so a device with no rotation-vector sensor broadcasts 0.0 pitch and roll. Unlike $GPHDT and $ZENV, this channel has no absent-sensor suppression.

$ZAUD — microphone level

$ZAUD,<rms>,<peak>,<beat>*CC
FieldTypeRangeFormat
1RMS level0.0–1.0%.3f
2Peak level0.0–1.0%.3f
3Beat flag0 or 1integer

Examples: $ZAUD,0.125,0.800,1*19 · silence $ZAUD,0.000,0.000,0*16

Emitted once per captured audio frame — 1024 samples at 16 kHz ≈ 15.6 Hz. Levels are normalised against 16-bit full scale and clamped to 0–1 upstream of the builder. The beat flag compares frame energy against a decaying running average: the first frame never beats (no baseline), and sustained loudness stops beating as the average catches up.

No audio is recorded or transmitted

The PCM buffer is a reused coroutine-local array reduced to these three scalars in place. Nothing audio-derived is written to storage. The microphone is optional at every layer — without the permission, or on a background / boot start, this channel is simply silent.

Consumed by :app for the passenger oscilloscope, and by zvision's audio_bus for the tracker light's idle sound-reactive show.

$ZENV — ambient light

$ZENV,<lux>*CC
FieldTypeUnitsFormat
1Illuminancelux, raw sensor value%.1f

Example: $ZENV,315.0*02

Emitted every 8th tick (~2 s), only when a reading exists — a device with no light sensor emits nothing rather than 0.0, and the tablet shows -- lx (no sensor).

Drives the tablet's automatic screen dimming: a log-10 interpolation between 5 lux (brightness floor 0.05) and 2000 lux (1.0), applied as a ceiling that the burn-in phase backlight can further reduce but never raise. How that arbitration works →

$ZSHK — shock / impact

$ZSHK,<peakG>*CC
FieldTypeUnitsFormat
1Peak accelerationg (1 g = 9.80665 m/s²), gravity removed%.2f

Example: $ZSHK,2.35*3C

Event-driven, not periodic. A window opens when linear acceleration magnitude reaches 1.5 g, tracks the peak for 120 ms, then reports the peak of the impulse rather than its onset. A 500 ms refractory period starts when the window closes, so a single bump produces one sentence.

Because every datagram is sent twice (multicast + broadcast), the tablet de-duplicates byte-identical $ZSHK lines inside a 200 ms window. Consumers diff a monotonic shockCount rather than watching the value.

$ZBCN — beacon health

$ZBCN,<batteryPct>,<fixQuality>,<satellites>,<uptimeSec>*CC
FieldTypeMeaning
1integerBattery percentage, 0–100 (0 if the battery intent is unavailable)
2integerGNSS fix quality — the GGA field-6 code; 0 = no fix
3integerSatellite count
4integerService uptime in seconds

Example: $ZBCN,87,1,9,3600*17

Emitted every 20th tick (~5 s); the same tick persists the lifetime odometer. Fields 2 and 3 are sniffed from passing GGA sentences. If the most recent GGA is more than 10 s old the beacon reports 0/0 rather than stale values, so a GNSS chip that has gone silent reads as “no fix”; before the first GGA they are 0/0.

The tablet's ops footer flags battery ≤ 20 % and either fixQuality ≤ 0 or satellites < 5 in red.

$ZODO — odometer

$ZODO,<tripMeters>,<totalMeters>*CC
FieldTypeUnitsFormat
1Trip distance since service startmetres%.1f
2Lifetime distancemetres%.1f

Example: $ZODO,1234.5,987654.0*1E

Both fields are metres — the on-screen readouts divide by 1000, the sentence does not. The lifetime total is persisted in the beacon's SharedPreferences and survives restarts. Emitted every 8th tick (~2 s).

Distance is haversine-accumulated with three fail-closed gates, all of which hold the anchor and add zero rather than guessing:

GateRule
AccuracyReported accuracy must be present and ≤ 20 m — applied to the first fix too, so a poor first fix never becomes the anchor
Jitter floorSteps below 5 m are ignored
TeleportAny step implying more than 160 kph is rejected, as are non-positive time deltas

Recovery is automatic: once enough time has elapsed for a step to be plausible, it is accepted again.

Cadence summary

One 250 ms tick loop drives everything periodic, with integer divisors instead of per-channel timers. Tick 0 satisfies every divisor, so all periodic channels fire on the first tick.

ChannelTriggerEffective rate
Raw GNSSOS NMEA callbackWhatever the receiver emits (requested ≥ 1 Hz)
$GPHDTEvery tick, if heading available (the sim heading while GPS test mode is armed)~4 Hz
$GPGGA / $GPRMC (GPS test mode only)Every 4th tick while armed~1 Hz
$ZTLMEvery tick~4 Hz
$ZENVEvery 8th tick, if lux available~0.5 Hz
$ZODOEvery 8th tick~0.5 Hz
$ZBCNEvery 20th tick~0.2 Hz
$ZAUDPer audio frame~15.6 Hz
$ZSHKOn impactEvent-driven

There is no throttling, deduplication or change-detection beyond these divisors. An unchanged value is re-broadcast identically, which is what makes the stream self-healing for a tablet that just joined the network.

GPS test mode

The one sanctioned fabrication, for fleet-wide location testing (GpsSim.kt, SimGpsReceiver.kt). It is armed and disarmed only over adb: the receiver is registered by the running service and guarded by android.permission.DUMP, which the adb shell holds and ordinary apps do not. Every extra is a string, so a malformed number rejects the whole command instead of silently defaulting.

adb shell am broadcast -a org.pureagave.zodiac.beacon.SIM_GPS --es preset MAN
adb shell am broadcast -a org.pureagave.zodiac.beacon.SIM_GPS --es lat 40.78325 --es lon -119.20788 --es hdg 90 --es spd 8
adb shell am broadcast -a org.pureagave.zodiac.beacon.SIM_GPS --es hdg 180 --es spd 8   # turn from the current sim position
adb shell am broadcast -a org.pureagave.zodiac.beacon.SIM_GPS_OFF

Presets are MAN, TEMPLE and HOME; speed is bounded to 0–160 kph. Position is dead-reckoned as a pure function of elapsed time, so it never drifts. While armed:

ChannelBehaviour
Raw GNSSSuppressed: not forwarded, not sniffed into $ZBCN
$GPGGASynthesized every 4th tick (~1 Hz): quality 8, 12 satellites, HDOP 0.8, altitude 1191.0 m (a chosen value, not a measurement)
$GPRMCSynthesized on the same tick with the sim speed and heading
$GPHDTEvery tick, from the sim heading instead of the compass
$ZTLMSpeed field is the sim speed; pitch and roll stay real
$ZBCNReports quality 8 / 12 satellites, so every tablet can see the fix is simulated
$ZODOUnaffected: fed only by real location updates, so it never accumulates simulated metres

The armed state is memory-only: never persisted and cleared on service start and stop, so a reboot always restores real GNSS. The beacon's own screen shows a red ⚠ GPS SIMULATED banner while it is armed.

$ZVER — build version

Not on the beacon's tick loop and not on the telemetry group: every node (the beacon, every tablet and zvision) sends it to 239.7.7.40:10140 every 10 s, so the tablets can show which build each node runs in the log viewer's FLEET tab. A peer unheard for 35 s reads OFFLINE.

$ZVER,<node>,<name>,<base>,<sha>,<dirty>,<epoch>*CC
e.g. $ZVER,9C1977,SM-X810,0.1.0,8f531e18a,0,1691900000*CC
FieldGrammarMeaning
node[A-Z0-9]{1,8}Stable per-node key (from ANDROID_ID on Android, /etc/machine-id on the Jetson)
name[A-Za-z0-9._-]{1,16}Human label: device model or hostname
base[0-9A-Za-z.+~-]{1,16}Version name, e.g. 0.1.0
sha[0-9a-f]{7,40} or unknownBuild commit
dirty[01]1 = modified tree, or unknown
epoch[0-9]{1,10}Commit time, Unix seconds (0 when unknown)

Same framing as the other $Z* sentences: a two-hex XOR checksum over the body; the parser accepts one or two hex digits in either case and never throws. Every unknown fails toward unknown/dirty, so a node that cannot identify its build never reads as current. Three hand-written implementations (FleetVersion.kt, version_protocol.py and the beacon's Nmea.zver, emit only) are pinned together by protocol/version-protocol-golden.json, which all three test suites read.

Converted from
docs/PROTOCOLS.md §2, §6 · ARCHITECTURE.md §5, §7.1