While I’m waiting for a few parts to come to get going making those Korry switches I mentioned in my previous post, I thought I’ll take a crack at the basics of controlling the aircraft’s spead, heading, altitude and vertical speed using an Arduino and rotary encoders. It was tough at first but then I discovered the magic that makes it all tick.

The inspiration…

I’ll be honest, I’m one of those who hates to be wasting time on re-inventing the wheel when there’s a perfectly good and working solution out there, freely shared with others (one of the reasons I do this website – my way of giving back).

I found a great video on YouTube about making a button box for a car racing game. Of course, this button box can be used for flight simulation just as easily.

Basically, you take an Arduino with an ATmega32u4 microcontroller. The special thing about this particular chip is that it allows the board to behave like any other HID (human interface device), e.g. a keyboard or joystick.

So I grabbed an Arduino micro pro board on Amazon, where I also ordered my rotary encoders and a starter kit with all the wires, resistors, breadboard, etc. in a neat plastic box – great way to keep things tidy.

I put together a single encoder test on a breadboard, following the above YouTube video. Here’s how it looks:

Nothing fancy but it’ll do. As you can see, the rotary encoder has a total of five wires leading to it. The red (connected to RxI pin on the Arduino), blue (connected to GND) and yellow (connected to TxO) handle the encoder signal. The black (connected to pin 15) and white (pin 14 on the Arduino) wires are connected to the encoder’s built-in push button.

Here are files you’ll need to make that Arduino alive:

…and the magic…

Here’s the thing. In order to control anything in a flight sim software, you need some sort of intermediary to handle datarefs in X-Plane or offsets in FSX. I’m building my sim on X-Plane 11 so I’ll be only describing a process that makes it possible for the rotary encoder to change altitude in the Flight Factor A320 airplane in this particular sim.

So… What’s the recipe?

FFA320Connector.

It’s a plugin specifically made for the Flight Factor’s A320 airplane, which –unfortunately– doesn’t expose its datarefs by default. Thankfully, the FFA320Connector takes care of that quite nicely. Installation is pretty straight forward. Download it, unzip it, place the FFA320Connector folder into the X-Plane 11/Aircraft/Flight Factor A320 Ultimate/plugins folder.

After you install that plugin, go to your X-Plane sim, open up the settings and switch to Joystick tab. Click the button you want to assign and you should get something like this:

See the MOKNY section? Yep, that’s the FFA320Connector plugin in action. And that’s the magic that makes it possible to assign buttons to the Flight Factor’s A320 controls.

…put together

All the above combined, I am now able to test it and adjust the altitude values using an external piece of hardware – no mouse input involved.

I’ve mapped the encoder’s push button to ‘FCU Altitude Push’ action. The encoder part itself actually works as two buttons, one to increase the altitude (mapped to ‘Altitude Knob Rotate Right’, the other one to decrease it (mapped to ‘Altitude Knob Rotate Left’).

And here’s the proof it really works:

As you can see I’m changing the altitude using nothing but the tiny rotary encoder sitting on the breadboard.

Handling buttons and rotary encoders with an Arduino is the easy part. Getting an external 7-segment display to show what you have on those displays in the sim is a whole lot different (and more complicated) thing. More on that later…

Until next time!