USB device to forward keystrokes and mouse from computer to another

Hi all, I am new here, thanks for this great commnunity!

I want to create a very simple device that forwards keystrokes and trackpad gestures from one computer to another.

So I want to connect a macbook to this device, and this device to a mac mini. These 2 connections via USB-C.

That would allow me to use my laptop's computer on a mac mini, instead of buying a separate keyboard.

I realize doing all trackpad gestures might be too hard, but at least the mouse movement and click would be great.

Can you provide guidance as to whether that's possible, and where I should start? I know nothing at all, so don't worry about over-explaining :sweat_smile:

Thank you!

Do you know about ssh or better RealVNC?
As far as your solution, you want to place an arduino between a Macbook and a Mac Mini. Can you draw me the Arduino and the cables to connect both Mac's?

2 Likes

It appears not doable. With care you can get a keystroke through but very slowly making it not usable.

Yes, I am familiar with software solutions. But for this specific case, I want very strong separation (and lower latency) between the 2 computers.

MacBook (USB-C)
|
| USB-C cable
v
[ Arduino device ]
|
| USB-C cable (keyboard output)
v
Mac mini (USB-C)

From the mac mini, the Arduino device looks like A HID device (keyboard + mouse).

Oh, that's too bad. Can you please elaborate a bit more about why it's not possible, or at least how you figured that out?

First of all the Arduino only has 1 USB device. I searched the answers to the others that asked and even offered $$$ to do this. I use RealVNC to connect my Mac to a Win box or Pi or Ubuntu. I have never encountered a slowness. My seperation is more, it uses WiFi, no physical connections.
Here is the reference from an Arduino rep LINK

The RelayKeys project implements something similar but I think is designed for Windows. The intended use is for complex communication devices for disabled users. But the Arduino device doing the heavy lifting is relaying USB HID keyboard and mouse from a Win PC to a different device via BLE HID. The target device only needs to support BLE HID so could be Mac, iPhone, Android, etc.

The other important piece is the Mac app that captures raw keyboard and mouse input then writes HID out to the Arduino board.

There is nothing simple here so I would just use RealVNC.

1 Like

Thanks a lot for the pointer.

Would you be able to give me a sense of how hard the arduino (hardware + software) part is? I am comfortable with the software on either computer, but I am trying to evaluate how much time it would take me to code the firmware for the arduino, to make sure I am not going down on a too difficult rabbit hole.

Thank you for that, it is useful.

I always get worried when I see 'firmware' in the Arduino context. The permanent firmware is not what you are creating. If you want to call the output of your sketch being compiled, linked, etc firmware ok, but it isn't the same. When you erase your sketch on the board so to speak, the firmware remains.

You might able to use the Arduino source code from the RelayKeys project as-is or as a way to gauge difficulty based on, for example, number of lines of code. The nRF52840 version is only about 1000 lines of code.

Both Arduino programs implement the following AT command set to control the BLE stack.

Adafruit nRF52840 board version

Hardware: Adafruit nRF52840 Express, ItsyBitsy, or compatible board

ESP32 board version

This implementation provides the same AT command interface as the nRF52840
version but uses ESP32 BLE libraries and capabilities.

Hardware: ESP32 development board (ESP32-WROOM, ESP32-S3, etc.)

1 Like

Ok, thanks for the explanation.