Turning An Arduino Into A USB Keyboard

The newly released Arduino Leonardo has a few very interesting features, most notably the ability to act as a USB keyboard and mouse thanks to the new ATmega 32U4 microcontroller. This feature isn’t exclusive to the Leonoardo, as [Michael] explains in a build he sent in – the lowly Arduino Uno can also serve as a USB HID keyboard with just a firmware update.

The Arduino Uno (and Mega) communicate to your computer through a separate ATmega8U2 microcontroller. Simply by uploading new firmware with the Arduino Device Firmware Upgrade, it’s easy to have your old Arduino board gain some of the features of newer boards such as the Teensy or Leonardo.

[Michael] goes through the steps required to make this upgrade work and ends his build by showing off an Arduinofied ‘cut, copy and paste’ button project as well as a few multimedia controls. You can check those builds out in the video after the break.

If emulating a USB keyboard isn’t your thing, it’s also possible to install LUFA firmware to emulate everything from joysticks to USB audio devices. Very cool, and very useful.



23 thoughts on “Turning An Arduino Into A USB Keyboard

  1. The new thing is that this is now possible with an ARDUINO!!!

    Previous models have used an FTDI USB chip that didn’t allow this, but some models are now using an AVR for USB communications, so with a firmware update they can.

    Come on! It’s news if it’s Arduino!

  2. Arduino is just too far behind the times, especially for the price and size. I know their thing is being slow and outdated (with a terrible pin layout) but there comes a point when it is just too much. I think it is official when a softdrink company is giving away clones, and the official Arduino clones the clone because it is better.

  3. sooo, this means that we can just update the firmware and then keep using arduino as normal? … because the on the previous examples, you needed to build a shield for it.
    With this update I would be able to use Arduino UNO as a keyboard with no shield?

  4. Im trying to learn so please dont rip me apart with my noobish stupid questions. I bought an arduino uno from china and got ripped off it has an atmega8a-pu chip in it. Im trying to figure out how to make it work as a usb hid keyboard to automatically execute a specific order of keypresses. In a nut shell what im trying for is to basically either have the arduino upload and execute a script when it is plugged into the usb, automatically.. I know autorun is disabled for the target os im gunning for. Or download a script and execute from the web. Is this possible? im not asking for someone to do the work for me but point me in the right direction as i do not know how or where to begin finding this information

  5. Arduino: 1.6.5 (Windows 8.1), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

    keyboard:61: error: redefinition of ‘uint8_t buf [8]’
    keyboard:5: error: ‘uint8_t buf [8]’ previously defined here
    keyboard:68: error: redefinition of ‘int state’
    keyboard:12: error: ‘int state’ previously defined here
    keyboard.ino: In function ‘void setup()’:
    keyboard:70: error: redefinition of ‘void setup()’
    keyboard:14: error: ‘void setup()’ previously defined here
    keyboard.ino: In function ‘void loop()’:
    keyboard:84: error: redefinition of ‘void loop()’
    keyboard:28: error: ‘void loop()’ previously defined here
    keyboard.ino: In function ‘void releaseKey()’:
    keyboard:108: error: redefinition of ‘void releaseKey()’
    keyboard:52: error: ‘void releaseKey()’ previously defined here
    redefinition of ‘uint8_t buf [8]’

    This report would have more information with
    “Show verbose output during compilation”
    enabled in File > Preferences.

  6. How do you pair this “keyboard” device to a computer over Bluetooth when the computer wants you to confirm by typing a randomly generated number on the “keyboard” device?

  7. So I found a bucket load of my old cd’s from the 90’s and a game called easy bake kitchen came out, of COURSE it has a keyboard topper controller you can’t find anymore.


    Found above picture made a reference for her short term and now working on either a flat picture board with these plans or a REALLY long winded STL build I will have to 3d print and get right. I have two arduino’s doing nothing right now so I’ll go for the picture keyboard using this.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.