5

Let me explain what I'm doing currently.

We have made a finger heart rate monitor, each time your heart pulses a transistor is switched on via its base. The collector and emitter of the transistor are then wired to a dismantled USB keyboard. The wires are wired to the P key on the keyboard.

Each time your heart pulses the letter P on the keyboard is pressed.

While this works its large, fragile and ugly.

Anyone know of a pre-made USB device that can simulate a key press from our heart rate monitor?

Scott
  • 286
  • 3
  • 10
  • 1
    There are lots of more involved solutions, but I would not rule out taking a keyboard and removing everything you don't need (which is almost everything). – Wouter van Ooijen Sep 14 '12 at 14:13

7 Answers7

5

I gather that detecting a keypress is not the real purpose, but that you want to detect the digital signal from the transistor one way or another.

There are lots of modules with FTDI's FT245R USB interface, which allows you to connect up to 8 digital I/Os. For example this one costs only 9 dollar (and you may even find cheaper ones).

enter image description here


If you want to stick to the keypress then completely taking apart the keyboard is a solution. Most keyboards have only a small PCB with the controller, and a connector to the actual keyboard matrix. Find out which two pins define the P key, and connect the transistor between those pins. Then you only need that small PCB, and you can throw away the rest.

stevenvh
  • 145,145
  • 21
  • 455
  • 667
  • 2
    Note that this will not press a P as Brady seems to require. Whether that is a good choice on his side is another matter. – Wouter van Ooijen Sep 14 '12 at 14:11
  • @Wouter - True, but I imagined that the keypress simulation was more of an emergency solution, for lack of another way to enter the signal into the computer. I'll clarify my answer. Thanks for the feedback. – stevenvh Sep 14 '12 at 14:15
  • 1
    The reason for the `p` key press is because I need the heart rate monitor to interface to a web game. – Scott Sep 14 '12 at 14:23
  • @Brady - already updated my answer! :-) – stevenvh Sep 14 '12 at 14:25
  • @stevenh - The FT245R module design is an excellent idea. With FTDIs drivers it is possible to configure the module to appear as a virtual COMM port in a Window's host computer. Bradley could simply strap the D0-D7 pins to the particular byte code he wants (such as 0x50 in the case of a 'P') and then use his transistor output to pulse the WR# pin on the module interface. His PC software would then use the COMM port instead of the keyboard. If he actually does not have any application software and was just displaying the heart beat 'P's in something like Notepad -- – Michael Karas Sep 14 '12 at 14:27
  • Continuing -- then the Bradly can simply connect to the COMM port via HyperTerminal, puTTY, or TeraTerm. – Michael Karas Sep 14 '12 at 14:28
  • @Michael - I thought about using the FTDI driver with OP's own program too; you can use it with virtually any language. But in his comment above he says he needs the heart rate monitor to interface to a web game, and he may not be able to change the game software if it's a commercial program. – stevenvh Sep 14 '12 at 14:32
5

What you're looking for is a "keyboard encoder" or "keyboard emulator", such as these.

They also used to use the term "keyboard wedge" for this sort of thing, but nowadays that term seems to be used exclusively in the context of point-of-sale barcode and credit card scanners.

