May 23, 2016

Turn Arduino Uno into keyboard

So Arduino Uno can introduce itself as a keyboard to a computer and send keystrokes to it. To do this we need to change the firmware of the ATmega16U2 chip. More on the theory here: https://www.arduino.cc/en/Hacking/DFUProgramming8U2

I'll just quickly summarize how I managed to do it.

First of all download Arduino-usbserial.hex Arduino-keyboard-0.3.hex from here: http://mitchtech.net/arduino-usb-hid-keyboard/

Connect your Arduino to the computer. Then connect the RESET EN points with a screwdriver, connect the RESET GND with a female-female wire, wait for the blinking to stop, release RESET GND, release RESET EN.
Now your ATmega16U2 is in bootloader mode (or something like that). Run the following commands from terminal:
sudo dfu-programmer atmega16u2 erase
sudo dfu-programmer atmega16u2 flash --debug 1 Arduino-usbserial-uno.hex

sudo dfu-programmer atmega16u2 reset
If the first command returns "dfu-programmer: no device present.", then either your Arduino is not in bootlader mode (disconnect/reconnect, do the RESET thing again), or your chip is not atmega16u2 (check what's written on it).

1 comment:

  1. Connect your Arduino to the computer. Then connect the RESET EN points with a screwdriver, connect the RESET GND with a female-female wire, wait for the blinking to stop, release RESET GND, release RESET EN.
    this part is not working led is not stop blinking ,Please hlp

    ReplyDelete