Skip to content
Resources

Panel 6 of 6, Citation Longitude, G5000 avionics

Radio panel

A hardware COM / NAV / ADF tuning head for Microsoft Flight Simulator 2024: one Arduino GIGA R1 WiFi driving real displays, encoders and annunciators, speaking natively to SPAD.neXt over the network. No USB. No bridge board. No compromises.

Board
Arduino GIGA R1 WiFi
Link
SSE / REST over WiFi
Middleware
SPAD.neXt
Sim
MSFS 2024
Build
GIGA-V6

COM / NAV

ACTIVE

STANDBY

COM1COM2

RECEIVE / TRANSMIT

COM / NAV SELECT

MAX7219 seven-segment displays, driven live from SPAD subscriptions. Try the select keys and the swap. On the real panel, holding the swap key for 3 s soft-resets the board.

Signal path

From knob to cockpit and back

Every turn of an encoder becomes an HTTP POST. Every change in the simulated aircraft streams back as a Server-Sent Event. The round trip runs continuously, over WiFi, with no computer-side driver of any kind.

ARDUINO GIGA R1

  • encoders, buttons, MAX7219
  • NeoPixels, Murata WiFi
HTTP POSTSSE STREAM

SPAD.NEXT

  • Serial API on port 28001
  • events, bindings, data
EVENTSSIMVARS

MSFS 2024

  • Citation Longitude
  • G5000, SimConnect

▶ panel → sim (tuning, swaps, TX select); ◀ sim → panel (frequencies, masters, RX state)

Outbound: the panel speaks

Button presses and committed frequencies are URL-encoded and POSTed to /json/reply/SerialEvent. Eight pushbuttons report on channel 8 as 8,<index>,1/0; five frequency axes (indices 40–44) carry absolute raw values inside declared AXIS_MIN…MAX ranges.

SPAD.neXt raises each input as a bindable event and executes whatever the profile attaches: NAV1_STBY_SET_HZ, COM1_RADIO_SWAP, a local variable, anything.

Inbound: the sim answers

One long-lived Server-Sent Events stream from /event-stream delivers every subscribed SimVar the moment it changes: seventeen subscriptions covering all six frequencies, both masters, COM spacing modes and COM2 receive state.

A 25-second silence watchdog guards the stream. The GIGA's mbed socket can report "connected" on a dead link, so silence itself is treated as disconnection and triggers a clean session restart. The panel heals itself; no reset button required.

On the wire

One handshake, spoken once

The registration dialogue below runs at every connection. The single most hard-won line of the entire build is the discipline of answering 0,INIT exactly once. The story is told under lessons learned.

Registration on every connection
  1. RX ◂0,INIT,2,0.9.24.26,0;// SPAD: who are you?
  2. TX ▸0,SPAD,{GUID},Radio Panel,2,1.0,AUTHOR=…,PID=RADIO,ALLOWLOCAL=2;
  3. RX ◂0,INIT,2,0.9.24.26,0;// SPAD asks again. Stay silent. Once means once.
  4. RX ◂0,CONFIG;// registration accepted, declare everything
  5. TX ▸0,OPTION,ISGENERIC=1,PAGESUPPORT=0,CMD_COOLDOWN=50,…;
  6. TX ▸0,INPUT,1,COM1SEL,PUSHBUTTON,SPAD_PUSHBUTTON;// …×8 buttons
  7. TX ▸0,INPUT,40,COM1_STBY_SET,AXIS,SPAD_AXIS,AXIS_MIN=118000,AXIS_MAX=137000;// …×5 axes
  8. TX ▸1,SUBSCRIBE,20,SIMCONNECT:COM ACTIVE FREQUENCY:1,MHz,0.001;// …×17 subs
  9. TX ▸0,CONFIG;// done
  10. RX ◂2,START;// === SPAD READY === live data follows
  11. RX ◂5,20,130.6;// COM1 active, displays light up
InputIdxType and range
COM1SEL … ADFSEL1–5Pushbutton: selects the radio the encoders act on
ACTSBY6Pushbutton: active ⇄ standby swap (hold 3 s = soft reset)
TX_COM1 / TX_COM27–8Pushbutton: transmit radio select
COM1/2_STBY_SET40–41Axis: 118 000 – 137 000 kHz
NAV1/2_STBY_SET42–43Axis: 108 000 – 118 000 kHz
ADF_STBY_SET44Axis: 0 – 2 000 000 000 (BCD word)
Declared inputs (channel 8).
SubscriptionChSimVar
COM 1/2 active + standby20–23COM … FREQUENCY:1/2 (MHz)
NAV 1/2 active + standby24–27NAV … FREQUENCY:1/2 (MHz)
ADF active + standby28–29ADF … FREQUENCY:1 (kHz 0.1)
Electrical / avionics30–31MASTER … (Bool)
COM spacing 1/232–33COM SPACING MODE (25 ⇄ 8.33 kHz)
COM2 receive34COM RECEIVE EX1:2 → yellow RX LED
SimVar subscriptions (updates arrive on channel 5).

