Add USB Game Controller To Arduino Leonardo - Micro - 9 Steps
Add USB Game Controller To Arduino Leonardo - Micro - 9 Steps
(https://cdn.instructables.com/F37/0I44/I7SVSZB6/F370I44I7SVSZB6.SMALL.jpg)
IMPORTANT NOTE: This article is for Arduino IDE version 1.6.5 (or below). To add a
USB Game Controller to an Arduino Leonardo or Micro using Arduino IDE version 1.6.6
(or above) see the following Instructable: Arduino Leonardo/Micro as Game
Controller/Joystick (https://www.instructables.com/id/Arduino-LeonardoMicro-as-
Game-ControllerJoystick/).
Out of the box the Arduino Leonardo and the Arduino Micro appear to the host
computer as a generic keyboard and mouse. This article discusses how the Arduino
Leonardo and the Arduino Micro can also appear as a generic Game Controller. This
4 p 5 ?
project will only work with Arduino products based on the ATmega32u4 microcontroller
(i.e. the Arduino Leonardo and the Arduino Micro). It will not work with the Arduino Uno,
because it is based on the ATmega328 microcontroller.
The Arduino generic Game Controller provides the following:
X, Y, and Z axis
32 buttons
X, Y, and Z axis rotation
Rudder
Throttle
2 Point of View Hat Switches
advertisement
HID.cpp (https://cdn.instructables.com/ORIG/FMT/32DG/I7SVSZL7/FMT32DGI7SVSZL7.cpp)
USBAPI.h (https://cdn.instructables.com/ORIG/F6I/CCCF/I7SVSZLA/F6ICCCFI7SVSZLA.h)
Replace these two files with the ones attached to add a generic Game Controller to the
Arduino Leonardo and the Arduino Micro.
advertisement
4 p
STEP 2: RUNNING THE TEST SKETCH 5 ?
UsbJoystickTest.ino (https://cdn.instructables.com/ORIG/FYU/T86L/I7SVT01M/FYUT86LI7SVT01M.ino)
Compile and upload the attached UsbJoystickTest.ino sketch file onto the Arduino
Leonardo or the Arduino Micro using the Arduino Software (IDE). I have tested this
using version 1.6.1 through 1.6.5 of the software. For Arduino IDE version 1.6.6 and
above, see the following Instructable: Arduino Leonardo/Micro as Game
Controller/Joystick (https://www.instructables.com/id/Arduino-LeonardoMicro-as-
Game-ControllerJoystick/).
The following steps are for Windows 7. If you have a different version of Windows or a
different operating system, these steps may differ.
(https://cdn.instructables.com/FXE/JJUQ/I7SVSZB7/FXEJJUQI7SVSZB7.SMALL.jpg)
advertisement
4 p 5 ?
(https://cdn.instructables.com/FHJ/597Y/I7SVSZBV/FHJ597YI7SVSZBV.SMALL.jpg)
(https://cdn.instructables.com/FXG/VP5D/I7SVSZB8/FXGVP5DI7SVSZB8.SMALL.jpg)
The Arduino Micro or Arduino Leonardo should appear in the list of devices.
(https://cdn.instructables.com/F2A/P3Q6/I7SVSZB9/F2AP3Q6I7SVSZB9.SMALL.jpg)
Next right mouse click on the Arduino Leonardo or Arduino Micro to display the settings menu.
Then select “Game controller settings” to get to the “Game Controllers” dialog.
The Arduino Micro or Arduino Leonardo should appear in the list of installed game
controllers. Select the Arduino Micro or Arduino Leonardo and click the Properties
button to display the game controller test dialog.
STEP 8:
(https://cdn.instructables.com/F4B/IMIB/I7SVSZB4/F4BIMIBI7SVSZB4.SMALL.jpg)
While this dialog has focus, ground pin A0 on the Arduino to activate the test script. The
test script will test the game controller functionality in the following order:
32 buttons
throttle and rudder
X and Y Axis
Z Axis
2 Hat Switches
X and Y Axis Rotation
4
STEP 9: JOYSTICK LIBRARY
p 5 ?
Now that the Arduino Leonardo or Arduino Micro has the Joystick library, the Arduino
can be used for custom game controller projects. The following describes the Joystick
library that is included in the updated USBAPI.h and HID.cpp files.
Joystick.begin(bool initAutoSendState)
Starts emulating a game controller connected to a computer. By default all methods
update the game controller state immediately. If initAutoSendState is set to false, the
Joystick.sendState method must be called to update the game controller state.
Joystick.end()
Stops the game controller emulation to a connected computer.
Joystick.setXAxis(byte value)
Sets the X axis value. Range -127 to 127 (0 is center).
Joystick.setYAxis(byte value)
Sets the Y axis value. Range -127 to 127 (0 is center).
Joystick.setZAxis(byte value)
Sets the Z axis value. Range -127 to 127 (0 is center).
Joystick.setXAxisRotation(int value)
Sets the X axis rotation value. Range 0° to 360°.
Joystick.setyAxisRotation(int value)
Sets the Y axis rotation value. Range 0° to 360°.
Joystick.setZAxisRotation(int value)
Sets the Z axis rotation value. Range 0° to 360°.
Joystick.setButton(byte button, byte value)
Sets the state of the specified button. The button is the 0-based button number (i.e.
button #1 is 0, button #2 is 1, etc.). The value is 1 if the button is pressed and 0 if the
button is released.
Joystick.pressButton(byte button)
Press the indicated button. The button is the 0-based button number (i.e. button #1 is 0,
button #2 is 1, etc.).
4 p
Joystick.releaseButton(byte button)
5 ?
Release the indicated button. The button is the 0-based button number (i.e. button #1 is
0, button #2 is 1, etc.).
Joystick.setThrottle(byte value)
Sets the throttle value. Range 0 to 255.
Joystick.setRudder(byte value)
Sets the rudder value. Range 0 to 255.
Joystick.setHatSwitch(byte hatSwitch, int value)
Sets the value of the specified hat switch. The hatSwitch is 0-based (i.e. hat switch #1
is 0 and hat switch #2 is 1). The value is from 0° to 360°, but in 45° increments. Any
value less than 45° will be rounded down (i.e. 44° is rounded down to 0°, 89° is rounded
down to 45°, etc.).
Joystick.sendState()
Sends the updated joystick state to the host computer. Only needs to be called if
AutoSendState is false (see Joystick.begin for more details).
advertisement
Download
86 Comments
(/member/SondreL1/)SondreL1 (/member/SondreL1/)
Reply
Can anybody give me some tips on how to code for 14 digital buttons? Im very new to programming and
im trying to make my first raspberry pi gameboy case. I would really apreciate a little help.
Looking forward to hear from you.
4 2017-06-30
p 5 ?
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
hi all,
just figure out the code i need for the joystick i need finally.
#include <Joystick.h>
Joystick_ Joystick(0x03, 0x04, 9, 0, true, true, false, false, false, false, false, false, false, false, false);
void setup() {
Joystick.setXAxisRange(-32767,32767);
Joystick.setYAxisRange(-32767,32767);
Joystick.begin();
}
const int pinToButtonMap = 2;
Joystick.setYAxis(yAxis);
for (int index = 0; index < 9; index++)
{
int currentButtonState = !digitalRead(index + pinToButtonMap);
if (currentButtonState != lastButtonState[index])
{
Joystick.setButton(index, currentButtonState);
lastButtonState[index] = currentButtonState;
}
}
2017-03-08
(/member/-The_Hawk-/)-The_Hawk- (/member/-The_Hawk-/)
Reply
Hi, is possible with this create a force feedback Sterring Wheel??? And witch board i can use??
2016-05-26
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
I think this library could be used as a starting point, but I have not researched this. This library
currently only supports sending Joystick data to the host machine. Force feedback devices get data
back from the host computer and act on it (e.g. making the steering wheel harder to turn).
The library I wrote should work with any ATmega32u4 - based Arduino (or clone). I have tested it with
the Arduino Leonardo and Arduino Micro. I know of others who have used it with the Arduino Due and
SparkFun Pro Micro. I know it will not work with the Arduino Uno (since it used the ATmega328P).
2016-05-27
(/member/-The_Hawk-/)-The_Hawk- (/member/-The_Hawk-/)
Reply
(/member/BorosR/)BorosR (/member/BorosR/)
Reply
2016-05-23
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
Glad it worked for you. Thanks for letting me know what Arduino you used.
2016-05-23
(/member/AnthonyM143/)AnthonyM143 (/member/AnthonyM143/)
Reply
Great library and very useful. However I have been experiencing the issue where I cannot use both the
Joystick.h and either/both Mouse.h and Keyboard.h. It seems the arduino can't be recognized as both a
game controller and an HID device. Is there any workaround that you know of?
2016-04-02
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
Can you include an example sketch file (*.ino) that demonstrates your issue? I have successfully used
Joystick.h and Keyboard.h together without issue (see https://www.instructables.com/id/Ultimate-
Classic-Game-Console-Joystick-to-USB-Adap/ (https://www.instructables.com/id/Ultimate-Classic-
Game-Console-Joystick-to-USB-Adap/) for an example of this).
2016-04-03
(/member/AnthonyM143/)AnthonyM143 (/member/AnthonyM143/)
Reply
Thanks for the response! I actually got them to work together by installing the Joystick Libraries in the
Program Files folder, not in the Documents/Arduino folder. The past day has been very productive
thanks to your code. Thanks!
2016-04-03
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
p 5 ?
(/member/MattiV/)MattiV (/member/MattiV/)
Reply
how add all my switch to ino and how read and write ???? only need all toggle/button at my flight sim
panel, start,run,accu,light,strobe, etc.
2016-03-23
(/member/MattiV/)MattiV (/member/MattiV/)
Reply
last no understand, what joystick library and were ? what need change ? and if need only max input what
can, only button/switch, toggle sw, what need change and were ?
2016-03-23
(/member/MattiV/)MattiV (/member/MattiV/)
Reply
i not understand english good but i need my new arduino micro make maximum(how many?) toggle
switch input only, how make ? (Motor and light+radio panel+audio control, whit fsuip. control ms9
simulator)
and how ? hid description, how arduino ino file ? how connect buttons ?
and second micro board need make only all (how many can?) encoders input.
if somebody can help me ?
2016-03-22
(/member/ShushanshG/)ShushanshG (/member/ShushanshG/)
Reply
I am constantly getting an error "'Joystick' was not declared in this scope." ...............plz help
2016-03-15
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
Not having the correct board selected (i.e. Arduino Micro or Arduino Leonardo) in the Arduino IDE is
usually the cause of this error.
2016-03-15
(/member/ShushanshG/)ShushanshG (/member/ShushanshG/)
Reply
I am using Arduino Uno, and I have selected this board only, so it won't work on Arduino Uno ?
2016-03-15
4 p
(/member/MatthewH/)MatthewH (/member/MatthewH/) 5 ?
Reply
This only works with the Arduino Leonardo and Arduino Micro.
2016-03-16
(/member/Valerio75/)Valerio75 (/member/Valerio75/)
Reply
X, Y, and Z axis (including rotation), 32 buttons, 2 hat switches, a throttle, and a rudder.
2016-03-06
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
Jakkul has a good example of how he used the library on his blog at
http://jakkul.blogspot.com/2015/06/sim-racing-and-game-controllers-part-2.html
(https://www.instructables.com/id/Ultimate-Classic-Game-Console-Joystick-to-USB-Adap/). His
example uses three potentiometers (connected to A0, A1, and A2). and two buttons. I have an
example at Ultimate Classic Game Console Joystick to USB Adapter
(https://www.instructables.com/id/Ultimate-Classic-Game-Console-Joystick-to-USB-Adap/) where I
show how to use the library to connect classic game controllers to a modern PC. These should get
you started.
2016-03-07
(/member/Valerio75/)Valerio75 (/member/Valerio75/)
Reply
(/member/Valerio75/)Valerio75 (/member/Valerio75/)
Reply
X, Y, and Z axis (including rotation), 32 buttons, 2 hat switches, a throttle, and a rudder.
(/member/RajatS35/)RajatS35 (/member/RajatS35/)
Reply
4 p 5 ?
is there any way to control a arduino with a quantum gamepad via usb host shield
2016-02-12
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
Theoretically yes, but I have not done anything like it. The USB Host Shield will allow the Arduino to
act as the USB Host. The library that comes with the USB Host Shield should allow you to read the
HID report. This might help: https://www.circuitsathome.com/communicating-arduino-with-hid-
devices-part-1 (https://www.circuitsathome.com/communicating-arduino-with-hid-devices-part-1)
2016-02-14
(/member/RajatS35/)RajatS35 (/member/RajatS35/)
Reply
(/member/baritonomarchetto/)baritonomarchetto (/member/baritonomarchetto/)
Reply
You have to select the Arduino Leonardo/micro board for the sketch to compile! Good to know ;)
2016-02-12
(/member/baritonomarchetto/)baritonomarchetto (/member/baritonomarchetto/)
Reply
Just noticed that I wrote in the "version <= 1.6.6 instructible, but I correctly tested the updated
library/files.
I tested both, after my first comment, but I had no success...
2016-02-12
(/member/baritonomarchetto/)baritonomarchetto (/member/baritonomarchetto/)
Reply
MattewH I am sorry but no matter what i try to do, after loading the sketch if i run a check of the
"JoystickButton" example arduino returns 'Joystick' was not declared in this scope.
I am using the 1.6.6 version of the IDE and the libraries are listed in the contributed libraries ... any hint?
2016-02-12
(/member/Jorri11/)Jorri11 (/member/Jorri11/)
Reply
Hi
4 p 5
Is it possible for me to use the joystick library, and still use "serial.print" for a different function?
I tried using the joystick.begin and .end as well as the serial .begin and .end and putting the different
code between them but i get no information in the serial monitor. The game controller buttons does still
?
work.
2016-02-07
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
This change should not affect the serial.print functions. They should work like they did before. I have
used the Serial.print function on many occasions when I was debugging projects that use the
Joystick library.
You might want to verify the baud rate on your serial monitor matches the Serial.begin function.
2016-02-10
(/member/stanv2/)stanv2 (/member/stanv2/)
Reply
Hi MatthewH,
It might be a bit dumb, but I don't know much more after you wrote an reaction about JAKKUL on my first
comment.
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
I would start simple (i.e. just try to get a single button working) and then go from there. Create a
simple sketch that reads the value of a physical button and calls the Joystick.setButton function.
Once it is written, test it out and see if it works. If it does not, you can post the code to a comment
and I (or someone else in this community) can take a look at what you have done and provide
guidance. You can find a simple button press example on the following GitHub repository:
https://github.com/MHeironimus/ArduinoJoystickLibrary/tree/master/Joystick/examples/JoystickB
utton
(https://github.com/MHeironimus/ArduinoJoystickLibrary/tree/master/Joystick/examples/JoystickB
utton)
2016-01-19
(/member/stanv2/)stanv2 (/member/stanv2/)
Reply
keeps saying:
---------------------------------------------------------------------------------------------------------
4 p
Arduino: 1.6.7 (Windows 8.1), Board:"Arduino/Genuino Micro"
5
C:\Users\Eelco\Documents\Arduino\UsbJoystick\UsbJoystick.ino:18:22: fatal error: Joystick.h: No
such file or directory
?
#include <Joystick.h>
compilation terminated.
exit status 1
-------------------------------------------------------------------------------------------------------
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
Verify you have the Joystick library installed. You should find this library in your C:\Users\<your user
name>\Documents\Arduino\libraries folder. You will know you have the library installed properly if it
appears in Arduino's Sketch -> Include Library menu.
2016-01-20
(/member/GorgeousJack/)GorgeousJack (/member/GorgeousJack/)
Reply
Hello MatthewH,
Thank you
very much for your tutorial.
We build a small customized Joystick within hours,
thanks to your description … but I still have a problem with one function.
It borders
me, that it isn’t possible to see the z-Rotation in the Arduino Micro
Properties (Preview of Joystick signals) I
also cannot use it in a game (although
the games supports this axis) … but I can’t find the error in the
HID-definition. The pointer definition seems legit.
Do you have
a clue how to fix that issue (so I can use also the z-Rotation)?
Thank you
in advance!
2016-01-16
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
What operating system are you using (e.g. Windows 7, Windows 10, Linux, etc.)?
4 p
What game are you trying to play?
5 ?
If your game has a controller configuration menu/screen, you could try to use that and see if the Z-
Axis rotation can be configure. As far as I know, the Windows Game Controller Test dialog does not
display/support the Z-Axis rotation. It should work in a game that supports a Z-Axis rotation, but I do
not have a game like that I can test it with.
2016-01-16
(/member/GorgeousJack/)GorgeousJack (/member/GorgeousJack/)
Reply
Hello MatthewH,
thanks for
the fast reply. I’m using Win 10, but I also noticed the same issue on Win 7. The
only reason I come up with that is that I already saw another Demo implementation where the Z-
Rotation was displayed in the Game Controller Test dialog (see
https://www.pjrc.com/teensy/td_joystick.html (https://www.pjrc.com/teensy/td_joystick.html)).
But I cannot
see the difference between the two definitions.
However you saved me a lot of time with your detailed tutorial ^^. Thanks again!
If I find
some solution I’ll inform you too.
2016-01-17
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
There are various tutorials out there on the web for creating your own Report Descriptors. Here are a
few I have come across:
http://eleccelerator.com/tutorial-about-usb-hid-re... (http://eleccelerator.com/tutorial-about-usb-hid-
report-descriptors/)
http://hamaluik.com/posts/making-a-custom-teensy3-... (http://hamaluik.com/posts/making-a-
custom-teensy3-hid-joystick/)
http://www.usb.org/developers/hidpage/ (http://www.usb.org/developers/hidpage/)
2016-01-18
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
I see from your link that someone got a Z-Axis Rotation working. Unfortunately I am very busy right
now, otherwise I would try to solve that issue for you, but I will give you an idea of something can try:
I noticed on the Test Dialog shown on the link you provided, their joystick had fewer features than the
one provided in this Instructable. I would try simplifying the Joystick Definition to only include the
items you absolutely need. This will probably be easier to do using the instructions provided in the
Arduino Leonardo/Micro as Game Controller/Joystick (https://www.instructables.com/id/Arduino-
4 p 5 ?
LeonardoMicro-as-Game-ControllerJoystick/) Instructable, but it can be done by modifying the
HID.cpp and USBAPI.h file provided in this Instructable. The main thing you will need to change is the
_hidReportDescriptor, defined in the HID.cpp file (or the Joystick.cpp if you are using Arduino 1.6.6).
You will also need to update the data array in the Joystick_::sendState function to match the new
structure you define in the _hidReportDescriptor.
Good luck.
2016-01-18
(/member/stanv2/)stanv2 (/member/stanv2/)
Reply
Dear MatthewH,
Everything was going good untill I came at step 9. Because I am new to arduino's and programming,I was
trying to understand how step 9 works, But I couldn't.
My goal is to get as much pushbuttons connected including the X, Y and Z axis (for gas, brake and a
streer).
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
(/member/Bal%C3%A1zsK5/)BalázsK5 (/member/Bal%C3%A1zsK5/)
Reply
Hello!
I'm using IDE 1.6.5 with Sparkfun's pro micro 3.3V.
I'm stuck here:
______________________________________________________________
#include "HID.h"
compilation terminated.
______________________________________________________________
4 What's wrong?
2015-12-23 p 5 ?
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
Verify you have the correct board selected (e.g. Arduino/Genuino Micro) in the Arduino IDE's Tools ->
Board menu.
If that does not fix the issue, I would recommend upgrading to the Arduino 1.6.6 IDE and follow the
steps on the "Arduino Leonardo/Micro as Game Controller/Joystick" instructable
(https://www.instructables.com/id/Arduino-LeonardoMicro-as-Game-ControllerJoystick/). The 1.6.6
IDE actually makes this a lot easier to do.
2015-12-23
(/member/WanegainB/)WanegainB (/member/WanegainB/)
Reply
Very useful ! Thank you for this tutorial. Do you know how I can do the Step 6 on Windows 10 ? Right clic
is not working :(
2015-12-04
(/member/MatthewH/)MatthewH (/member/MatthewH/)
Reply
That's strange. Step 6 is the same on a Windows 10 machine. Do you get a context menu at all when
you right-click on the Arduino in the "Devices and Printers" window or is it just that the "Game
controller settings" option is missing?
2015-12-04
(/member/WanegainB/)WanegainB (/member/WanegainB/)
Reply
My fault ! I was not in Devices and Printers window. It's working fine ! Thanks again for this tutorial.
2015-12-04
(/member/JakubK5/)JakubK5 (/member/JakubK5/)
Reply
http://jakkul.blogspot.com/2015/06/my-first-arduin... (http://jakkul.blogspot.com/2015/06/my-first-
arduino-racing-pad-video-and.html)
http://jakkul.blogspot.com/2015/06/sim-racing-and-... (http://jakkul.blogspot.com/2015/06/sim-racing-
and-game-controllers-part-2.html)
2015-06-17
4 p
(/member/MatthewH/)MatthewH (/member/MatthewH/)
5 ? Reply
I am glad to see it worked for you. I noticed your comment "I think, that 8bits of data fed by Arduino to
the PC for steering are not enough." I am pretty sure that could be increased to 16 or 32 if you need it
to be. To do this you will need to modify the definition of the X, Y, and Z axis in the
_hidReportDescriptor array in the HID.cpp file (specifically the LOGICAL_MINIMUM (-127),
LOGICAL_MAXIMUM (127), and REPORT_SIZE (8) elements). You can take a look at
http://www.microchip.com/forums/m238459.aspx
(http://www.microchip.com/forums/m238459.aspx) for some example HID report descriptors that
use something other than 8-bits. (I only needed 8-bits for what I was using it for.) You will also need to
update the setXAxis, setYAxis, and setZAxis functions in the USBAPI.h and HID.cpp files to accept a
bigger number.
(/member/JakubK5/)JakubK5 (/member/JakubK5/)
Reply
Should I care about the total length of the HID descriptor? I know this is probably a very basic
question, but my experiments with arduino were my first exposure to HID USB communication :)
http://forum.freetronics.com/viewtopic.php?t=734#p... (http://forum.freetronics.com/viewtopic.php?
t=734#p2245) The author of this post provides examples for a 3 axis 6 button joystick, where one of
the axis' (steering) is 10 bit.
2015-06-17
I
More Comments
| Post Comment
Related
4 p 5
Arduino Leonardo/Micro as Game
?
Controller/Joystick
by MatthewH
(/id/Arduino-LeonardoMicro-as-Game-ControllerJoystick/ )
© 2017
4 p 5 ?