• Basic: Firmware that supports keyboard+mouse interaction: left-stick -> 'wasd', right-stick -> mouse, buttons -> click, space, etc.
  • Extra: Changes modes (with switch/buttons). Suggestions: turbo, joypad, joystick acceleration optimized control, mouse inversion, sensitivity adjustment, etc.

Bringing Your Controller to Life!

In this lab, you will be running tests to make sure your hardware and joysticks are working, and you will be writing Arduino code and firmware to turn your microcontroller based video game controller into a USB keyboard mouse. Prepare your mind for plenty of controllerism, calibration, and creativity!

Your Arduino, and the Arduino IDE

Though the lab computers will have the free Arduino IDE, we highly recommend that you download it for your own computer. Download the Arduino IDE from This will allow you to write, compile, communicate over serial ports, and upload arduino code to any arduino compatible board.

Your particular board is the Arduino Micro. It has a huge advantage over previous generations of Arduino for our purposes in that it already has built in USB communication. Implementing joystick and keyboard mouse functions no longer involves overwriting the Arduino bootloader to be recognized as a USB device. That’s huge! There are some caveats with this , especially if you’re familiar with older generations of Arduino, like the UNO. Older Arduinos had two separate microprocessors to handle code, and to handle the serial link. Your Micro actually will create a virtual port for Serial communication every time you plug it in. That means resetting your board will momentarily break connection with the serial port!

For more information and specs if you so fancy, you can go to:

The Micro USB cables provided in your kit can be used to not only program the arduino, but communicate with it in real time. Just insert the USB-A plug into your computer and the USB- Micro plug into your arduino. In the arduino IDE, look under Tools > Port to find your board and select it (You may have to unplug and reinsert the cable to see which connection disappears and reappears).

Once you have written a basic sketch, hit the check button (verify) in the top left to run a test compile on your code and ensure you haven’t made any code errors. If the code passes this test, hit the right arrow button (upload) to send it to your board. Now you can check if the code actually works as planned. If needed, hit the SMD switch on your arduino to reset the program.

How to test the controller

Write a simple Arduino sketch that detects the controller button and joystick inputs states and somehow displays these states using LEDs. Open-ended, but you should be able to demonstrate with that all buttons and joystick inputs to your controller are recognized. The LEDs alone can be used to demonstrate that. For example you could have an LED increase its intensity the further to the left a joystick was moved. Extra points for creativity!

Keyboard and Mouse Powers

Now that you've got your sensors working, get ready to turn that Arduino into a USB keyboard and mouse controller! Arduino makes it easy with built in libraries and examples. Use for reference of the keyboard mouse libraries. As the online manual suggests, its recommended you create a failsafes to turn on and off mouse movement detection for ease of reprogramming the board.

Its up to you to deduce how your code will poll all your inputs and create a robust reactive system!

Open Arena Control Mapping

In the next lab, you'll be using your controllers to attempt to play and test the first person shooter OpenArena! You'll be doing exauhstive testing, so make sure your controller is optimized for success and playability! We've provided an example a list of possible configurations for controlling the game to give you an idea of how you might configure your controller. Happy optimizing!

And here's an example button mapping:

Hardware Input Suggested OpenArena Control Type of Input
L Joystick Movement Analog
R Joystick Camera Control Analog
R Joystick Zoom Digital
L Joystick Crouch Digital
R Trigger Fire Digital
L Trigger Walk Run Digital
L Button: Cycle through Weapons (L/R) Digital
R Button: Cycle through Weapons (L/R) Digital
Up Button Use Item Digital
Down Button Jump Digital
Start Button Pause Digital
Select Button Show Scores Digital

Completed Lab Reports

This lab was developed by Kirklann Lau and Richard Piersall.