Arduino Leonardo/Micro As FSX/Flight Sim Panel


8,909

69

8

Components needed:

- Arduino Leonardo/Micro

- Toggle switch/push button

- 10k Resistor for every switch/button

- Hookup wires

- Acrylic glass (optional)

- Glue (optional)

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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

    • Indoor Lighting Contest

      Indoor Lighting Contest
    • Make It Fly Challenge

      Make It Fly Challenge
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    8 Discussions

    0
    None
    VictorF56

    1 year ago

    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

    0
    None
    m.moumni

    2 years ago

    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
    0
    None
    m.moumnim.moumni

    Reply 2 years ago

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

    0
    None
    VictorF56m.moumni

    Reply 1 year ago

    And how you wire it? Thanks for the advise

    0
    None
    ltjbone

    2 years ago

    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
    0
    None
    VictorF56ltjbone

    Reply 1 year ago

    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

    0
    None
    Swansong

    2 years ago

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