3
\$\begingroup\$

I'd like to convert this: http://www.parts-express.com/pe/showdetl.cfm?Partnumber=060-640&utm_source=googleps

to a USB? An ideal solution for me because of cost would be to use an existing usb controller from a usb keyboard. I was hoping someone might help bridge the gap in steps. What is necessary to wire the connector to the usb controller? Any help whatsoever would be much appreciated.

\$\endgroup\$
10
\$\begingroup\$

This calls for an FTDI FT245R. FTDI has become the standard for interfacing USB in a simple way to microcontrollers and other digital I/O.

enter image description here

The FT245R has 8 parallel I/O, so you can connect the switch with a pull-up resistor to one of those.

edit
You asked about this module:

enter image description here

Looks good. You connect the switch as follows:

enter image description here

VCC goes to VCCIO, Vout goes to one of the inputs D0..D7. I wouldn't solder directly to the module, but use a socket like this instead:

enter image description here

That's it. The advantage over the RS232 interface is that you have 8 I/O at your disposition.

The yellow jumper on the board selects between 3.3 V and 5 V for the I/O. This is important if you want to connect to a microcontroller or other external logic, but for the switch it doesn't matter.

\$\endgroup\$
  • \$\begingroup\$ Do you happen to know any good guides for implementing this? \$\endgroup\$ – stormist Jul 13 '12 at 16:06
  • \$\begingroup\$ @stormist - this is everything you need. Connect the switch between ground and one of the I/Os (D0 through D7), and connect a 10k pull-up resistor to Vcc. The input will be logic 0 when you press the button, otherwise '1'. What else do you need help on? \$\endgroup\$ – stevenvh Jul 13 '12 at 16:13
  • \$\begingroup\$ aliexpress.com/store/product/… Do you mean this? Please forgive my ignorance in this area but what type of wiring would be best? When you say connect to ground what exactly do I connect the other side of the wire to? \$\endgroup\$ – stormist Jul 13 '12 at 21:38
  • 1
    \$\begingroup\$ @stormist - I see you accepted Russell's answer, but I thought I'd still explain the module you asked about. With its 8 I/Os it may come handy for other projects. \$\endgroup\$ – stevenvh Jul 14 '12 at 5:48
  • \$\begingroup\$ Stevenvh do you happen to know where I might purchase one of those sockets? \$\endgroup\$ – stormist Jul 25 '12 at 22:02
7
\$\begingroup\$

(1) If you have a working USB keyboard, wiring two wires from the switch across the 2 contacts from a key switch would allow your switch to simulate the switch. This could eg be "A" and it could send an "A" every tie it was pressed. Or something like the "Print Screen" key which would be detectable but would not affect most programs' operation. Or eg "f12" which may or may not be "harmless" in normal use.

(2) You could use a cheap (from $5) serial to USB adaptor and wire the switch to eg the CTS line. This can be detected by a PC program.


Assumption: "PC" with USB used.

\$\endgroup\$
  • \$\begingroup\$ I once saw a big-round-button USB device on sale at an almost tempting price... I think it was supposed to trigger a backup software package or something. \$\endgroup\$ – Chris Stratton Jul 13 '12 at 4:49
  • \$\begingroup\$ [Print Screen] overwrites the current clipboard content. I think the only completely harmless keys are the user-programmable ones. \$\endgroup\$ – stevenvh Jul 13 '12 at 10:57
  • 1
    \$\begingroup\$ BTW, are you feeling all right? This is such a short answer.. :-) \$\endgroup\$ – stevenvh Jul 13 '12 at 10:59
  • \$\begingroup\$ How would the wiring of the switch to serial part of the adaptor be done? \$\endgroup\$ – stormist Jul 13 '12 at 16:05
  • \$\begingroup\$ What kind of wiring would I get to wire the key switch to the button? \$\endgroup\$ – stormist Jul 14 '12 at 2:34
6
\$\begingroup\$

In the realm of simple-but-evil, having the button connect a 1.2 K or so resistor between USB D- and USB VBus will probably make the core USB driver think that a device has been plugged in to the bus.

Enumeration will of course fail, but depending on host operating system the event could be detected in software.

Otherwise, patch it across one of the switches in a cheap keyboard as Russell suggested.

EDIT: IMPORTANT The pullup should not go to 5v VBus, but to 3.3v regulated from it. However you can probably get away with a slightly larger resistor and a zener diode to ground to regulate the voltage.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.