
DIY control pedal on Linux - Rogach
http://blog.rogach.org/2015/09/diy-control-pedal-on-linux.html
======
sebisebi
IT is actually possible to build a very simple pedal yourself. You can tape
two tinfoil "electrodes" on cardboard and fold it so that they touch when it's
completely folded. Then also put some sponge between the folded cardboard so
that it releases reliably. If you connect a mono audio cable to the electrodes
you have a working pedal. This worked in a pinch for an electronic drum set
and it is also much quieter than a real pedal.

------
tedwilliamsis
I did something similar once, entirely in hardware, by soldering a normally-
open foot pedal switch to the keyboard's controller chip.

In most keyboards, a keypress is registered during the connection of two
conductive pads on two separate membranes, each of which contain a trace back
to a controller chip. You can take a keyboard apart, look at where the Ctrl
key is, then visually follow the traces back to their respective pins on the
chip. Soldering a switch to those two pins will register with the keyboard
_exactly_ as if that key were pressed.

------
gherkin0
That's a neat, different way to do it. Nowadays I think most people would go
straight to building something with Arduino (e.g. [http://apcmag.com/arduino-
project-usb-foot-operated-mouse-sw...](http://apcmag.com/arduino-project-usb-
foot-operated-mouse-switch.htm/)), but that's not always necessary.

~~~
Vexs
That's what I was thinking when I was reading this, an 11$ teensy uC could do
the job very easily, it's got a keyboard emulator built in. I love the teensy
uC, it's completely replaced the arduino for me. So much cheaper and more
capable.

------
donquichotte
Cool, low budget hack requiring almost no additional hardware! The author
states that "the signal is too strong for our input and goes off-scale, making
it almost impossible to reliably detect pedal press/release events". Since the
two waveforms are visually quite distinct, it is probably possible to
correlate the incoming signal with reference on and off waveforms to detect a
state change reliably without using hand-crafted heuristics.

~~~
Rogach
Yes, that's what I tried - but there was a case when next press or release
happens while signal is already off-scale from previous event, and I failed to
find any sane way to solve that case. Also, the scale on the images is 500ms
per one red square, so you can see that waveforms extend over hundreds of
milliseconds - thus there will be unbearable latency with that approach.

~~~
donquichotte
Thanks for elaborating!

------
ChuckMcM
On the one hand I cringe at using the audio input for effectively a DC signal,
but on the other hand it is probably sitting there unused on a lot of machines
so it isn't like you're losing a capability. As with many folks I'd probably
use a small uC and have it emulate a keyboard (maximal re-use of known
interfaces) but hats off to the creative use of pulseaudio.

------
simgidacav
The troll of the day:

> How about using ViM?

Thanks for sharing, this post made my day.

~~~
lasermike026
Emacs people...

------
grymoire1
I needed a programmable USB foot pedal for my Linux system, as I wanted a
hands free way to give a presentation, so I bought one from
[https://www.delcomproducts.com/webpage.asp?id=32](https://www.delcomproducts.com/webpage.asp?id=32)
for $40.

------
dest
this project is great! after a quick research, it seems that esd might be a
bit outdated now [1] and that more recent sound API could be used. it seems
however to do the job just fine.

[1]
[http://www.linuxquestions.org/questions/programming-9/esound...](http://www.linuxquestions.org/questions/programming-9/esound-
client-programming-57017-print/)

~~~
Rogach
Yes, if people say that esound was already outdated by 2003, then by now it
should be very much dead. But I was more focused on completing this project
than on researching sound APIs, thus I simply took whatever Xoscope guys used.

After all, we simply want to read voltage level from simple input - why should
we need to invent new library for it every 3 years?

------
TheCams
Is anyone using a pedal in addition of a keyboard on a daily basis? Do you
really think this could be a significant help when typing code?

~~~
Rogach
I use it exactly for that, and it really helps me when navigating in Emacs
(holding Ctrl with pedal is much easier than holding it with your pinky). Your
experience may vary, of course.

~~~
userbinator
VIM users may also benefit:
[https://news.ycombinator.com/item?id=4141410](https://news.ycombinator.com/item?id=4141410)

~~~
Rogach
That project was my inspiration for this hack :)

------
CephalopodMD
Now this, my friends, this is a hack.

------
pavel_lishin
Obligatory complaint about Blogspot breaking back-button functionality;
cmd-[left arrow] does nothing, cmd-[right arrow] takes me to the next article.

Who thought this was a good idea?

~~~
slig
At least they are consistent and break the back swipe on mobile as well.

------
almightysmudge
Pedantic, but that's not a TRS connection.

~~~
Rogach
Yes, you are right - I got confused with mono/stereo distinction. It is TS
connection, right?

~~~
aidenn0
I just call it a phone plug and then don't have to worry about how many Rs to
list.

------
pkaye
I see an iKKEGOL USB foot control switch on Amazon for $13.99. Can't you hook
that up to any software?

~~~
saulrh
Some of those cheap USB foot pedal switches have a disturbingly custom
software architecture. When I bought one off Amazon, it turned out to not even
be HID - it needed special drivers and everything. Even the ones that are HID-
compliant usually demand some custom software for initial setup ("which key do
you want me to pretend to be?") that invariably only speaks windows. Which is
annoying, because this really should be just a full-hardware solution that
speaks USB HID and uses a set of DIP switches on the back for the desired
scancode.

------
zwieback
Would a voltage divider help the overvoltage problem?

~~~
TheRealDunkirk
This was my immediate thought, but then I got confused. Where does the pedal
get it's voltage to generate the signal to begin with? From the audio jack
itself? If that's true, why does it return a signal too high for the sound
card to handle? Is there some sort of voltage amplifier in the pedal that can
be bypassed?

~~~
jononor
If the voltage comes from the audio jack, it is the DC used as the bias
voltage (for electret microphones). Typically 1.5 volts, which is likely way
higher than the AC signal range of the input (likely to in the order of <100
mVp-p).

------
platz
I remap LALT to CTRL so i can hit it with my thumb

