Back

Pedal control of PC

This web page was created because when I was looking for something like this, I found none. Furthermore, I hope that someone advise me a better solution than that which I have reached. Well, I also want to get my site to Google :-)

What I needed:

Pedal control of PC

When playing from tablatures displayed on laptop display I decided that I badly need to scroll the tablature other way than by my busy hands, that means by a pedal. I thought that I'll go to the store and buy something suitable. Alas! Seems to be only a few users who need something like that, so usual PC shops do not sell it and I had to start to find another solution.



What I did not use:

vPedal

Perhaps the most promising seemed pedal vPedal . I needed a pedal, which would be able to control even such a program, whose creators made no support for pedal in it. In this case it is necessary to translate commands from the pedal (connected via USB, serial port or game port) into key combinations or mouse clicks. Manufacturer of vPedal promises all this possible by using their free software. But it seems that the software does not allow mouse click to specified coordinates, which unfortunately I need for one particular program , which has no keyboard shortcut for fine scrolling and only clicking on scrollbar arrow buttons makes it possible. And somehow I did not want to spend $ 75 plus shipping (from the U.S.) for a pig in a poke.

There could be found a number of similar pedals on the Internet (Google - "Foot Pedal" or "Foot switch"), intended mainly for transcribing of voice records. It seems that no software exists that would allow transfer the pedal pressing to key combinations or mouse clicks exactly the way I need.

Olympus FootSwitch This category also includes pedals from Olympus. One such I rather rashly bought (it costs a lot of money), hoping that, in the worst case (i.e., when I will not get the necessary software) I will use its switches at least. Unfortunately, this situation eventually occurred. On the Internet I found only proprietary software from Olympus, designed for playback from the recorder.

Other pedals are sold for games or musical instruments (sustain pedal). The problem is again how to convert their signals to the keyboard shortcuts or mouse clicks, not to mention the fact that they can be analog (for continuous control). They often use a game port which no computer I have is equipped with. If I needed to construct cheaper pedal containing only switches, I would chose a block of simple switches as Bespeco VM20 - they can be combined into a block. Doorbell buttons or wall push button switches would certainly worked too.


The resulting solution:

What ultimately I successfully use is in fact the keyboard with three keys controlled by a foot, in conjunction with a great wonderful powerful freeware program AutoHotkey.

Pedal and self-made gadget - in fact, the keyboard Windows easily handle 2 or more keyboards, processed code may come from any keyboard. I used the electronics and cable excluded from a waste keyboard, and instead of three keys I connected three switches of the Olympus pedal. (If I had no discarded keyboard, I would not hesitate to buy and cannibalize a brand new one. The cheapest keyboard today (9 / 2008) is 120K!) This way the pedal was degraded, because I completely bypassed its own electronics, but the solution with the AutoHotkey program is very versatile. Codes from the pedal can AutoHotkey translate to any keyboard shortcut or mouse click on the desired coordinates, even taking into account whether the window I want to control is just active or not. AutoHotkey can send keyboard shortcuts to windows that are not even active and many other things that I still have not looked at.


If someone wanted to use the same approach, the solution will depend on the specific keyboard, which electronics is to be used. In the Dell keyboard I used, the circuit board has outputs for 8 rows and 17 columns, which are cross-connected by individual keys. I created a table which shows what the keyboard sends a scan code when any row and column are connected. Rather than examining the wiring, better way how to fill in such table is to use AutoHotkey's function "Key history and script info" while row and column outputs are short-circuited. Optimal would be to use scan codes, which most of keyboards has no keys generating them, virtually no program or Windows itself use it and so there is a minimal chance that the pedal itself will interfere with anything. (Well-written script for AutoHotkey, however, is another prevention of any collisions). Particular DELL keyboard had 104 keys, but its electronics can generate another 11 scan codes, of which 6 would not interfere with anything. I was limited by the fact that switches in the used pedal have a common ground, so I had to use codes located on the same column or row. The choice fell on the column 9 and rows 6,7,8. Unfortunately, there is a backslash, but it is not used in any program that I control by pedal, so it's not a problem. But if I needed to write in the program let's say a path to the file, where would be "\", I would have to stop AutoHotkey for a moment, or make it other way (Copy / Paste, for example).

Keyboard dismantle Keyboard circuit
Switch wiring Casing
Key table

Example script for AutoHotkey

The script is written so that it does not matter if AutoHotkey is running on the computer all the time. If particular scan code come, (here 0x79, 0x7E, 0x2B), AutoHotkey first checks if the window of a program that I want to control by pedal is active. If so, it sends the appropriate keyboard shortcut, or click on the desired coordinates (of course, it assumes that display resolution is known and the window is maximized to full screen, otherwise the "click" can come to the wrong place). If not, AutoHotkey will not send anything, except for the code 0x2B, which is the backslash. It is appropriate to "forward" it, because it cannot be distinguished whether it came from the pedal or the keyboard, and in windows that I do not intend to control by the pedal the key "\" would just stop working.

I am very satisfied with the result, although I find that one concentrated on other activity manages to use only one pedal, at most two :-). How organists can manage dozens of them I do not understand :-).

All comments are welcome at mweb09ATcesnetDotcz . Particularly advice how to achieve the same functionality without the gadget, which makes keyboard from my Olympus pedal. The pedal itself can communicate via USB, so the used solution, though works perfectly, is actually only workaround, because the necessary piece of software I cannot either write or get from anywhere.