A bidirectional bridge between X-Plane flight simulator and Arduino hardware for building a physical cockpit panel for the BAe 146 aircraft.
- X-Plane to Arduino: Syncs simulator datarefs to physical displays and LEDs
- Arduino to X-Plane: Sends physical switch/button inputs back to the simulator
- Real-time WebSocket communication with X-Plane's API
- Support for momentary buttons, toggle switches, and rotary encoders
- 7-segment LED displays for frequencies, course, and altitude
- Status LEDs for autopilot modes
- Arduino (Mega recommended for pin count)
- MAX7219 LED display drivers (for 7-segment displays)
- Momentary push buttons
- Toggle switches
- Rotary encoders
- LEDs for status indicators
pip install websockets requests pyserial- LedControl library
- ArduinoJson library
- Start X-Plane with the web server enabled (default port 8086)
- Connect your Arduino
- Run the Python bridge:
python xplane.pyThe script will auto-detect the Arduino and connect to X-Plane.
Edit xplane.py to customize switch and dataref mappings:
# Momentary buttons
bridge.add_momentary_switch("nav_swap", "sim/radios/nav1_standy_flip")
# Toggle switches
bridge.add_toggle_switch_dataref("fd_bars", "thranda/autopilot/FD_Show_Pilot")
# Rotary encoders
bridge.add_rotary_encoder_commands("nav1_encoder", "thranda/knob/RheostatUp09", "thranda/knob/RheostatDn09")
# LED indicators
bridge.add_boolean_dataref("sim/cockpit2/autopilot/heading_mode", "hdg").
├── xplane.py # Python bridge application
└── arduino/
└── bae146/
└── bae146.ino # Arduino firmware
MIT