Example 7 segment display - MobiFlight/MobiFlight-Connector GitHub Wiki
In this tutorial you'll connect a 7 segment display module to your Arduino Mega board.
The display module must be based on a Max7219 chip - only these can be controlled by the MobiFlight Connector Software.
The 7 segment displays are configured in such a way that the display the currently set COM1 frequency of your flight simulator. Therefore you use the according FSUIPC offset. The values have to be transformed a little bit - but you'll see this later explained in the tutorial.
First, the electronic connection of the 7 segment display module is explained. Then the configuration of the MobiFlight connector software is shown step by step.
This is what you need for the tutorial
The following things are needed to go through this tutorial:
- Most current version of MobiFlight Connector
- A Arduino Mega 2560 with most current MobiFlight Firmware
- A display module with MAX7219-Chip, e.g. look at eBay for "max7219 tube module" - you gonna find modules for very cheap price.
My module looks like this:
Connection of 7 Segment Display module at Arduino Mega
The connection of the module at the pins of your Arduino Mega board can be as follows:
You can see in the picture that the module requires:
- A power supply via a 5V pin at your Arduino (e.g. on top of pin 22)
- A connection to GND
- Three control lines
- DATA IN (DIN) - Orange, an arbitrary digital pin on your Arduino.
- CHIP SELECT (CS) - Green, an arbitrary digital pin on your Arduino
- CLOCK (CLK) - Grey, an arbitrary digital pin on your Arduino
DO NOT USE PIN D13 for any of the lines as it is known to cause issues with MAX2719s.
The labels DIN, CS and CLK will show up later in the configuration dialog of the MobiFlight Connector. The correct assignment of each of these is fundamental for getting things working as expected.
Configuration of MobiFlight Connector
When you open MobiFlight Connector you'll see an overview of your current configuration. In this example we assume it is empty because nothing has been configured yet.
First you must open the settings dialog, because we want to configure the MobiFlight board. It must know that on some of it's pins the display module is connected.
Let's go there Extras > Einstellungen > MobiFlight Modules-Tab.
You select your module from the tree view on the left side of the tab.
There are different actions available in the toolbar below the tree view. To add a 7 segment display module you click on "New Device" > "Led 7-Segment".
A 7 segment display module has been added to your arduino module configuration.
On the right you define additional settings depending on the type of device that you add.
For a 7 segment display module there are quite some:
- DIN - Pin control line DATA IN - in the tutorial we use pin 22
- CS - Pin for control line CHIP SELECT - in the tutorial we use pin 24
- CLK - Pin for control line CLOCK - in the tutorial we use pin 26
- Num - Number of modules that are daisy chained (up to 8 modules possible)
- Globale Brightness - you can set the intensity of brightness of your led module from low to high
- Name - you can set a name here which is later used in the configuration dialogues. Use a meaningful name here and it will be easier for you later (see later in this tutorial). In the tutorial we use "COM1Display"
There is one step left - we have to upload the new configuration to your board. Therefore click on the upload-button on the very left of the toolbar.
A message will show up that indicates whether the upload has been successful or not. In the positive case, now your MobiFlight will remember that we have a 7 segment display module connected - even if you restart it or power off.
Close the Settings dialog now by clicking on OK-button. You will return to the configuration overview - which still is empty.
Now you create a new configuration for the active frequency COM1 display of your radio stack.
First, you assign a name to the new config entry by double-clicking on an empty row and typing it the name via the keyboard. In the tutorial you assign "COM1 Active".
Clock on the ...-Button at the end of the row.
The Config Wizard dialog shows up.
From the list of the available presets, choose the according one "Radio - COM1 Active Freq"
Click on "use"-Button next to the DropDown-Field.
"Automagically" all settings regarding the FSUIPC offset are filled in correctly. Alternatively you can look up the settings in the FSUIPC Offset documentation
Change to the Display-Tab by clicking on it.
Choose your module from the list in the "display type" section
Choose "Display Module" as type.
The specific display settings automatically show up below.
Choose the correct "COM1Display" from the list. All the other settings have been pre-filled by the preset. You don't have to change anything here.
Let's check if everything works so far - press the "test"-button.
Your 7 segment display module should display the numbers "123.45"
If none of your segments turn on then maybe you have mixed up the wiring. Check each control line again and verify that it is connected to the correct pins. It's easy to confuse order or pin number, believe me!
If your displays work correctly press the Stop-Button.
Close the ConfigWizard-Dialog by clicking the OK-Button.
Start your preferred flight simulator, e.g. FSX or x-plane.
Load and start your preferred flight.
Wait a moment until the connection between the MobiFlight Connector and FSUIPC has been established. This is indicated by a green symbol in the status bar of MobiFlight Connector.
Now run MobiFlight Connector by clicking the start-button from the upper toolbar.
Your 7 segment display module should now display the currently set COM1-value.
Change the value through your simulator. Watch the displays - WOW! incrediblly fast how the values stay in sync, isn't it?
With a few steps and within a couple of minutes you have built your own radio frequency display for your flight simulator. That was really easy! Try out to do the same for the standby frequency and configure a switch to toggle between active and standby.
Tell us on the forum about your progress on your project and check the other tutorials from the tutorials section.