Engineering Roundtable - HID and USB with Chris


Sorry for the delay in today’s post - we had uploading issues with YouTube.

In today’s edition of “Engineering Roundtable,” SparkFun Engineer Chris Taylor explores using HID and USB to create his own one-button Arduino-based keyboard. Check it out:

Vimeo version can be found here.

You can check out some of the tools/code Chris used at the following links - for the Atmel FLIP Programmer go here. For the WinAVR, which must be installed to use the FLIP programmer, go here. The ATMega8U2 Firmware by Darran can be found here and the HIDKeyboard Arduino Library is here. Lastly, check out this great tutorial by Michael for more info on creating your own HID/USB Arduino keyboard.

As always please feel free to leave any questions or comments in the comments section below. Thanks for watching!


Comments 18 comments

  • Loved it! Straight forward talking. No strange outbursts or facial gestures. Cool haircut. No backwards baseball cap. Keep it up!

    • Yes, I’ve often said of Chris that my favorite thing about him is his not being someone else.

    • Sorely tempted to make a 17:45 video of myself grimacing awkwardly into the camera while wearing a backwards baseball cap.

      • Don’t I have a lock on that? I’m going to make one just for you, Customer207.

  • Excellent video!

    Is it possible to have the 8U2 look for an input from a Human Interface Device, making it possible to use a keyboard or a mouse as an input to the arduino?

    • That is possible, but it requires the UNO to act as a USB host. Darran, the author of the HID keyboard firmware that I used in my example, has done this to create a “Passthrough” device:

      http://hunt.net.nz/users/darran/weblog/c6f35/Arduino_USB_Keyboard_Passthrough.html

  • Has anyone built something to be able to use the keyboard on a laptop as a keyboard for another computer? What additional hardware would you need?

  • Can we see what the interior of that box looks like? Doing enclosure design is one of my pet peeves, and that one didn’t have any of the problems mine always do. Specifically, how is the Uno mounted inside, how is the USB cable attached, and what did you use to drill the holes for the buttons? I built something much like this, but with 6 buttons and a couple shift keys (Mainly used it for doing work with QLab) but it was nowhere near as pretty as this one. I do like the idea of the detachable foot pedal, though.

  • Nice one Chris :).

  • ASCII Value 27 is sad for being mis-represented :(

  • This is AMAZING!!!

  • very, very nice! interesting for education, I will share it with my high school Informatics students…

  • Sweet! This weekends project is going to be the “boss pedal”. A foot pedal, that when activated will pull up a nice spreadsheet, source code, or project manager if I hear someone coming up behind me. ;)

    Oh, and it also gives me an excuse to by an Uno to replace my venerable Diecimila.

    Thanks for a great video!

  • “Hammer Smashed Face”- Excellent choice, Chris! I generally prefer to program HID’s while listening to Grave’s “You Will Never See”, but to each his own…

  • My compliments to the person who made those banners up top. I love them! And a great round table too.

  • Great tutorial, I a had no idea the USB tried to cover so many devices.

    I do have a question, and feel free to correct me if I am wrong on this. Is there an advantage in using an Arduino UNO for this when the Arduino Leonardo has core libraries to allow it to appear as a native Mouse and/or Keyboard?

    • Great question. There is no advantage to using the UNO over the Leonardo, and in fact, the Leonardo is the way I would do a keyboard/mouse HID project. It’s just easier to use the pre-programmed library. I chose to use the UNO for this video for a few different reasons. First, I wanted to show how this could be done with the UNO for the people who don’t have a Leonardo, just to show that the capability is there. Second, (I hope) that the reprogramming of the 8U2 explicitly demonstrates the change in the relationship between the device and the computer, in order to explain how USB/HID works. And third, the keyboard-serial firmware that I use on the ATMega8U2 (written by Darran) is well-written and RIPE for hacking. Even though I didn’t hack the code for the video, if I was going to write my own device firmware for a different device in the class (like a joystick), I would hack Darran’s code before I would try to dig into the built-in Leonardo libraries.

      • Here’s a sweet project for a Joystick: http://code.google.com/p/unojoy/ I used it to make a adapter for my RC transmitter to act as a joystick for racing games.


This Week

This Month

Heartbleed

Happy Arduino Day!

SXSW Create 2014