Bring enhanced HID functions to your Arduino!
Find a file
2014-06-03 18:32:10 +02:00
examples Release 1.0 2014-06-03 17:10:40 +02:00
Firmwares updated driver location 2014-06-03 18:32:10 +02:00
Hoodloader updated driver location 2014-06-03 18:32:10 +02:00
lufa-LUFA-140302 Lufa upload 2014-06-03 17:24:57 +02:00
DFU_Bridge.JPG Lufa upload 2014-06-03 17:24:57 +02:00
Flip_1.PNG Release 1.0 2014-06-03 17:10:40 +02:00
Flip_2.PNG Release 1.0 2014-06-03 17:10:40 +02:00
Flip_3.PNG Release 1.0 2014-06-03 17:10:40 +02:00
HID.cpp Release 1.0 2014-06-03 17:10:40 +02:00
HID.h Release 1.0 2014-06-03 17:10:40 +02:00
HID_Reports.h Release 1.0 2014-06-03 17:10:40 +02:00
keywords.txt Release 1.0 2014-06-03 17:10:40 +02:00
No_HID_Bridge.JPG Lufa upload 2014-06-03 17:24:57 +02:00
Readme.md updated driver location 2014-06-03 18:32:10 +02:00

Arduino HID Project

Dont you always wanted to turn your Arduino in a Generic HID device like a Keyboard or a Gamepad? Disappointed that the Uno doesnt support this at all and the Micro/Leonardo only Mouse + Keyboard?

Introducing the Arduino HID Project that gives you everything you need for that. No need for extra hardware. You just need one of the Arduinos and an USB cable.

Main difference is that you can upload new sketches to the Uno/Mega and dont need to reflash the firmware. Before you had to upload a sketch, flash the firmware, test, flash the firmware, upload, flash again. Thats all gone!

Features

Use your Arduino Uno, Mega, Micro, Leonardo or Micro Pro as Generic HID Device and still be able to upload sketches how you are used to do. This project provides a new bootloader for the 8u2/16u2 and HID libraries Arduino Uno/Mega and Micro/Leonardo. I also corrected some bugs in the original sources.

Software includes:

  • Arduino HID Uno/Mega library
  • Arduino HID Micro/Leonardo library
  • Arduino HID Bootloader
  • NicoHoodProtocol library needed for the Uno/Mega!

The following devices are supported:

  • Keyboard (modifiers + 6 keys)
  • Mouse (5 buttons, move, wheel)
  • Media Keys (4 keys for music player)
  • System Key (for PC standby/shutdown)
  • 2 Gamepads (32 buttons, 6 16bit axis, 2 D-Pads)
  • 2 Joysticks (2 buttons, 2 10bit axis)

Projects can be found here: http://nicohood.wordpress.com/

Installation

Download the library and rename the folder. See this instruction how to install new libraries.

NicoHoodProtocol library needed for the Uno/Mega!

Always release buttons to not cause any erros. Replug USB cable to reset the values if anything went wrong. Connect GND and MOSI2 to deactivate HID function on Uno/Mega (see picture)

Arduino Uno/Mega only

To install the new bootloader connect your Arduino to your PC and put it into DFU mode. You can always switch back to the original firmware, nothing to break. See this in general and this for windows on how to upload the hex file to your Arduino. Some notes here: The Arduino R3 doesnt need a resistor or so, just connect the two pins near the USB B jack. Choose atmega16u2 for the new R3 version. For older version you need to check google.

Upload the hex file to your Arduino. It doesnt care if its a Uno/Mega/Mega ADK. It will just work the same. Unplug the Arduino if it sais successful and plug it back in. You cannot destroy anything here and you can always switch back to the original firmware. You need to install new drivers for that on Windows. Actually they are not new, its just an .inf file that tells Windows to use its built in CDC Serial driver. Ironically Microsoft never signed its own driver. Also see this tutorial on how to install the drivers.

You are ready to use the libraries. Just have a look at the examples and test it out. The libraries will work for all Arduinos listed above but it will use 2 different libraries. On Arduino/Mega you can only use baud 115200 for HID due to programming reasons. Its not bad anyways because its the fastest baud and you want fast HID recognition. You still can use any other baud for normal sketches without HID.

For Arduino Mega2560 I recommend the nightly IDE. See Issue on Github.

https://github.com/arduino/Arduino/issues/1071
http://downloads.arduino.cc/arduino-avr-toolchain-nightly-gcc-4.8.1-linux32.tgz
http://downloads.arduino.cc/arduino-avr-toolchain-nightly-gcc-4.8.1-linux64.tgz
http://downloads.arduino.cc/arduino-avr-toolchain-nightly-gcc-4.8.1-macosx.zip
http://downloads.arduino.cc/arduino-avr-toolchain-nightly-gcc-4.8.1-windows.zip

This library wouldnt be possible without

Todo

  • Micro/Leonardo library
  • Remove debug leds
  • Add more devices (even more?)
  • Add ICSP Programmer function
  • Add rumble support (very hard)
  • Add Xbox Support (too hard)
  • Add Midi Support
  • Add Report Out function (for Keyboard Leds etc)

Known Bugs

HID only works with baud 115200 because there is no "programming finished" indicator. If you dont use HID you can still choose the baud of your choice

System Wakeup is currently not working for Arduino Uno/Mega.

Not tested on the 8u2

If you get a checksum Error after Uploading please message me and send me the whole project. Same if your Arduino crashes and dont want to upload sketches anymore (Replug usb fixes this). These bugs occured while devoloping the bootloader and should be fixed. Just in case it happens again I noted it here.

Oh and by the way: I also removed some bugs from the official firmware.

Version History

1.0 Beta Release (03.06.2014)

Licence and Copyright

If you use this library for any cool project let me know!

Copyright (c) 2014 NicoHood
See the readme for credit to other people.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

For Developers

If you deactivate some reports it can occur that windows will cause problems and recognize it as different device. While developing i had that much trouble that i had to change the PID. No way to repair the broken windows driver settings. So be careful if you change the source on your own with important PIDs. Therefore uninstall the divers for any device or just dont touch the HID reports.

The Bootloader was coded with Windows7 and Visual Studio and compiled with a Raspberry Pi.

You need to install avr-gcc for compiling.

sudo apt-get install avr-gcc

To uninstall the drivers on windows you need registrar. Delete these entrys (my gamepad driver with the PID was still broken. If you know how to fix this message me):

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_03EB&PID_4E48
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_03EB&PID_4E48&MI_00
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_03EB&PID_4E48&MI_02