Adding a custom board to MobiFlight
MobiFlight supports adding custom boards (typically a custom PCB with an on-board microcontroller) without having to modify the desktop connector software. By building a custom version of the firmware and adding a .board.json
file for your board you can have MobiFlight detect your board, have different maximum device counts, and control when firmware updates get applied to your board.
This wiki outlines the steps required to do this, using a custom radio PCB built around an RP2040 chip as the example.
In order for MobiFlight to recognize the custom PCB as a specific type of board you need to compile the firmware with a custom value for the MOBIFLIGHT_TYPE
. Add this value within the platformio.ini
file within the environment that corresponds to the microcontroller type into section build_flags =
:
'-DMOBIFLIGHT_TYPE="Custom Radio"'
Optionally you can modify the MOBIFLIGHT_NAME
, which specifies the default name for the board when it is initially detected by MobiFlight. It is done in the same way as MOBIFLIGHT_TYPE
by adding MOBIFLIGHT_NAME
in the same section of the platformio.ini
file:
'-DMOBIFLIGHT_NAME="Custom Radio"'
If both are added, it should look like:
build_flags =
${env.build_flags}
'-DMOBIFLIGHT_TYPE="Custom Radio"'
'-DMOBIFLIGHT_NAME="Custom Radio"'
-I./_Boards/Atmel/Board_Mega
In addition the #define values for the various input/output types can be modified within the MFBoards.h
file which belongs to your type of board, e.g. to increase the number of available buttons or LCD displays.
If you want to disable a complete device to reduce the memory consumption, you have to add an additional #define in the platformio.ini
file. For e.g. disabling the stepper support you have to add -DMF_STEPPER_SUPPORT=0
. Your section build_flags
will then look like:
build_flags =
${env.build_flags}
'-DMOBIFLIGHT_TYPE="Custom Radio"'
'-DMOBIFLIGHT_NAME="Custom Radio"'
-DMF_STEPPER_SUPPORT=0
-I./_Boards/Atmel/Board_Mega
If you are manually building the firmware locally for distribution you should force the version number of the firmware to something other than the default by modifying the get_version.py
file to specify an explicit version number. The version number should be at least 2.4.2
so MobiFlight knows the firmware supports regenerating serial numbers, setting the board name, TM1637 displays, and custom devices.
MobiFlight uses .board.json
files located in the Boards
folder to know what types of boards are supported and how to detect them. Custom PCBs should create a new .board.json
file with the settings necessary for the custom board.
Since the board in this example is based on an RP2040 chip, create a copy of the raspberrypi_pico.board.json
file and call it custom_radio.board.json
. Then edit the file and change the MobiFlightType
entry to match the value specified in the firmware:
"MobiFlightType": "Custom Radio",
You can also modify the ModuleLimits
values to match whatever increased device limits were compiled into the firmware.
Don't forget to change the LatestFirmwareVersion
to match the version number set in step 1.
To test this all works put a copy of your custom board.json
file in the Boards
folder of the connector on the desktop. Put the firmware in the firmware
folder. Connect your custom PCB then run MobiFlight.
If there is no custom firmware on the custom board yet MobiFlight should report an ambiguous device connected. Then, in the modules dialog, you should be able to right click on the board and select Update firmware
which will display Custom Radio
as one of the options.
If the board already has the firmware installed on it MobiFlight should detect it and automatically show it as a Custom Radio
board in the modules dialog.
Boards without MobiFlight firmware installed are detected based on the VID/PID of the board. The list of valid VID/PIDs used to identify your board are defined in the .board.json
file and can be modified by editing the HardwareIDs
property in the file. Since all boards that use the same microcontroller will have the same VID/PID this means your custom PCB will be detected as an ambiguous device the first time it is used with MobiFlight.
To avoid this and give your users the best initial experience it is best practice to ship your boards with your custom firmware pre-installed. Boards that have MobiFlight firmware already installed are detected using the MobiFlight Type
value instead of the VID/PID. With the custom firmware pre-installed and the correct .board.json
file added to the Boards
folder, MobiFlight will automatically know your board is custom and will use the custom values from the board file when connected.
- MobiFlight Connector Installation
- Mobiflight Connector BETA version installation
- Modules
- MobiFlight Connector Files Structure
- MobiFlight Connector Uninstall
- Modules Reset to factory default
- Verifying the WASM module installation and locating the MSFS2020 community folder
- Providing logs from MobiFlight
- MobiFlight Connector How does it work
- Mobiflight Connector Main Window
- Flash module with MobiFlight firmware
- Input and Output devices
- Joysticks
- Midi Boards
- Sim Variables (for Output)
- Input Actions
- Merging configuration files
- Disabling specific COM ports
- Examples Output LEDs
- Examples Input Switch
- Example 7 segment display
- Example Servo motor
- Controlling LEDs with an output shift register
- Adding lots of buttons with an input shift register
- Beginner's guide to input multiplexers
- Key Matrix with standard MobiFlight and Multiplexers
- Tutorial Easy Driver and x.27 or x.40 Stepper Motor
- Tutorial for Airbus VS display via 7-Segment LED Module
- Example Analog Input Potentiometer
- Baron G58 Tutorial Gear, Flaps, Mags, ELT Input Output Programming
- Using Mobiflight to control arduino-based 3rd party panels (RealSimGear GNS530)
- How to use a VNH2SP30 DC motor shield with MobiFlight
- Using 3D printer mainboards
- Playing sounds by sending keystrokes to AutoHotKey
- Using the selector knob on a Honeycomb Bravo
- Using an adjustable 12 position switch as a GA starter
- Brightness of LCD displays with I2C
- Using three-position switches
- Transponder with one Rotary
- MSFS2020 RPN Tips and Tricks
- MSFS2020 Using the Custom Input Code Box
- MSFS2020 Install WASM module and Event List
- MSFS2020 How to Create and Use User Defined Lvars
- MSFS2020 How to Create a Blinking LED configuration
- MSFS2020 User Defined WASM Module Events Best Practices
- MSFS2020 Developer Mode, Model Behavior dialog and Console window
- MSFS2020 PMDG 737‐700 List of Events that require use of FSUIPC7
- MSFS2020 PMDG 737‐700 Calibrate throttle idle and reverse thrust using interpolation (Valkyrie)
- MSFS2020 PMDG 737-700 Chrono unit functions implemented in Mobiflight
- Configuring PMDG 737 Parking Brake Lever Auto-Release with a Servo in Mobiflight
- Using encoder to drive a value back and forth within a given range