I had an idea to create a control panel using an arduino and some buttons. How would I go about making the arduino emulate an input device so that when I press a button connected to the arduino, it would cause the same effect as when a keyboard key was pressed? (I'm using arduino UNO, if it helps.)

Thanks in advance.

  • Welcome to Arduino SE! This post was closed as a duplicate of this question: arduino.stackexchange.com/questions/991/…. If you feel that this question is different, please feel free to edit your question. Thanks! Dec 31, 2014 at 21:40
  • I don't agree that this is a duplicate. That question asks whether or not it can be done in a specific way, whereas this question asks in general, only mentions the Uno in passing (and not even the R3 specifically), and doesn't bring up the '16U2 at all. Jan 1, 2015 at 1:38

2 Answers 2


The easy answer is to use a Leonardo, Micro, or Due instead. They already support USB HID functionality via Mouse and Keyboard.

If you insist on using an Uno R3 then you will need to reprogram the on-board ATmega16U2 to accept serial commands from the ATmega328P and generate the appropriate USB HID events.

If you're using an Uno or clone that doesn't have an ATmega16U2 as well then you're SOL and will have to write a program that runs on the computer that receives the commands via serial and translates them into HID events.


I have successfully reprogrammed the UNO's R3 8U2 to support keyboard emulation, as to just this. Making dedicated user inputs for kiosks to Computers. I recommend NicoHood's GitHub as it allows simultaneous Arduino Bootloader and Keyboard functionality, making it easy to reprogram the Arduino.

This along with using Capacitive Touch Sensor connected to Copper tap under clear acrylic protecting printed graphics of buttons is very quick and easy to make. Very little machining.

Example of such code is found at artemis-firmwares it was initially created with a different 8U2 method. Where next time we will use NicoHood's.

Note the stock keyboard send key command for the Arduino is limited. Where the above methods allows the code to send complete virtual keys supporting full emulation.

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