I had difficulty using the mouse to turn all those panel knobs in-flight with the aircraft bouncing around. So I figured if racing sim fans can build a “button box”, flight sim fans can build a “knob box”. The parts cost around $100. I already had the tools.
Parts list (all can be found on Amazon):
- Arduino 2560 compatible board
- USB 2.0 printer cable to connect Arduino to PC
- Mini breadboard to connect ground and power wires
- Rotary encoders (mountable) with push-button action and knobs for Arduino. I used the ones attached to breakout boards.
- Mini toggle switches (SPST) (mountable) with pre-soldered wires
- Mini push-button switches (mountable) with pre-soldered wires
- 3mm green LEDs with pre-soldered wires
- 3mm LED bezels
- Clear sticker paper
- Box enclosure
Tools:
- Wiring: Dupont crimping tool, male/female connectors, and ribbon wires
- Soldering iron, wire, helping hand
- Hot glue gun
- Drill, metric bits
The panel was designed (drill holes, cut-outs, text labels, graphics, etc.) using the free Front Panel Designer software from frontpanelexpress.com. The site offers professional fabrication services for a good price, but I went the DIY route and printed the design on a transparent sticker film and stickered it to the aluminum box.
I drilled a bunch of holes in the box lid using the printout as a guide, mounted the hardware, and wired them to the Arduino board.
The board was programmed using the incredible no-code software from mobiflight.com.
And that’s it. The best thing about this project is that I found a great new hobby – electronics! Those Arduino boards are too much fun!
This was my first attempt at an electronics project. Here are some lessons learned:
- I was sloppy with the drill holes. Be sure to use a center punch to keep the drill bit from wandering off.
- Be sure to watch the Arduino tutorials to see how to wire up the switches and LEDs. The pre-wired switches and LEDs come with all the capacitors/resistors needed; you only need to wire them to the Arduino.
- The mini breadboard came in handy to connect all the ground and power wires.
- I used Fritzing software to keep track of where all the wiring was going. There is a ton of wires.
- Be sure to watch a few videos on how to use the crimping tool with the Dupont connectors. It’s not intuitive.
- I suck at soldering. It takes practice.
- For future projects, I’m going the printed circuit board route. It eliminates the rats nest of wires.
- So far, I haven’t found a way to map the LNAV, VNAV, and FLCH autopilot buttons.
15 Likes
@Case4Venus Looks really good, I’m rubbish at all these project ideas, I can only look on in awe. I went with the class-echo add on which has an encoder on it and uses an Arduino as well, there does seem to be so many projects you can build with those little boards, and I take my hat off to all those with the brainpower to understand them.
Very nice and yes, that’s a lot of wires. Here is mine so far, decided to do touch screen to eliminate some of the wiring. Have a new Arduino coming today and am eager to try Mobiflight.
1 Like
Really cool. What software are you using to display and assign buttons on your touchscreen? -Chris
Looks great.
I recently built myself a multi purpose FCU style button box with a mix of rotary encoders, potentiometers, toggle switches etc and while it’s fantastic in DCS and my racing games I find the control inputs in MSFS to be somewhat lacking, perhaps in part due to the lack of per-aircraft controls such as you can do in DCS but there just seem to be a lack of options in general.
Some annoyances I have specifically in MSFS for example - the heading bug moves in 5 degree increments, I can’t seemingly set my potentiometers to dim displays or interior lights, if I change Baro in inHg it works fine but if I switch over to the sane system of hPa it takes several clicks of the encoder to move up 1hpa as behind the display it seems it’s still changing decimal points of inHg for each click (of which there are a few per hPa).
So that’s a really long way of saying does mobiflight help with some of these annoyances? I need to do some reading into what it’s actually doing I think.
Using Raspberry Pi and Python code. The pi emulates a USB keyboard and sends keystrokes to the sim.
1 Like
Nice…so its your own custom Python code? I don’t supposed you have it on gihub or able to share?
As a matter of fact it is on github. It’s under kpmn819/FS-Release-Candidate there you will find the main program file, a data module and all the graphics used. It can run on a PC for testing as long as you have Pygames installed as well as Python 3 because it detects the OS and if running on a PC will not execute the Pi specific routines.
On startup it asks for a space input to allow outputting from the Pi as you can see from the code.
Speaking of the code, it’s not overly elegant but works and is fairly well commented. Have fun.
1 Like
This is really interesting. It inspired me to create a button box for ATS using an arduino uno. It is presented as a usb HID keyboard. Unojoy library only has a limited number of buttons and I needed about 20. I used a keypad matrix wiring diagram for all the buttons except the encoder switches which I read from one of the user comments on the product page, that the switch cannot participate in a matrix ( Apparently those encoders without breakout boards can ) so I used a digital pin for each. The encoders required a separate procedure for determining clockwise and counterclockwise motion and the A and B channels required each a digital pin. I used the AMstudio button box code but removed all the joystick code and replaced with serial printing of keyboard scan codes.
Your encoders alone would need 10x3 digital pins (30). Each switch will require one pin as well (12) and I think each LED will require one as well (12). It looks like you used all your IO pins. Can you elaborate on the wiring diagram? Also can you give details about your shopping list, links perhaps to where you purchased the components, especially that case? Also, are there any other buttons that you wish you could have put in the box? I also assume that this does not require an external power supply and is simply usb powered.
I would like to venture into creating a button box for MSFS 2020 eventually. I don’t think you used a keypad matrix wiring diagram and I don’t know how mobiflight can deal with that. I don’t know anything about mobiflight at this juncture but I assume they do button assignments to FS2020 functions. A keypad matrix would be a little more complicated to setup. Perhaps they even have bidirectional communication so the status of aircraft systems could be translated to LED activation.
If this project was done on an UNO ( I got a few of them free a while back ) then there could be room for 6x6 buttons (36) in a keypad matrix and the remaining 8 digital pins could be hooked up to 4 rotary encoders total. I could possibly use two UNO boards in one box which will give me 28 digital pins and 12 analog pins total of 40 but the keypad matrix will save some of the pins so I might have enough to support all your buttons and encoders. I actually have two UNO boards right now connected to one USB port and they seem so far to be working. One is the button box and the other is an UNO configured as Unojoy joystick to read the potentiometers and switches of a Logitech G29 shifter.
I will probably need to directly interface with FS2020 to determine status of switches and such. I haven’t figured that out yet. Controlling FS2020 is a matter of simply sending the appropriate keyboard scan code with a button press. Even the rotary encoders are treated as buttons with a clockwise or counterclockwise click turn being sent as a keypress. Or possibly use Mobiflight for each separate arduino if that is possible.
Possibilities.
You know, I just realized, perhaps a pitch trim control would be a good addition to the setup. A rotary encoder on the side of the box with a large disk for turning.
Chris
Here is mine. Since my cockpit is already very crowded I opted for something very small. The OLED display is used to assign different functions for the segment display and the two rotary knobs. Hence I can use a lot of functions.
Currently I can control AP HDG, ALT, VS; BARO; COMs, NAVs, ADFs, XPNDRs and OBSs. I can also display current Altitude and Speed (great on takeoffs and landings).
As soon as the library gets its next update I want to include AP NAV & GPS.
miniAVX 1.05 - DIY Arduino Mini Avionics Panel - Self-Service / Home Cockpit Builders - Microsoft Flight Simulator Forums
That looks awesome. I think I will add the digital display as well but I want immediate access so I will have a bunch of encoders.
Looks like “These are the droids I am looking for”
If I understand correctly, there is a resident bitsanddroids program that intercepts serial data from arduino and sends serial data to arduino. It also communicates to MSFS via simconnect I assume.
What encoders do you use. There is debouncing code for encoders on the net that uses a state machine. Do you have issues with the encoders you are using? I don’t really know if the code is necessary for encoders that have a break out board.
Does the bitsandroids program get bogged down when you have a lot of encoders and displays requesting and sending serial data? Also, do you have to load an alternative firmware besides the sketch? The annoying thing about the USB hid solution I am using, is if I have to modify the sketch and reupload a new version, I have to DFU and reflash the firmware on the UNO to its original state first. After I upload the new sketch, I have to DFU and reflash the USB hid firmware. Can’t upload sketches with the USB hid firmware installed.
Come to think of it, if the flight control surfaces can be controlled by the arduino through bitsanddroids, you should be pretty much able to create your own Autopilot algorithm. Read the altitude, if too low send the command to adjust the elevators and thrust. It would simply be a function that can be activated by the press of a button to set a global variable and becomes activated in the loop.
I will have to do some further research.
Thanks,
Chris
Huh, a lot of questions. I’ll try my best to answer them.
I am using KY 040 encoders with breakout boards, they have some resistors and that takes care of bouncing, I believe.
The code on the Arduino is just the sketch. Don’t need to flash or firmware upgrade anything.
On the Due I am using different ports and also in the code RX and TX are separated. It even runs with different sessions of the program. So far it runs smoothly. I think it does not depend how many switches and displays you have, but how much data you run across the serial simultaneously. Hence the DUE might be better equipped for that.
Please check out my link and BitsAndDroids Discord, he is very quick to help. Should you have any more questions, please ask in the other thread. I am glad to help.
Thanks a lot.
I got it running. I used your code which I severely trimmed for just the case of one breadboarded rotary encoder and I was able to change values in the game.
I had to download the SDK although I’m not sure if that is necessary. I couldn’t get it to work at first and then I decided to unplug and replug the usb cable after uploading the sketch. Then I hit start on the BitsandDroids application and then I was able to change in game values using the rotary encoder.
Next Step is to check If I can receive data from MSFS 2020. So far I don’t seem to need the 10 uf capacitor in the Documentation. Hope that doesn’t change with serial reading.
I’m glad that I don’t have to DFU and reflash the firmware to get the sketch running (just unplug and replug the usb cable). I had to reflash the original firmware each time for my ATS button box because the USB hid firmware does not allow uploading a sketch.
Thanks again,
Chris