Using an Arduino as an HID

step01_a

Arduino’s are the Swiss Army knife if nerds and hardware hackers. They’re extremely versatile, and this article is going to show you a little hack on how to make them even more versatile. Here’s the problem: the most widely used Arduino is the Arduino Uno and by default it does not have the ability to emulate a keyboard or inject keystrokes. This ability is reserved for the Arduino Leonardo, which is an extra purchase. So here’s how you can convert an Arduino Uno into a keyboard emulator. This guide is based on a similar write up by Kevin DeMarco.

  1. Take the Arduino Uno and place a jumper (like the ones you find on old hard drives) on the Reset and Ground pins as shown in the picture to the left.
  2. Plug the Arduino into your computer via USB wait a few seconds (for the lights to flash on) and then remove the jumper. This puts the Arduino in reset mode.
  3. Now on your computer (assuming linux), open up a terminal and run these commands
    1. Update apt-get
      sudo apt-get update
    2. Install the DFU program
      sudo apt-get install dfu-programmer
    3. Download and unzip the firmware we’ll need for this project. This zip file contains two hex files: Arduino-keyboard-0.3.hex and Arduino-usbserial-uno.hex
      wget http://www.tinkernut.com/demos/arduino_hid/arduino_hid.zip
      unzip arduino_hid.zip
    4. Use the DFU programmer to erase the chip, upload a new firmware, and reset the chip. For this example, we will just upload an Atmega16u2 version of the USB firmware.
      sudo dfu-programmer atmega16u2 erase
      sudo dfu-programmer atmega16u2 flash --debug 1 Arduino-usbserial-uno.hex
      sudo dfu-programmer atmega16u2 reset
    5. With the new firmware uploaded, you now have to power-cycle the Arduino. You can do this by simply unplugging it and plugging it back in.
    6. We now know how to flash the firmware, so now we need to make it act like a keyboard. So the first thing we need to do is write a simple program for the Arduino that sends keystrokes to the serial console. How we send a keystroke? By using this list of HID keyboard codes to find the character you want to send. Below is the sample code provided by Kevin DeMarco/* Arduino USB HID Keyboard Demo
      * Random Key/Random Delay
      */
      uint8_t buf[8] = {
      0 }; /* Keyboard report buffer */void setup()
      {
      Serial.begin(9600);
      randomSeed(analogRead(0));
      delay(200);
      }void loop()
      {
      delay(5000);

      buf[0] = 0;
      buf[2] = 0x15; // letter R
      Serial.write(buf, 8);
      releaseKey();
      }

      void releaseKey()
      {
      buf[0] = 0;
      buf[2] = 0;
      Serial.write(buf, 8); // Release key
      }

    7. Check this code for errors and then upload it to the Arduino. Now all that’s left to do is follow the same steps as in steps 2 and 3 to upload the Arduino Keyboard firmware. Briefly, here are the steps:
      1. Unplug the Arduino from the computer
      2. Place the hard drive jumper on the Ground and Reset pins.
      3. Plug the Arduino back into the computer so that it powers on
      4. Remove the hard drive jumper
      5. In your computer terminal, execute these commands to upload the Arduino Keyboard firmware
        sudo dfu-programmer atmega16u2 erase
        sudo dfu-programmer atmega16u2 flash --debug 1 Arduino-keyboard-0.3.hex
        sudo dfu-programmer atmega16u2 reset
      6. Power cycle the Arduino by unplugging it and plugging it back in.
    8. With your Arduino reconnected, open up a text editor, and you should see the letter “R” being typed (or whichever letter you chose). You’ve successfully emulated a keyboard with your Arduino!

I Saw The Sign…And It Opened Up My Eyes!

We have new Splat Space signage! If you’re wandering around 800 N Mangum street on a Tuesday evening, keep an eye peeled for this beautiful bits of tastiness! Feel free to be drawn into their soothing RGB tones and allow them to lead you to the illustrious home from which they were created! Special thanks to Jeff Crews for his hard work and artistry!

New 3D Printing Station!

3dprintstationSplatSpace has won a new 3D printer and with it comes a new 3D printing station! As you can see it’s a simple setup for all your basic 3D printing needs! Come by and check it out and see some test prints at the open meeting tomorrow (Tuesday) at 7:15pm! Special thanks to Sarah Stack for the photo and for helping get this set up.

Happy Arduino Day!

Arduino-Day-2015If you’re not familiar with the glorious technology that is an Arduino, then let me sum up by saying this: it allows you to control the world! Well, at least it allows you to control almost any other technology from your computer. In essence, it’s a gateway drug to microchip programming and today is it’s very special Arduino day! We here at the space love Arduinos. So take a moment to watch the awesome Arduino documentary embeded below, and if you want more, then check out some cool projects that involve Arduinos! <3


Arduino The Documentary (2010) English HD from gnd on Vimeo.

3D Printed Violin!

Like new age tech? Like music? Like Mike? I’d like to be like Mike. At the last open meeting, Bill Culverhouse, our own 3D printing extraordinaire, showed off his custom 3D printed violin! The body of it was generated entirely by a 3D printer with normal violin strings and a bow. He was able to connect it up to an amp and bust out tasty rendition of Twinkle Twinkle Little Star. Here you’ll see a couple pics, and hopefully a video will be soon to come!

violin01 violin02