Arduino Leonardo/Micro As FSX/Flight Sim Panel

5,548

63

8

Published

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!

Share

    Recommendations

    • Water Contest

      Water Contest
    • Oil Contest

      Oil Contest
    • Clocks Contest

      Clocks Contest

    8 Discussions

    Hi, my name is Victor, and I reproduce your proyect but I can do the same as your. I don't know what I'm doing wrong. The switch work at the first input, but when I turned off, the switch stays on, until I go ON again and the switch in the simulator goes OFF. Please could you help me? Thanks

    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.

    2 replies

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

    And how you wire it? Thanks for the advise

    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.

    1 reply

    Hello. I need some help here. I made the programming as the instructions, but when I turn on the switch, I have to turn off and the turn on again to ON/OFF a light in the simulator. Could anyone can help me?. And sorry about my english. Thanks a lot

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