Switches & Buttons
Wiring And Basic Tutorial for Mobiflight & Prosim using Ardunio Mega
Connecting a switch in your simulator, is one of the easiest things you can achieve. It provides a great starting point and proof of concept for any budding enthusiast.
Switch type really doesn’t matter. From large toggle switches to tiny tactile switches, they will all work with the Arduino, Mobiflight and Prosim. The big toggle switches are used everywhere in a 737. From overhead to MIP. The tactile switches both 12mm and 6mm are used inside various panels and I have found the ones fitted with LEDS work really well to help illuminate the various buttons. Buying from eBay in bulk from china is very cheap. After-all, even if you are not after a replica Boeing, you can still have 50 switches on each Arduino to command as you like.
Switch & Button - Pin Layout
Each switch can have two more contacts/legs/terminals. One will always be ground or known as the common (pin). This pin will be connected to the Arduino ground. If more than one button/switch is used, the grounds can be daisy chained.
The other pins (PIN1 & PIN2) in the diagram below can be connected to any other pin on the Arduino Mega; pins 2 to 53.
Switch & Button - ON - OFF
A Simple ON - OFF switch, normally has two pins. The button type can be latching or momentary.
With this type of switch, it really doesn't matter which pin is assigned to ground.
Once the wiring is completed, its straight over to programming Mobiflight and Prosim. If you need help on this, see the YouTube video; Helimech Episode 25 or visit the Button Programming page on this website.
Even though there are 52 availible pins on the arduino Mega, Mobiflight has a software restriction capped at 50 switches. The other two pins can be used for other devices such as LED's, Encoders or Servos.
Switch & Button - ON - OFF - ON
The ON-OFF-ON Switch, is like having two ON/OFF switches together, but being only able to select one of two states. There is usually a common pin in the middle used for ground. The two other pins are used to connect to the Ardunio Mega (Pins 2-53).
Actual aircraft wire is predominately white. Red and Blue are also used.
I like to use different colours for different devices.
Here, in these examples. I have used blue for switches, Black for ground.
Red for +5V, yellow for LED's and grey for Servo's etc.
Switch & Button - 2 OR MORE SWITCHES
Up to 50 switches can then be added. I have shown only two switches to help keep the diagrams simple. But the principle is the same. You can see how the ground is simply daisy chained. This is to keep the wiring back to the Arduino to a minimal amount. The looms already can get quite big in size with 52 wires.
There are only 3 or 4 grounds on the Arduino Mega to connect all your devices too.
Sometimes its easier to connect all the grounds in daisy chain configuration. Linking devices to one and another using a single ground back the Arduino Mega.
Another way would be to used a break out board with a common ground connected line.
But by daisy chaining grounds, the wiring loom can reduced drastically.
Rotary Switches - 1 to 12 pins
Wiring Rotary Switches are very similar to the above examples. These switches can have up to 13 pins on a switch. You may not need all these pins. Each rotary switch usually comes with a locking collar which you can insert into the front. There are 11 positions to fit it. The number relates to the amount of positions/Pins you want to use. The locking collar stops the knob rotating the to the full 12 positions if required. Below are the wiring diagrams for all 12 positions including a center ground/common pin. Using multiple rotary switches can soon fill an Ardunio Mega board.