0
\$\begingroup\$

My goal is to build something that simulates rapidity (50 to 1k Hz) pressing a key on a USB keyboard. My first inclination was drive a transistor from a 555 timer with the two keyboard matrix pins on the collector and emitter, unfortunately the potential between them is only 1.5dcv and the 2n3906 I have in my kit doesn't seem to work. Is this really a transistor problem or something else?

Also, I'm not looking for a keyboard emulator, I want something to test off the shelf keyboards. Any other ideas are welcome.

UPDATE/EDIT:

So I went out and got a NTE133, I was told it was the equiv to the BS138. The drain to source resistance was about 7Mohm and even when the 555 was off the signal from the keyboard went though. Did I get a dud? Schematic below 2hz, Picture below. I'm doing destructive testing on keyboards to measure timing, that's why I don't want to use the arduinos to simulate one.

schematic

simulate this circuit – Schematic created using CircuitLab

That PCB to the right is from the keyboard

Closeup of transistor

\$\endgroup\$
  • 6
    \$\begingroup\$ Keyboards are designed to be typed on by humans. This influences the rate at which the keys are scanned. The fastest typist in the world can type maybe 20 characters per second. Even with a 5X margin, there would not be much point in designing the keyboard logic to scan at faster than say 100 Hz. The key scan rate will likely limit the output rate that you can generate by electronically emulating a key press. You could probably detect the actual scan rate of a given keyboard by using a scope to probe the repetition rate of the signals driving the switch matrix. \$\endgroup\$ – crj11 Sep 3 at 0:55
  • 1
    \$\begingroup\$ Details about the keyboards you are testing would be nice to have. And where and how you intend on connecting up for the testing. With enough information provided, I suspect a useful answer may happen. \$\endgroup\$ – jonk Sep 3 at 1:34
  • 1
    \$\begingroup\$ The keyboard scanner may also use a debounce of several milliseconds. If so this will eliminate any chance of success above a certain frequency. \$\endgroup\$ – Transistor Sep 3 at 6:23
  • \$\begingroup\$ Keyboard scanning interval of the original PC keyboards was 3 ms, as I recall. I imagine clones will have stuck to that, they usually do with PC stuff. \$\endgroup\$ – TonyM Sep 3 at 10:16
3
\$\begingroup\$

Realistically the only way to achieve maximum rate is to simulate it in the keyboard implementation directly, alternating the state on each poll by the USB host. Likely the limit is going to be 500 Hz, ie, change state on each millisecond polling, but perhaps there is a way to send multiple key events per poll, you will have to study the HID keyboard spec.

Thus to really achieve your goal, you want to find an MCU eval board with native USB and a USB keyboard example project, and "hack" it to do this. An Arduino Leonardo, various "Teensy" and some MBED boards may have this capability.

Electrically "pressing" keys on an existing keyboard implementation would have to be a lot slower (or else queued by exfiltrating a timing trigger somehow) to avoid things like severe slowness of actual change resulting from mistaken matchups between intervals.

You may be able to do faster still by faking things in software from the hosting OS driver side...

\$\endgroup\$
2
\$\begingroup\$

A logic-level FET like a BSS138 would work for this. That said, the keyboard scanning probably has an upper limit to how quickly it will accept key presses. Try 10Hz or less.

\$\endgroup\$
0
\$\begingroup\$

I got it working by outputting the 555 timer through the 1k resistor to the higher voltage side of the matrix and putting the lower voltage side to ground, now the 555 acts as a sink. No transistor needed. Thanks for all the input!

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