Quick & cheap USB button for tethered cameras

Everything camera related. Includes triggers, batteries, power supplies, flatbeds and sheet-feeding scanners, too.

Moderator: peterZ

Post Reply
benjamin
Posts: 58
Joined: 04 Mar 2014, 00:53

Quick & cheap USB button for tethered cameras

Post by benjamin »

Hi folks,

For our project, we're tethering our cameras to a workstation computer and shooting directly to the hard drive. Accordingly, the SDM controller described in the instructable won't work for our purposes... so I hacked together a footswitch out of a USB game controller. This is just a test implementation, the final version will have an actual enclosure, soldered connections, and strain relief.

The key here is really just the information that there are dozens of free programs out there that will translate joystick button pushes into keystrokes or commands.

I used:
1) usb joystick, cheaper the better. Gamestop sells one for $9.99; I had a Saitek P220 which turned out to be really lucky (explained below).
2) a momentary switch, in this case a car horn button (runs about $3 at autozone, or a wider selection at Radio Shack)
3) some extension cord
4) a chunk of scrap wood

Here's the controller. As you can see, the dog started to open it for me. I finished the job by removing around six screws on the back.
Image

Here are the horn button and the exposed PCB. I was preparing for a little bit of mildly tricky soldering work, but it turns out the P220 trigger buttons are actually on wee little breakouts, so all I had to do was splice two wires! (Yes, my coffee table used to be a pinball machine).
Image

Breakout wires. There's one more set available, after that it's fairly trivial to solder on a good dozen or so additional leads/buttons if you could think of things to do with them. Just drill the marked dimples, tin the wire, feed it through the hole & add a drop of solder. Of course, at a dozen buttons you might as well just use a keyboard. If you need more guidance, check out the forums for folks building custom MAME arcade cabinets. I spliced one end of the extension cord to these wires, it doesn't matter which one goes where, since it's just closing a circuit. Another lucky break here was that my dollar store extension cord used super-high gauge wire. Lucky because a) given how tiny the joystick wires were, thicker wire would have been harder to connect without risking greater strain; and b) the electrical cord never caught fire back when I was using it with power tools.
Image

...so then I wired the other end of the extension cord to the horn button.
Image

...attached the button to the wood, wrapped the PCB in something nonconductive, and stuck it in a temporary enclosure.
Image

...for testing purposes, I'm using Xpadder, because in a 5 minute web search it was the only program I could find compatible with Windows 7. This version will send individual keystrokes or strings of text, but not commands. Ultimately we'll be using this on a machine running Xubuntu, and will use QJoyPad to map the button to a nonstandard key (something not available on a regular keyboard), and then xbindkeys to translate that keypress into a command (the script calling gphoto2, downloading the images, and displaying them for review). You can do the same thing with Windows hotkeys. Here you can see I've mapped the key to output "foo" followed by a linebreak. Xpadder will also allow you to map to mouseclicks, which may be useful if you want the footswitch, but are using a program which doesn't support hotkeys or a commandline interface. EDIT: then again, you could also just put a cheap mouse on the floor and cover the sensor or remove the ball.
Image

...ultimately we'll probably use the footswitch for camera clicks, but add a couple more buttons, arcade style, to the front of the scanner: start/stop timed shooting, delete last image, and mark current image for additional preprocessing (eg. torn or stained pages that need cleanup by hand).

Just to prove the point, I'm now going to hit the button a couple of times in this text entry window:
foo
foo
foo
Post Reply