Introduction: Arduino Leonardo/Micro As FSX/Flight Sim Panel

Components needed:

- Arduino Leonardo/Micro

- Toggle switch/push button

- 10k Resistor for every switch/button

- Hookup wires

- Acrylic glass (optional)

- Glue (optional)

Step 1: Building the Panel (optional)

There are many ways of building flight sim panels. An easy way is to simply download this image:

http://users.skynet.be/jcordon/cockpit/dimensions/...

Print it and glue to a piece of acrylic glass. Drill the holes for your switches and screw them in place.

I also printed a mask on transparent paper to have a better backlight effect, this was made in photoshop and took some extra time.

Step 2: Wiring the Switches

This is pretty straight forward, connect the switch between 5V and your desired pin. Also add the 10k resistor to remove any impedance.

Repeat this process for every switch.

Step 3: Programming the Arduino

Download and install this library in your Arduino libraries folder:

https://github.com/MHeironimus/ArduinoJoystickLibr...

Here’s an example code for a button connected to pin 9 on the Arduino, acting as “joystick button 1”.

#include <Joystick.h

Joystick_ Joystick;

void setup() {

pinMode(9, INPUT);

Joystick.begin(); // Initialize Joystick Library

}

void loop() {

Joystick.setButton(0, digitalRead(9));

delay(50);

}

Now open up FSX and you should be able to assign your switches in Control settings.

Happy flying!

Comments

author
m.moumni (author)2017-01-19

Hi Granis, t

Thanks for sharing this. I used this with x-plane. The only issue I have is that when I use a toggle switch for landing gear for instance. In x-plane i connected button to toggle gear.
But when I toggle on it does required action. but when I toggle off landing gear stays in same position until I flip the switch again to on. Then it retracts the gear. what can I change in the code to fix this? Or am i doing something else wrong? Thanks in advance.

author
m.moumni (author)m.moumni2017-01-19

Its a toggle switch with only two ends, so (on-off) and not a toggle switch with (on-off-on).

author
Shahid Khattak (author)2016-12-07

Geart instructable

author
ljohnson69 (author)2016-12-03

Awesome instructible!

I do have a few Arduino/Microcontroller programming tips:

Instead of using the delay function, I would use a function that compared when the last time the desired operation happened to the current time. If enough time has passed it will perform that operation and reset the timing variables.

When the arduino is perofrming the "delay(xx)" function it will not do anything else such as read an input. This can cause a button press to go unnoticed.

Also, be sure to debounce any button inputs. This is necessary as some button presses may be incorrectly interpreted by the arduino as multiple presses.

When I have time I'll post an example from one of my arduino projects.

I can't wait to get started on one of these myself.

author
Swansong (author)2016-12-02

Neat! I loved playing with flight sims as a kid :)

About This Instructable

3,593views

55favorites

License:

More by Granis:Arduino Leonardo/Micro as FSX/Flight sim panel
Add instructable to: