Introduction: Gamepad Controlled Raspberry Pi Using Qjoypad
For one of my projects I wanted to run a Raspberry Pi displaying a web page in kiosk mode. I didn't want to keep a keyboard or mouse connected all the time, but I still wanted to have some interactivity and control. I found that an inexpensive gamepad and software called Qjoypad would meet my needs.
I ordered an SNES Classic USB Super Nintendo Game Controller Gamepad Joystick from Amazon (https://www.amazon.com/gp/product/B01KJS4ILY/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1). The software should work with many other models of game controllers, but this is the only one I have tried it with.
Qjoypad is intended to help provide gamepad/joystick support for games that might not include that natively. You set up one or more layouts so that each button on the game pad is matched with the press of a keyboard key or mouse event. I recommend that you decide what you want each button to do before you install and run the program, although you can easily change it later. Also, you can have several layouts that are mapped differently and switch between them.
Step 1: Install Qjoypad
I set up a Raspberry Pi with a current version of NOOBS (2.4.0) and the standard full version of Raspbian. After the routine tasks of updating the Pi and changing the name and password, I opened a terminal window and typed:
sudo apt-get install qjoypad
I have seen tutorials on other systems that also required installing some dependencies, but I did not have any such issues on my Pi. It just worked.
Step 2: Run Qjoypad
Plug your gamepad into a USB port and start Qjoypad. For me it showed up under both Games and Accessories on the Applications menu (at the top left of your Pi's main desktop screen). It should recognize that you have a gamepad (listed as a joystick) plugged in.
One thing new users may find confusing is that when Qjoypad runs it doesn't open a window. It does place an icon in the system tray and you have to click on it there to configure it. After you have it configured you can right-click on it to change layouts.
Step 3: Configure Qjoypad
Click the Add button to start a new layout and give it a name. The Qjoypad documentation says, "Make the name short, simple, and easy to remember, just in case you ever want to load the new layout from the command line. You can use any name you like that would be a legal filename on your computer." I used the name "kiosk" for my project, but I used the name "demo" in the attached video.
The documentation says that when you press a button on your gamepad the corresponding button should flash in the layout window, but that never worked for me. After some playing around I found it easier to use Quick Set to create the layout and that's what I demonstrate in the video. I made a list of all the functions I wanted and tried a few iterations before settling on the current layout. Fortunately, changing a layout is very easy.
Click the Close Dialog button to try your layout. If you want to make changes to your layout, remember to click the Update button to save it.
One limitation of Qjoypad is that it does not support key combinations -- each button can correspond to only one key. However, you can press more than one button. For example, I mapped the B button to the Ctrl key and the Y button to W. If I hold down B and press Y it works as Ctrl-W, which closes my web page.