Electronic – Interface 5v digital pulses to keyboard contacts

5vkeyboardrelaysignaltransistors

I currently have the following bit of kit: Photoplethysmographic sensor for measuring heart rate

It outputs a 5v pulse each time your heart pulses. What I need is to do is interface this pulse output to a keyboard (So each time your heart pulses a key is pressed on the keyboard).

I have stripped an old USB dell keyboard and worked out what contacts on the keyboard PCB need connecting to simulate the key I am after.

I have drawn a circuit on how I think would be the right way to interface the two electronic circuits:

enter image description here

My question(s) are:

Will this circuit work as I intend it to?

Will the relay be able to switch on and off 50-120 times a minute?

Can you offer a better method of interfacing the circuits?

Best Answer

Whether a transistor directly across the contact is a good idea or not depends on how the low side of the switch is configured. If that's just an open-drain/open-collector then there's no problem. If it would have a very weak pull-up then the transistor's emitter will be a few volts positive with respect to the base, and though the voltage may not be high enough to damage the transistor, NPN transistors don't like that.

A safe alternative is to use an analog switch,

enter image description here

like the 74LVC1G66, which is an improved single gate version of the good old CD4066 quad switch. The 74LVC1G66 has an on-resistance of less than 10 Ω, but at least a few tens of ohms should be no problem.

Many of these switches have near-zero power supply current (typically 100 nA for the 1G66), and contrary to mechanical relays don't wear out.

If you can't connect the heartbeat monitor's power supply to the keyboard's you'll have to use an SSR (Solid State Relay), like Dave suggests in his answer. These are more expensive though: the Toshiba type Dave mentions costs almost 4 times the 1G66, so I would only use that one if you really need the isolation.