Dave Tweed
  • 168,369
  • 17
  • 228
  • 393
  • All answers very valid but I've gone with this as it's exactly what I was after. It requires no software or alterations to our current mechanics. – Scott Sep 14 '12 at 14:50
  • 1
    ... and MAME cabinets ;-) – Axeman Sep 14 '12 at 14:50
  • 2
    @Brady - This is verbatim what you asked for so I can understand you accepted this answer. But 83 dollar is a rip-off. Cannibalizing an existing keyboard for the controller PCB, like Wouter suggests, may cost you as little as 12 dollar; the cheapest keyboard you can find will do, since you won't need the mechanics anyway. For the rest the emulator seems to be exactly the same. *Way* too expensive IMO. – stevenvh Sep 14 '12 at 15:02
  • @stevenvh - I totally agree that $83 is a rip off and don't plan on buying what was linked to. But the names of the devices he provided has yielded some good search results of devices that do just what I'm after at a fraction of the cost. – Scott Sep 14 '12 at 15:06
  • I was actually going to suggest that (hacking a keyboard) myself, but a) that's what Brady's already doing, so he presumably wants something better, and b) I've seen too many recent-vintage cheap keyboards that don't use contact closures for the keys. Elastomeric contacts (which probably would work) and capacitance-sensing keys (which probably would not) are quite common. And there certainly are cheaper keyboard emulators out there; those just happened to be the first that I came across. – Dave Tweed Sep 14 '12 at 15:21
  • Hacking a keyboard PERIOD seems like a silly suggestion. He's already hacked a keyboard... he doesn't want to hack a cheaper one. :P – Toby Lawrence Sep 15 '12 at 00:32
3

I'd personally attack this with an Arduino. Simple, tons of existing support from the community and cheap. You could extend the functionality quickly and easily if you so chose to.

Here's a relevant link to a rough schematic, code, projects similiar, etc: PracticalArduino

Toby Lawrence
  • 3,098
  • 2
  • 26
  • 34
2

Use a microcontroller with built-in USB-transceiver, for example the Atmega32U4, in combination with a software emulator or a simple script or even something like Autohotkey.

That will provide a quick, very inexpensive (the Atmega32U4 costs < $4) and also flexible solution for what you're trying to do -- and none of the messing with an actual keyboard either.

You can program the Atmega32U4 to act like a standard HID USB device (a la many keyboards, mouses). You can either use the Atmega32U4 itself as part of your heart monitor, or alternatively just send data via it, using it as the USB-UART interface. See, e.g., this tutorial.

boardbite
  • 4,892
  • 11
  • 47
  • 73
  • Yes, pretty much any micro with a USB port or even software USB implementation is going to have something that pretends to be a keyboard as one of its examples. – Chris Stratton Sep 15 '12 at 03:56
1

Use something like this. Emulate a keypress on a digital pin state change with NETMF asks for no more than 10 lines of C# brackets excluded :-)

Axeman
  • 3,498
  • 20
  • 27
1

Had a similar need. Finally found a cheap and easy solution, a Chinese company has a number of devices that you can set any key press you want to associate with one or more dry contacts. Here is one example, one of the cheapest solutions, I'll just be cutting off the phone jack.

https://www.pcsensor.com/usb-switching-cable-with-6-35mm-audio-jack-female.html

But they have pigtail solutions as well:

https://www.pcsensor.com/usb-keyboard/diy-switch-line-usb-switch-cable-can-connect-4pcs-different-pedals-can-customize-different-line-length-usb-switch6_3.html

The only downside is you need a Windows system to program the device. But once programmed this should work with any computer that recognizes a USB computer keyboard.

I was going to hack a USB foot pedal that I found on Amazon.

https://smile.amazon.com/gp/product/B0098PLPOI

The pedal was cheap but actually well made and work as expected on my Mac. They solved the problem right by using an infrared LED and photo cell, where pressing the pedal interrupts the beam. This is a much better than a mechanical switch in terms of durability. But in taking it apart I discovered the maker's URL and found their other solutions for what I really wanted -- dry contact input. The only problem is I'll have to wait almost a month for my smart cable to arrive from China.

Bill Costa
  • 19
  • 2
  • Links to products to buy aren't really what this site is about. In fact, the question's request for a "pre made product" is explicitly against the current rules of this site - things were a bit looser seven years ago, but asking such today would result in a rapid off-topic closure as a prohibited "shopping question". – Chris Stratton Nov 30 '19 at 05:35
0

There are a ton of USB HID little boards around that do what you ask with about zero programming. One that I've used is the U-HID, http://www.u-hid.com/home/uhid_nano.php

Scott Seidman
  • 29,274
  • 4
  • 44
  • 109