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
RECEIVE / TRANSMIT
COM / NAV SELECT
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
SPAD.NEXT
- Serial API on port 28001
- events, bindings, data
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.
- RX ◂0,INIT,2,0.9.24.26,0;// SPAD: who are you?
- TX ▸0,SPAD,{GUID},Radio Panel,2,1.0,AUTHOR=…,PID=RADIO,ALLOWLOCAL=2;
- RX ◂0,INIT,2,0.9.24.26,0;// SPAD asks again. Stay silent. Once means once.
- RX ◂0,CONFIG;// registration accepted, declare everything
- TX ▸0,OPTION,ISGENERIC=1,PAGESUPPORT=0,CMD_COOLDOWN=50,…;
- TX ▸0,INPUT,1,COM1SEL,PUSHBUTTON,SPAD_PUSHBUTTON;// …×8 buttons
- TX ▸0,INPUT,40,COM1_STBY_SET,AXIS,SPAD_AXIS,AXIS_MIN=118000,AXIS_MAX=137000;// …×5 axes
- TX ▸1,SUBSCRIBE,20,SIMCONNECT:COM ACTIVE FREQUENCY:1,MHz,0.001;// …×17 subs
- TX ▸0,CONFIG;// done
- RX ◂2,START;// === SPAD READY === live data follows
- RX ◂5,20,130.6;// COM1 active, displays light up
| Input | Idx | Type and range |
|---|---|---|
| COM1SEL … ADFSEL | 1–5 | Pushbutton: selects the radio the encoders act on |
| ACTSBY | 6 | Pushbutton: active ⇄ standby swap (hold 3 s = soft reset) |
| TX_COM1 / TX_COM2 | 7–8 | Pushbutton: transmit radio select |
| COM1/2_STBY_SET | 40–41 | Axis: 118 000 – 137 000 kHz |
| NAV1/2_STBY_SET | 42–43 | Axis: 108 000 – 118 000 kHz |
| ADF_STBY_SET | 44 | Axis: 0 – 2 000 000 000 (BCD word) |
| Subscription | Ch | SimVar |
|---|---|---|
| COM 1/2 active + standby | 20–23 | COM … FREQUENCY:1/2 (MHz) |
| NAV 1/2 active + standby | 24–27 | NAV … FREQUENCY:1/2 (MHz) |
| ADF active + standby | 28–29 | ADF … FREQUENCY:1 (kHz 0.1) |
| Electrical / avionics | 30–31 | MASTER … (Bool) |
| COM spacing 1/2 | 32–33 | COM SPACING MODE (25 ⇄ 8.33 kHz) |
| COM2 receive | 34 | COM RECEIVE EX1:2 → yellow RX LED |
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.
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.
| Function | Pins |
|---|---|
| COM1 / COM2 TX annunciators | 3, 4 |
| Display bus 1 (active): DIN, CS, CLK | 5, 6, 7 |
| Display bus 2 (standby): DIN, CS, CLK | 8, 9, 11 |
| TX select COM1 / COM2 | 15, 14 |
| NeoPixel data | 17 |
| COM2 receive LED (yellow) | 21 |
| ACTSBY and radio selects | 22 – 27 |
| Rotary encoders ×2 | 28 – 31 |
Lessons learned
Five bugs worth remembering
01
The duplicate registration
Answer INIT once. Only once.
SPAD sends
0,INITtwice 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.
02
The black panel
A SimVar that lies
Displays were gated on both masters being ON. But the Longitude reports
ELECTRICAL MASTER BATTERYas 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.
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.
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.
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.