• How To Use Toggle Switches With Cockpit Keyboard Emulation

    How To... Use Toggle Switches With Cockpit Keyboard Emulation

    By Eric Edelman

    After reading the articles posted by Kev Saker and Robert Prather I was impressed by their ingenuity in designing an excellent way of making your simulated flying a lot more realistic by being able to use buttons etc. instead of the normal keyboard. Unfortunately, there was one thing missing that I really wanted on my panel: toggle switches. What's flying without being able to throw a couple hefty toggle switches? In this article I will attempt to explain a way of solving this problem. I very much recommend first reading the keyboard emulation article by Robert Prather to understand what this whole thing is all about anyway.

    The Problem

    All simulators have understandably been designed to work with a standard keyboard, meaning they want momentary contacts to switch things (you press a key and then let it go, giving the sim only a short pulse telling it to do something). The big problem here is that toggle switches don't work the same way. They are meant for the real world, where you don't want something momentarily on and then off again, but either on OR off. In other words, toggle switches use permanent contacts. So if you were to hookup a bunch of toggle switches to a keyboard card and try to use them with your simulator, this would result in a key repeat which is definitely not what we want (flying around with your landing light going like a party stroboscope is probably not legal!).

    The Solution

    So what can we do about this? Well, this simple circuit does the trick. Basically what it does is send a momentary contact to the keyboard card, even though all you see on your panel is a toggle switch. To understand how it does this, I will first explain some basic facts about the components used. If you happen to know all about this already, you may skip the next section.

    What almost everyone knows is that a capacitor can store electrical energy. What is often overlooked is what this does to its conductivity. A common comparison is that of the bucket: it can be filled with water, which can be kept there and then released when needed, just as a capacitor can be filled with electrical energy. But actually a toilet's water tank is a more accurate example. Just as with the bucket, you can store water in it, but there is one major difference: a bucket will overflow, but a toilet has the ability to stop the incoming water flow. And that is exactly what the capacitor is meant to do in this circuit, stopping the flow of electricity when it is full.

    As you can see from the schematic diagram (fig. 1), the circuit is made up of two loops, one with a power supply and the other without. Let's say you start with the toggle switch in the position without the power supply. The relay is in its rest position, meaning here that there is no contact on the keyboard card. As soon as you flip the toggle switch ("Positive rate of climb, gear up"), electricity will start flowing through the then closed loop (fig. 2). This means that the relay is triggered and will make contact on the keyboard card and that the capacitor starts charging. As soon as the capacitor starts to get full, there will be a decrease in current through the relay, making it break the contact.

    As soon as you decide to toggle the switch back again ("Roger, cleared to land"), the first loop is broken and the other one closed (fig. 3). In this case the electricity stored in the capacitor during the first process will be released, again triggering the relay momentarily and then letting it break contact again as soon as the stored electricity runs out. If you decide to switch again ("Declaring missed approach, going round"), the whole process starts over.


    Before we actually start building, first the required legal stuff:

    You may use this design for your own purposes only. Feel free to change the design anyway you like, but please contact the author before republishing it anywhere else, in either its changed or original form. The author is not responsible for any damage done to any person or property!

    Now the fun bit:

    All you really have to do to build a proper version of this design (one switch looks kind of interesting, but doesn't really satisfy one's needs) is repeat it once for every key you want to hook a toggle switch to. Making a neat row of the components on a circuit building grid is probably the best idea, unless you are willing to make a full printed circuit board for it. The value of the capacitor is the main way to change the time the relay makes contact on the keyboard card. You might have to change it slightly to get the system to work best for your combination of computer, keyboard card and relay, but the shown value seems to work in most situations.

    I have read a number of ideas about the soldering of the leads to the keyboard card, but none of them really worked for me, so I came up with this possibility. You should be able to follow the tracks on the circuit board from the contact strips which stick out at the bottom (where almost everyone tries to put their leads) to the nearest soldering point. Believe me, it is A LOT easier to connect a wire to one of these soldering points than to the miniscule strips at the bottom!

    Finally here is a list of required components:

    Quantity Component
    1 Keyboard card
    1 Power supply, ± 6 volt DC
    Whatever you want Toggle switches, single pole, double throw
    Your number of switches Capacitor, 47µF (I used electrolytic; adjust value to the trigger voltage and resistance of your relay)
    Your number of switches Relay, any single pole single throw will do as long as the trigger voltage is lower than the voltage of the power supply

    Further Ideas

    It was recently explained to me that it should be possible to use transistors instead of relays, creating a significant drop in price. I am not sure about the details, but this could make a good improvement to the design. Realize though that this means there is no separation between the power supply and your computer anymore like there is when using mechanical relays. The risk of fried motherboard rises quickly this way!

    On the prototype I used an external power supply by plugging it into a socket I installed on the side of my box of switches. Although this works very well it might be interesting to look into using the computer's power to drive the system. I have read about panels that fit into standard computer fronts with a number of sockets on them giving out 5 volts. It would be neat to use one of these as a supply, thereby eliminating the need for yet ANOTHER plug under the desk.

    Last Little Things

    Of course any questions, comments and suggestions are very welcome. I will try to respond as quickly as possible, but please have a little patience if it takes a couple of days.

    Well I guess all there is left to say is good luck with this project and happy switching!

    By Eric Edelman
    [email protected]

  • Recent Forum Activity


    Article: Just Flight - DC Designs - PT-17 Stearman for MSFS

    Thread Starter: Nels_Anderson

    You can view the page at https://www.flightsim.com/vbfs/content.php?22739-Just-Flight-DC-Designs-PT-17-Stearman-for-MSFS

    Last Post By: ryogahibiki345 Today, 05:07 PM Go to last post
    Roger Wensley

    Tom Hiscox's Scenery GenX

    Thread Starter: Roger Wensley

    Does anyone have any idea about getting GenX to start working again once it has stopped? After years it has just.... stopped?

    Last Post By: Roger Wensley Today, 04:33 PM Go to last post

    Article: KerrSpectives--The Islander

    Thread Starter: Nels_Anderson

    You can view the page at https://www.flightsim.com/vbfs/content.php?22507-KerrSpectives-The-Islander

    Last Post By: KennethKerr Today, 04:29 PM Go to last post

    World Update V has arrived

    Thread Starter: g7rta

    MSFS has just prompted me to open the MS Store for a mandatory update. The sim itself has downloaded a 5.25GB update.. and now the 3.53gb world...

    Last Post By: 64844101 Today, 03:52 PM Go to last post