Advice wanted for remote HID keyboard / mouse project


I’m working on a project that will allow a program running on a Windows computer send keystrokes to a second Windows computer. I made a prototype with a USB null modem cable (Startech NMC-2.5) with software writing to the serial port on the first computer and a program reading instructions from the serial port and converting instructions into Keystrokes on the second. I would now like to move the code running on the second computer to an single board computer emulating a HID keyboard/mouse.

I am aware that Arduino Leonardo has a HID library, but not sure how I can get the data into it or how limited the HID library is. Can it read data from a USB male connector and write to a second configured as a HID device? Can it send discrete key up/down actions or is it limited to keypress events.

The Teensy 3.6 has two USB connectors. Is it possible to have one emulate eg a USB serial port or similar and the second emulate a HID mouse so that I can have a program reading instructions from the serial port and sending keystrokes to the second computer? Is serial port the best protocol to get the data in, or is a protocol like I2C simpler?

I’d be grateful for any advice on hardware or suitable libraries.


A loooong time ago when the Leonardo was fairly new I had a mess around with one with a USB host shield on top and made a KVM switch type set up that could host a mouse and run a keyboard (keyboard ended up being tactile switch/diode based).

The mouse worked quite well and I believe there was a fairly easy to use library for HID mouse support. I’ll have a look for the libraries I used.