Cracked by capture

The ADF half-kilohertz word

The Longitude's ADF_STBY_SET event doesn't take a frequency. It takes a packed 32-bit BCD word. The whole-kHz layout was captured first from SPAD's event monitor; the half-kHz nibble was confirmed the same way with a single data point: setting 1200.5 kHz in the G5000 fired parameter 302 010 368.

1BCD ×1000
2BCD ×100
0BCD ×10
0BCD ×1 kHz
5TENTHS
0UNUSED
0UNUSED
0UNUSED

0x12005000 = 1200.5 kHz, value = (BCD(wholeKHz) « 16) | (tenths « 12)

Stepping like the real G5000

The ADF fine knob steps in true 0.5 kHz detents (0.0, 0.5 … 9.5 with clean wraparound), matching what MSFS's own avionics do. The coarse knob moves 10 kHz.

COM knobs are spacing-aware: 8.33 kHz mode steps by 0.005 with three decimals shown; 25 kHz mode steps by 0.025 and blanks the last digit for an authentic two-decimal readout. Switching modes in the sim redraws both displays instantly.

Commit on settle

Rotary motion updates the local display immediately for zero-lag feel; the value is committed to the sim as a single axis event after 600 ms of knob silence: one clean 8,44,302010368; instead of a stream of half-turned frequencies.

Under the panel

One board where two used to live

The original build paired an Arduino Mega with an ESP32 bridge over a serial link: two boot sequences, two power domains, and a cold-start race that produced ghost failures for weeks. The GIGA R1's native Murata radio collapses all of it into a single board and a single truth.

FunctionPins
COM1 / COM2 TX annunciators3, 4
Display bus 1 (active): DIN, CS, CLK5, 6, 7
Display bus 2 (standby): DIN, CS, CLK8, 9, 11
TX select COM1 / COM215, 14
NeoPixel data17
COM2 receive LED (yellow)21
ACTSBY and radio selects22 – 27
Rotary encoders ×228 – 31
Arduino GIGA R1 WiFi pin map.

Lessons learned

Five bugs worth remembering

  1. 01

    The duplicate registration

    Answer INIT once. Only once.

    SPAD sends 0,INIT twice per connection. The old Mega + bridge answered every one. That was harmless there, because the slow serial hop interleaved replies with SPAD's retries. The GIGA answered instantly, and SPAD received two registrations back-to-back. Result: every input flagged ⚠ unknown event, bindings raised but never executed. It was immune to new GUIDs, instance IDs and every other exorcism attempted.

    Reply to the first INIT of a session and stay silent on the rest, exactly like every panel that already worked.

  2. 02

    The black panel

    A SimVar that lies

    Displays were gated on both masters being ON. But the Longitude reports ELECTRICAL MASTER BATTERY as 0 even on a fully powered aircraft. And since SPAD only pushes values that change, a panel connecting to an already-running sim waited forever for an update that would never come. Weeks of power-supply theories died here.

    Gate on avionics master alone; the battery SimVar is bypassed until a proper B:LNG var replaces it.

  3. 03

    The half-open socket

    Silence is a disconnect

    Restart SPAD and the GIGA's mbed socket keeps reporting connected() on a link that is stone dead. The panel waited politely on a corpse. And reconnecting too fast hit SPAD's ~30 s session hold: "Conflict: Busy. Try again later."

    25 s data-silence watchdog + explicit /event-unregister + triple-INIT detection. The panel now survives SPAD restarts entirely on its own.

  4. 04

    The flushed socket

    mbed closes faster than it sends

    The Uno R4 pattern of print → delay(50) → stop() silently truncated POSTs on the GIGA. The socket tore down before the bytes left the antenna. SPAD saw a device that connected and said nothing: bare GUID, "no response from device."

    Wait for the server's response before closing. Every send, every time.

  5. 05

    The captured parameter

    When docs run out, let the sim tell you

    No document describes the Longitude's fractional-ADF word. One captured event-monitor value (set 1200.5 in the cockpit, read 302010368) decoded the entire format in a minute. The same trick previously cracked whole-kHz BCD and NAV axis scaling.

    Set a known value in the aircraft, capture what fires, reverse the math. Two data points beat any theory.

Panel 6: Radio (COM / NAV / ADF)

Arduino GIGA R1 WiFi, SPAD.neXt Serial API over SSE/REST, Microsoft Flight Simulator 2024, Cessna Citation Longitude with G5000 avionics.

Canonical firmware: RadioPanelWifi_GIGA_V2.ino, build GIGA-V6. Includes reply-once INIT, silence watchdog, session auto-recovery, 0.5 kHz ADF, spacing-aware COM stepping and ACTSBY long-press soft reset.