4. So what's next?
After successfully building a simple switch box and keypad, I’m ready to take on a more ambitious project. My next goal is to create custom flight instruments by reading data from the simulator and displaying it on small LCD screens.
To begin, I dove into the MSFS SDK documentation to explore the available options. The SDK offers a wide range of features, from building custom gauges and creating planes and airports to developing addons and interacting with sim data through the SimConnect SDK.
The SimConnect SDK allows you to connect to an instance of Microsoft Flight Simulator and subscribe to simulator change events. This means you can read real-time data from the simulator, such as airspeed, altitude, heading, pitch, in the form of Simulation Variables or SimVars
. SimConnect SDK comes as a shared C++ DLL library, along with a C# wrapper for easier integration. For convenience, I’ll be using the C# library.
The Plan - Software
- Write a C# WPF "plugin" App that uses the SimConnect SDK to connect to MSFS 2020 and register a list of SimVars to receive an event whenever the values change.
- Maintain a list of all the USB attached instrument devices and send via Serial connection the corresponding data values depending on what instrument they are displaying.
- Receive events via USB Serial connection and send the corresponding event to the Sim, i.e. move heading bug, change autopilot altitude, change altimeter barometric pressure, etc.
- Write an Arduino Sketch in C++ that:
- Can draw on an LCD screen a series of selectable instruments.
- Look into LCD screens that I could use that fit the form factor I have in mind
- Look and mess around with existing graphics libraries
- Receives data via USB Serial connection and redraws the instrument based on the latest data.
- Can send an event via USB Serial connection upon some action, i.e. pressing a button, changing a potentiometer or rotary encoder, etc.1
- Can draw on an LCD screen a series of selectable instruments.
The Plan - Hardware
That covers the software part, but what about hardware? I originally tried to write something for the Arduino UNO R3 since I have a bunch of them around, and at first it was OK, but as I started creating more instruments, especially more advanced ones, I immediately got into some issues:
- Memory Limitations - The Arduino UNO R3 has a total Flash Memory size of 32K, 2K of SDRAM, and the Arduino Leonardo/Micro only has 28k Flash Memory. Will talk later in detail why this is a problem, especially when drawing graphics on an LCD Screen.
- Clock Speed - The Arduino UNO/Leonardo/Micro all have 16MHz of clock speed, so if we require a lot screen updates, will give us a low FPS. Even the newest R4 revision runs at 48MHz, which might not be enough either.
- Cost - The screens that are sold as a shield for mounting on top of an Arduino UNO are quite expensive (~$40). If I want to keep the cost down, I need screens that are cheaper (i.e. I can get some generic ones from Ali Express or Ebay)
Conclusion
I have some homework to do... In the next post I'll talk about how to connect to MSFS with SimConnect SDK and get the SimVar data needed for driving one of the simplest instruments, the Altimeter.