Workflow for Creating Flight Simulation Panels ‐ Part 2 - MobiFlight/MobiFlight-Connector GitHub Wiki
Version 1.0 25 Nov 2024
Overview
In Part 1 we created the faceplate for an avionics panel for a specific aircraft: the Data Control Panel (DCP) for the HotStart Challenger 650. In Part 2, I will describe how I take that initial part of the project and extend it into creation of the printed circuit board (PCB) that will provide the functionality needed.
This is definitely not going to be a tutorial on how to use KiCAD, the eCAD tool I use for circuit design and PCB layout. That's far outside the scope of this wiki. I'm assuming you're already familiar with KiCAD or some other eCAD tool (nothing in my workflow relies upon an specific KiCAD functionality).
Even if you're not planning to build your own PCB you might want to read through the workflow anyway as there will be several "sidebar" discussions about general panel construction considerations that will be largely applicable to point-to-point wiring approaches.
I also should emphasize right up front that I am absolutely not an "electronics" guy. I have no formal education or training in electronics design and I didn't know anything about PCB design or fabrication when I started my cockpit build project -- I learned as I went thanks to many excellent YouTube tutorials. I'm also very fortunate to have co-workers at my "day job" who are electronics engineers that I could go to when I needed a little additional help, and, of course, got lots and lots of help and advice from our fellow MobiFlight Discorders who've been down this road already.
Basic Workflow (the TL;DR version)
This sort-of picks up at Step 8 from Part 1.
- If you haven't done so already, decide what parts you're going to use for your controls (switches, pushbuttons, encoders, etc.)
- Decide on which of the MobiFlight-supported microcontrollers you're going to use
- Decide how your panel is going to be assembled (PCB, microcontroller, controls, enclosure, mounting hardware, etc.)
- Jump into your CAD tool and open up your panel design file
- If you're going to use an enclosure, add a sketch to show where it will fit vs. the faceplate.
- Add a sketch to show the maximum size the PCB can be to fit into your panel and/or enclosure.
- Add a sketch to show locations of any mounting holes you think you'll need
- Optionally, amend your 'cutouts' sketch to exactly indicate center points for controls
- Export all of the sketches above to DXF files with appropriate names
- Locate your 'panel cut' files you exported at the end of Part 1
- Open up your eCAD tool, enter "PCB layout" and import all the various DXF files as separate user layers (you don't need the sketch for the housing if you're using one; it's not relevant to the PCB layout)
- Use the "maximum extents" sketch as the basis for your 'Edge Cuts' layer
- Turn on whichever layer(s) make the most sense for locating where physical controls need to go
- Save the PCB design
- Jump over to the Schematic design tool and add symbols for your controls and microcontroller "wire them up" in the schematic.
- Verify that you have footprints assigned for all the symbols in your schematic
- Save the schematic, jump back into the PCB design tool, and import the schematic and associated footprints
- Using your 'maximum PCB extents' sketch layer as a guide, define the edge cuts for the PCB
- Using your 'cutouts' layer as a guide, place the footprints on the PCB
- Using your 'mounting holes' layer, place the mounting holes on the PCB
- Defer routing traces until the next steps are complete
- Save the PCB design and export it as a STEP file
- Import the PCB STEP file into your CAD tool and check the fit against your faceplate
- Iterate between the PCB layout tool, exporting it as a STEP file, and checking the fit against your faceplate until it's the way you want it.
- Return to the PCB layout tool and route traces.
- Run DRC (design rules check) against your completed layout and fix anything it complains about
- Export the PCB layout as a set of Gerbers and Drill files to send to the PCB fabrication house
- If you're going to also have them do assembly, export the bill of material (BOM) and 'Positions' files.
This will be elaborated in gory detail below.
Planning Overview
Before starting any part of this second set of activities, we need to make a bunch of decisions and do some planning.
- If you haven't already decided, now is the time to make a decision between doing point-to-point wiring for your panel vs. creating a panel-specific PCB. This tutorial assumes you're doing a PCB but at least read the rest of this section if you're doing point-to-point.
- What physical controls do we need for the panel? What specific parts are we going to choose for those controls? It was fine earlier to say to ourselves "eh, we need some pushbuttons and a couple of encoders" -- but now we've got to get specific; now we have to choose an actual part that we'll buy from Digikey, or Mouser, or AliExpress (or wherever).
- Do any of the components I'll be putting onto the PCB require power? How will I supply that?
- How are all the parts of the panel going to be assembled together? How am I going to turn the PCB, the faceplate, the housing (if I decided I want one) and the microcontroller into a single, rigid package that I'll be able to assemble into my cockpit?
- What hardware will I need to assemble it together? Screws and nuts? What size? Brackets? What size?
- What other parts am I going to need? Does the panel have buttons? Knobs? Will I need spacers or standoffs? What's the plan for fabricating those parts?
- Do I want to backlight the panel and/or buttons? How will I do that? How will I supply power for the backlighting?
- How will I get markings on the panel and/or buttons?
At the moment this probably seems overwhelming -- but that's mostly because this is our very first panel. We'll take this step by step and get through this first panel. Every panel after this will get easier and easier and the workflow will become familiar and comfortable.
Detailed Planning Discussion
I'm going to use our "Display Control Panel" (DCP) as the basis for building our detailed plan, but the thought-process here should be applicable to any panel.
Physical Controls
The DCP requires ten pushbuttons and two dual-concentric encoders. We know that from the picture of the panel, but that's not enough information yet. Presumably you've flown the airplane in your simulator so you know the rest of the info we need. Are the pushbuttons momentary or latching style switches? Is it important to know how many pulse-per-revolution the encoders are? Do the encoders also have a pushbutton built in?
For the DCP:
- The buttons are all momentary switches (See the sidebar below for discussion of pushbutton switches)
- The encoders will be fine with anything from about 12-24 PPR (pulses-per-revolution). (See the sidebar below for a short discussion of rotary encoders)
- Yes, the encoders need a built-in pushbutton.
Sidebar: Pushbutton Switches
There are two basic flavors of push buttons: momentary contact (or just "momentary") and latching. An example of a momentary switch is a key on your keyboard -- it's spring-loaded switch that's off until you push it down to it's 'on' position. When you release it, it returns to the off position. A latching switch is also a spring-loaded switch, but one that stays in the 'on' position until you push it again, at which point the spring returns it to the 'off' position. A power button on a device is a typical example of a latching switch. From here, though it gets really messy. Seems like there should be nothing particularly complicated about a basic switch, right? I mean, it's just on or off, right? Well -- yes? --but if I go looking for pushbutton switches at Digikey or one of the other big electronics distributors and search for 'pushbutton switch', I see something like:
Um...Eighty THOUSAND pushbutton switch parts? Choosing a specific switch can be pretty challenging. The electronic distributors search engines help a lot with narrowing things down. They allow you specify what are called 'form, fit, and function' criteria to rapidly narrow down to a part that will meet your specific needs. To keep things simple, were going to usually be looking for SPST NO switches (single pole/single throw, normally open) for both momentary and latching switches. Other criteria we need includes whether we want a 'tactile' switch (one that has a distinct 'click' sound and feel when it's pushed or one that's silent, and whether or not we want the switch to have a built in LED to allow us to easily backlight the button.
Sidebar: Rotary Encoders
A rotary encoder is a device that sends a pulse to the microcontroller each time you turn it a little bit. The design of the encoders enables the microcontroller to determine whether the encoder is being turned to the left or to the right. How much a "little bit" is is determined by the encoder part itself. The "pulse-per-revolution" (PPR) value tells us how many pulses will be generated once the encoder shaft has turned one complete revolution. So, a 12PPR encoder will send one pulse every 30 degrees of turn (360 degrees / 12 ). A 24PPR encoder will send one pulse every 15 degrees of turn -- and so forth. For our purposes, a single "pulse" is equivalent to a single button press -- that's pretty much how MobiFlight is going to interpret a 'click' of turn. The rotary encoder device in MF has on 'On Right' and 'On Left' event that will be triggered when the encoder shaft is turned one 'click' to the right or left. (And an important note: encoders do not inherently need to "click" when you turn them. Most of them do produce a "click" feel because they have detents (little notches) that you can feel as you turn them. Usually, the number of detents matches the PPR value -- but it doesn't HAVE to match; there are encoders with twice as many detents as their PPR value. These generate one pulse for every two "clicks" as you're turning the knob. This is just something to watch for when you're picking a specific encoder part).
How do you choose an appropriate PPR value? Often, it doesn't really matter. The one sometimes-useful guide is to consider whether the function you're controlling in the airplane needs fine or coarse adjustments as you turn the knob. The lower the PPR, the more fine control you have. There are some functions that need both fine and coarse control. When you change the aircraft heading, for example, you want the heading value to change rapidly until you're close the heading you want, then you want to be able to make fine adjustments. That seems like two irreconcilable requirements but actually gets solved by a feature either in the aircraft simulator software or in MobiFlight itself called 'acceleration'. I won't get into detail about that but it's a feature that senses when you're turning the knob quickly and makes the encoder act like it had a very high PPR value, but uses the native PPR value when you turn the knob more slowly.
How Will the PCB be Assembled?
One last (and very important) consideration as we choose parts: who is going to assemble the PCB? When we send the PCB to a fabrication house, we can choose to have them simply fabricate a set of boards (usually you have to get a minimum of 5 boards made) and send those back to us for us to assemble ourselves, or we can choose to have them assemble all (or some) of the parts onto the boards for us.
We need to understand here that there are two broad types of components -- through-hole and surface mount. Through-hole components have leads that -- yes -- go through copper-plated holes in the PCB and are soldered on the opposite side of the board. A surface-mount component doesn't need holes. Instead, it's soldered to copper pads on the same side of the PCB as it's mounted on. Surface mount devices are designed to make automated assembly very efficient, but can be beyond the skills of hobbyists to assemble to a bare PCB. On the other hand, through-hole components are quite labor-intensive to assemble. If we want the fab house to do the assembly we're going to want to choose surface-mount parts -- that makes the labor almost free. If we want to keep the fabrication costs as low as possible, we should choose through-hole components and plan to do the assembly ourselves. Note that if you have the fab house do the assembly you also have to buy your parts from them (ok, this isn't absolutely true, but doing parts consignment to a fab house is beyond the scope of this discussion). The good news is that their parts costs is likely as low as you'll find them almost anywhere. It's also possible (and common) to have a combination of surface-mount and through-hole components on your PCB. You let the fab house assemble the SMT (surface-mount technology) devices and you assemble the through-hole devices once you receive the partially-assembled boards. I follow this last approach with pretty much all my PCBs.
Rotary encoders are a good example of a component that you'll almost always choose as a through-hole component. Backlighting LEDs are something you almost always choose as an SMT component and let the fab house assemble for you. Pushbuttons can go either way; you can find a through-hole and SMT version of almost any switch. There will be other components on the boards as well -- we'll need current-limiting resistors for the backlight LEDs, for example, and a connector to supply power to for the backlighting. We'll need some way to connect all the buttons and encoders to the microcontroller. We'll discuss the tradeoffs between SMT and through-hole assembly for each of these topics as we go.