Capturing Keyboard press on a Leonardo / ATmega32u4 board.

Hi am trying to create a device that will capture keyboard presses and then send along those presses to multiple pro micro's that are onnected via usb to PCs. The end goal is I can type on multiple computers at the same time. I have found several project that do this, essentially keyloggers, and I have attempted to modify the code to send keystrokes as I've describe however I am having issues with sending function keys. I think I'm a bit out of my depth as I am very green on programming and I think I need to start with some basics before I jump into the deep end of the pool so to speak. Does anyone have any good suggestion that I can start with for resources on a project like this. I believe I have all the hardware necessary, i have a usb host shield, leonardo and several pro micros. I understand the basics of sending strings or data over the tx port on the leonardo and reading the serial1 on the pro micro and printing those strings to my end pc or pcs but I can't figure out how to start capturing keystrokes off a keyboard. As I linked below there is one fully functioning project that does many of the things that i need and despite my ignorance I have managed to modify it that most keystrokes are sent to my pro micro boards but the program is designed to capture any of the modifier keys or function as text instead of an actual keypress in a logfile, where as I am not interested in any of the more nefarious aspects of this project (not using a esp8266 or any wifi device), just actually passing those keystrokes on like actual key presses. The program does do this over the embedded micro usb port, however I don't understand how to send that information over serial1 correctly. If any one has any suggestion on where I should start, it would be greatly appreciated. I have tried looking for tutorials but I am feeling a bit overwhelmed and having trouble finding anything.

https://github.com/spacehuhn/wifi_keylogger/blob/master/esp8266_saveSerial/esp8266_saveSerial.ino

Maybe it's best to start with a firm grasp of the hardware: The PC keyboard

Thanks for this info definitely learned a few things about the keyboard. Would you have any recommendations on resources on how to start working with that data on the arduino? I have a feeling I will need to learn more about the usb host shield libraries, im just not quite sure where to start.

Would you have any recommendations on resources on how to start working with that data on the arduino?

Sorry to say, no. But,I don’t think you’d have to manipulate the data much, if at all, just echo it straight through to the USB output port that is the keyboard source for the PC.

I have a feeling I will need to learn more about the usb host shield libraries, im just not quite sure where to start.

I believe there is a way to completely avoid that pain. Ditch the modern day USB based keyboard and find a keyboard that is pre-USB. Just one generation back, the type with the mini-din connector. They are the same serial interface as the originals and should be easier to find. Then, you can bring that directly into Arduino without the extra hassle of USB. There are tons of stuff out there for that, I’d start with Paul Stoffregen’s code (first link).

https://www.pjrc.com/teensy/td_libs_PS2Keyboard.html

and there are many links here, under “Keyboard/Keypads”

http://playground.arduino.cc/Main/InterfacingWithHardware#Input

with this one being interesting from a test standpoint:

http://codeandlife.com/2013/07/15/arduino-ps2-keyboard-tester/

If you go the PS/2 keyboard route, you can find sockets for cheap on eBay (~$1) like this:

PS2 kbd.png

and while these look like they may suit your purposes since they do serial, parallel and I2C, avoid them because they don’t emit standard keyboard scan codes.

PS2 Interface.png

Cool, thanks for the info. You are the second person to recommend the PS/2 keyboard so it sounds like im going to avoid some serious trouble if I just go that route rather than mess with usb.