0

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.

Toromak
  • 3
  • 1
  • 2

2 Answers2

2

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.

mpflaga
  • 2,523
  • 14
  • 13
1

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.

Ignacio Vazquez-Abrams
  • 17,733
  • 1
  • 28
  • 32