Hacker News new | past | comments | ask | show | jobs | submit login
DIY control pedal on Linux (rogach.org)
78 points by Rogach on Sept 8, 2015 | hide | past | favorite | 35 comments



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.


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.


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...), but that's not always necessary.


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.


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.


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.


Thanks for elaborating!


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.


The troll of the day:

> How about using ViM?

Thanks for sharing, this post made my day.


Emacs people...


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 for $40.


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...


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?


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?


I'm using a kinesis keyboard with the "savant" pedal, which can be configured to do anything you need.

I used it for a while as "shift", then ESC and control, then I stopped. Not so much because it wasn't efficient (I still think it's better than using caps-lock, not so much for other keys), but because it enforced a more rigid posture when sitting. I like to move the feet a lot, and change the sitting position. Instinctively I tended to stay more rigid instead of moving the pedal.

But YMMV. If you tend to abuse shift to capitalize words, a pedal is worth considering.

I also just used a mouse attached to a piece of cardboard, controlled with the foot just by sliding it on the ground. Just too hard to control fine movement. I briefly tested just a mouse with the bare foot, but the foot joint just doesn't has the versatility of the wrist. It was also annoying that I had to use a keyboard combo to perform the clicking (since I used the toes to hold it).

Trying costs nothing though, so have fun and try for yourself. Pick a crappy keyboard, and construct a lever with a V shaped piece of cardboard. Position the pin on the back on the key that you want to "try". It won't be as rigid or comfortable as a pedal (you cannot "rest" on it), but you can get a feel of how it works. I let several of my colleagues try the pedal since I don't use it anymore, but it's not something that is easily appreciated.

It certainly requires some training to get used to, especially to generate control sequences. I would advice to try one before buying for this reason.


I've been using a pedal on my Kinesis for a shift key for about 5-10 years now.

At some point I noticed that my left pinky was experiencing more pain than my other 9 fingers, due to its heavy use for holding shift and ctrl while pressing other keys. The Kinesis has two lovely ctrl keys in the thumb position, so I trained myself to start using those instead by remapping the pinky-placed ctrl key to F12. (Initially I just unmapped it, letting it devolve back into the awful capslock key, but F12 actually proved to be a better deterrent for retraining, as its negative effect was immediate.)

That helped with the pain, but only a little. So I bit the bullet and mapped the shift key to F11, forcing me to use my foot pedal for shfit.

Even after years of practice, it's still hard to use. The timing of a foot press is very different from a finger press -- the leg muscles require more time to build up the extra force necessary for the pedal. (The pedal is much stiffer than a keyboard key, because it has to accept the weight of the front of my foot without triggering, as opposed to the weight of a single finger.) I still find myself capitalizing the second letter of a word because of this issue. wHich looks ridiculous. And it forces me to sit squarely in my chair, with legs uncrossed, which I find very unnatural.

But my left pinky doesn't hurt anymore.


> Is anyone using a pedal in addition of a keyboard on a daily basis?

i've been using foot pedals with a kinesis advantage for a couple of months. note: i don't always use the pedals.

> Do you really think this could be a significant help when typing code?

no. i'm slower with the pedals, but my immediate goal was to reduce RSI-related pain, not to increase typing speed. to that effect they've been effective.


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.


Interesting enough, the ancestors of emacs were on a keyboard where the meta and control keys were in the lower-left corner, and it was somewhat expected that you would move your entire hand to do chording on those while using the other hand for the letter keys.

I imagine that resulted in far less pinky-strain.

Knight keyboard: http://world.std.com/~jdostale/kbd/Knight1.jpeg

Later followed up with the space cadet keyboard: https://en.wikipedia.org/wiki/Space-cadet_keyboard which added super and hyper.



That project was my inspiration for this hack :)


I'm not using Vim or Emacs but still doing intensive use of ctrl and shift in Visual Studio so I might give it a try :) Thanks for your replies


Now this, my friends, this is a hack.


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?


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


Pedantic, but that's not a TRS connection.


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


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


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


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.


That was my first thought - I selected some generic USB pedal, but it failed to arrive, so I used what I had at hand. Also, there could be a problem with pre-made USB pedals - they may only transmit events on pedal down, like it happened for Vim Clutch author (https://github.com/alevchuk/vim-clutch).


Would a voltage divider help the overvoltage problem?


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?


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).


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




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: