Random Nerd Tutorials

Gesture Slider Swiper with Arduino

This project was written by Emmanuel Odunlade and edited by Rui Santos.


In this post you’re going to learn how to set an Arduino UNO board as a USB HID keyboard and use gestures to swipe slides during a presentation.

How it works

Here’s a figure that describes exactly how everything works together:

If you like Arduino projects and you want to build more, we recommend getting the Arduino Step-by-step Projects – Build 25 Projects course.

Arduino UNO or Mega as a USB HID keyboard

The Arduino can be configured to emulate a keyboard and perform useful tasks. Attaching a pushbutton to an Arduino digital pin and with a button press, you can write a password, copy+paste, up/down volume, up/down screen brightness, etc…

Although boards like the Arduino UNO can’t do this by default if you flash a new bootloader, you can make the Arduino UNO board turn into a USB HID keyboard.

An Arduino Uno/Mega has two microcontrollers: ATmega328 and 16u2. The 16u2 is normally used for USB to Serial communication. We can also use it as standalone AVR Microcontroller with (or without) USB functions as well.

HoodLoader2 gives you the option to reprogram the 16u2 of a normal Arduino Uno/Mega R3 with custom sketches. This means you can use the 16u2 as a normal USB AVR like an Arduino Leonardo board. You have a full compatible USB-HID core.

You can prepare your Arduino UNO or Arduino Mega to act as a keyboard with the HoodLoader2 bootloader by following the instructions in their official Wiki page.

Supported Arduino boards using Arduino IDE 1.6.7 or higher:

  • Uno (needs HoodLoader2 bootloader)
  • Mega (needs HoodLoader2 bootloader)
  • Leonardo
  • (Pro) Micro

Parts required

Here’s a complete list of the components you need for this project:


You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!

Uploading code

To use your Arduino as a keyboard, you need to install the HID Library.

Installing the HID Library

  1. Click here to download the HID library. You should have a .zip folder in your Downloads folder
  2. Unzip the .zip folder and you should get HID-master folder
  3. Rename your folder from HID-master to HID
  4. Move the HID folder to your Arduino IDE installation libraries folder
  5. Finally, re-open your Arduino IDE

Copy the following code to your Arduino IDE and upload it to your Arduino board:


Wire your circuit accordingly to the schematic below:

Now, if you move a hand in front of the left ultrasonic sensor, your Arduino sends a Left keyboard command resulting in moving the presentation to the previous slide.

Wrapping up

I have always been fascinated by natural user interfaces, the idea of things like the sixth sense (which I hope to share a tutorial on someday) and generally all things that makes telekinesis look like a possibility.

Thus I believe there are several updates that could be made to this project. Instead of using ultrasonic sensors and controlling sides what if we attached an Electroencephalogram (EEG) headset and then do more complex stuff like draw shapes and achieve all this within the simplicity frame the Arduino provides.

So the possibilities are endless. Hack it up!

MicroPython Programming with ESP32/ESP8266 eBook

Learn how to program the ESP boards with MicroPython, including projects, tips, and tricks! The registrations are open for a limited time, so SIGN UP NOW »

Recommended Resources

Home Automation using ESP8266 »
Build IoT projects and home automation gadgets with the ESP8266 Wi-Fi module.

Build a Home Automation System »
Learn how to build a automation system using open-source hardware and software from scratch.

Arduino Step-by-Step Projects »
Build 25 cool Arduino projects with our course even with no prior experience!

Leave a Comment:

Add Your Reply

⏰ Registrations are open for "MicroPython Programming with ESP32 and ESP8266" eBook