Arduino USB HID Keyboard
Turn your Arduino UNO into a USB HID keyboard, and make buttons that do whatever you want. Make it a useful tool, with new buttons for Cut/Copy/Paste or Volume+/Volume-/Mute, or annoy your friends and colleagues by setting the keyboard to perform random keypress after random delays!
The USB HID keyboard conforms to the standard USB specification, so is functional on all modern operating systems. All this is made possible by the use of the Arduino Device Firmware Update (DFU) function.
Arduino Device Firmware Update (DFU)
The Atmega8U2 chip on the Arduino UNO can be programmed directly using the special USB protocol called Device Firmware Update (DFU). This is completely independant of the ‘normal’ method of flashing sketches to the board using the Arduino IDE.
This process is normally used to update the firmware to a more recent version, as explained in the offical Arduino guide, Updating the Atmega8U2 on an Uno or Mega2560 using DFU. Note: If your board is NOT an Arduino UNO SMD you’ll need to solder a 10k resistor (Brown-black-orange) at the back of your board as shown on the Arduino site.
However, in addition to the ability to flash standard USB Serial firmwares, we can also flash alternative firmwares as well. This allows the device to be recognized as many other device types, including keyboard, mouse, joystick, midi device, etc. This is made possible in part to the wonderful open source LUFA (Lightweight USB Framework for AVRs) USB stack, and keyboard HID firmware from Darran.
In this demonstration, we will flash generic USB HID keyboard firmware. The USB HID protocol provides manufactures the generic specifications to interact with nearly every operating system in existence. For more info, check out the USB HID Spec sheet.
Before you start, install the required packages. On Ubuntu and Debain systems, in a terminal run:
sudo apt-get install dfu-programmer dfu-util
For Windows and Mac instructions to install the dfu-programmer tool, consult the official Arduino DFU documentation.
Then download these two firmware files:
The first step is to make sure you are able to flash the standard arduino firmware. This will confirm that the programmer and the environment are both functional. NOTE: There is no chance of ‘bricking’ the device using this method. The Arduino bootloader firmware can always be updated using the DFU protocol!
sudo dfu-programmer at90usb82 erase sudo dfu-programmer at90usb82 flash --debug 1 Arduino-usbserial.hex sudo dfu-programmer at90usb82 reset
Plug cycle the Arduino, then open the Arduino IDE and ensure that you can still upload a sketch. Assuming everything flashes normally, we can move forward with flashing the HID keyboard firmware.
sudo dfu-programmer at90usb82 erase sudo dfu-programmer at90usb82 flash --debug 1 Arduino-keyboard-0.3.hex sudo dfu-programmer at90usb82 reset
NOTE: The Arduino can only be flashed with skectches through the Adruino IDE if the Arduino-usbserial.hex bootloader is active. So, to develop a USB HID device, the process becomes:
Flash Arduino-usbserial.hex bootloader with dfu-programmer (erase/flash/reset)
Plug cycle the Arduino
Flash firmware sketch using Arduino IDE
Plug cycle the Arduino
Flash Arduino-keyboard-0.3.hex bootloader with dfu-programmer (erase/flash/reset)
Test and repeat
Now that you understand how the process works, you can try out some of these keyboard samples. The easiest example is the random keypress with random delays, since it doesn’t require any components connected to the Arduino.
Random Key/Random Delay
The following two examples both use three buttons connected to the Arduino. The code can easily be changed to make the buttons perform other actions, by consulting the mapping tables in the USB HID documentation. Here is a diagram of the circuit, (created with Fritzing):
Volume+/Volume-/Mute
Cut/Copy/Paste
Pingback: Arduino USB HID Keyboard | Arduino Passion()
Pingback: Using an Arduino board as a USB keyboard « freetronicsblog()
Pingback: MAKE | USB Keyboard Support with the Arduino Uno()
Pingback: hello world » Blog Archive » Arduino를 키보드로 사용()
Pingback: USB Keyboard Support with the Arduino Uno / Cooking Hacks Blog()
Pingback: USB Keyboard Support with the Arduino Uno()
Pingback: Arduino Uno as USB HID keyboard – Part 1 | Doodling With Electrons()
Pingback: Arduino USB HID Keyboard -- Arduino Passion()
Pingback: L’heure du barbu – podcast Audio – le pilote… « La Grotte Du Barbu()
Pingback: Creating a Pinball Game Controller | Fun with DC Circuits (and phones, and robots …)()
Pingback: Arduino | MuuTTa()
Pingback: Arduino and servos | santerifriman()
Pingback: Transponder XPNDR()
Pingback: Nate Beck | Arduino HID Keyboard and the World of Warcraft auto jumper.()
Pingback: Arduino Uno as a USB HID Interface – Signals()
Pingback: Arduino Uno as a USB HID Interface – goto;()
Pingback: Choosing an Arduino board | Rodolfo's Blog()
Pingback: Choosing an Arduino board (for this project) | Rodolfo's Blog()
Pingback: HID | wer bastelt mit?()
Pingback: Flashing your Arduino’s firmware (Part 2)Dan's Landing | Dan's Landing()
Pingback: Arduino jako klávesnice a myš | Arduino.cz()
Pingback: Flashing your Arduino’s firmware (Part 2) | Laboratorium()
Pingback: Turning an Arduino into a USB keyboard | Hackaday()
Pingback: Arduino as USB HID | CL-UAT()
Pingback: How to press and hold many keys with arduino uno + Keyboard usb firmware? | DL-UAT()
Pingback: How to use an Arduino Uno + Keyboard Firmware to make a "N Key Rollover" Game Pad | DL-UAT()
Pingback: [ASK] arduino - Possible to create IP-to-USB HID (keyboard) device using Arduino? | Some Piece of Information()
Pingback: Journal #5 2017-03-09 – takeshismith()
Pingback: Flashing your Arduino's firmware (Part 2) | | Dan's Landing()
Pingback: system programming project idea [on hold] – program faq()
Pingback: A10 Shortcut Keyboard for Designers – HCDE 451 Process Blog()
Pingback: tutorial pdf Keyboard MPK88 Akai – Akai Professional MPK88 Keyboard and USB MIDI Controller()
Pingback: Keyboard MPK88 Akai website coupons December – Akai Professional MPK88 Keyboard and USB MIDI Controller()
Pingback: buy MPK88 Keyboard price new – Akai Professional MPK88 Keyboard and USB MIDI Controller()
Pingback: MPK88 Akai cost best buy – Akai Professional MPK88 Keyboard and USB MIDI Controller()
Pingback: buy MPK88 Keyboard Akai discount – Akai Professional MPK88 Keyboard and USB MIDI Controller()
Pingback: Akai MPK88 warranty by serial number – Akai Professional MPK88 Keyboard and USB MIDI Controller()
Pingback: Using Arduino as a USB HID / Jonathan Ihlein()
Pingback: Arduino Project Tutorial: Macro Keyboard – Miftah Steven Code()
Pingback: Arduino USB HID Keyboard – 不分享空間()
Pingback: Arduino USB HID Keyboard – MitchTech – PCA2Z()
Pingback: Riding Through Walls: Google Street View Stationary Bike Interface -()
Pingback: Arduino 作为 USB HID – Step开发问答()
Pingback: Подключение кнопки в качестве USB-входа ПК через Arduino()
Pingback: Possible to create IP-to-USB HID (keyboard) device using Arduino? ~ Arduino ~ InsideDarkWeb.com()
Pingback: Plug and Play Arcade Buttons -()
Pingback: Plug and Play Arcade Buttons – My Blog()