not entirely sure this is the best StackExchange board but I bet some of the great members here could at least point me in the right direction.

I'm looking to use one of the microcomputer devices, like a Raspberry Pi, Arduino, etc as macro keyboard.

What I need to do is plug the device into a Mac via USB and have it be seen as a Keyboard and Mouse. I'd then like to trigger scripts which allow the device to send keyboard presses with specific games between in the correct order.

The device itself needs to be what runs these scripts are it's operating on computers where the OS isn't built yet - it's just automating the initial human interaction we need to do now to create the first account and click through all the menus.

First of all does anyone have a suggestion for which device can be seen as a Human HID and appear to the computer as both a keyboard and mouse (as unfortunately I need two mouse clicks to complete the script) and does anyone know of the software I can run to automate the inputs with pauses etc.

Finally it would be ideal if once the computer is booted I can send a signal back to the device to trigger the next script (I will have loaded a script on the computer at this point to run software) if it could tell the device when it's finished and load a second script that would be ideal.

Look forward to suggestions, thanks in advance.

  • 1
    \$\begingroup\$ See arduino.stackexchange.com/questions/484/arduino-as-usb-hid \$\endgroup\$
    – pjc50
    Commented Dec 20, 2018 at 16:24
  • 1
    \$\begingroup\$ There are probably better ways of customizing the setup of a lot of computers, what you are describing sounds hard to get right and fragile against minor software changes, especially because it seems like you are trying to do it without any feedback from the system or display state. \$\endgroup\$ Commented Dec 20, 2018 at 18:57
  • \$\begingroup\$ @ChrisStratton yeah it's not ideal, but it's the only way possible now with the T2 chips in all the new Macs. It's better than doing it all by hand each time. \$\endgroup\$ Commented Dec 21, 2018 at 14:00

1 Answer 1


What you need here is a device that can act as a USB HID-class (human interface device) device.

A Raspberry Pi is not well suited to operate as a USB device. It's possible by way of the kernel's USB gadget support, but it's not ideal.

A better option will be one of the ATmega32U4-based Arduinos, like the Arduino Leonardo or Arduino Micro. The Arduino framework includes Keyboard and Mouse classes specifically for this sort of application.

  • \$\begingroup\$ Thanks, that's the place I'll go down, is there any difference between the Leonardo and the Micro? \$\endgroup\$ Commented Dec 21, 2018 at 14:01
  • \$\begingroup\$ Size, primarily. And the Leonardo is (physically) compatible with some Arduino addon "shields" which won't fit onto the Micro. Same microcontroller, though. \$\endgroup\$
    – user39382
    Commented Dec 21, 2018 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.