Introduction: Simple Handheld Controller for Raspberry Pi
So I recently programmed a small game with python that was completely controlled by a few GPIO buttons. Over the past few days, Ive been messing around with it, finding ways to make it better, when I decided, with my small breadboard, it would be really easy to turn that three button breadboard into a three button controller. So now, there are two buttons on the top, in easy locations for your thumbs, and one sticking out of the front, like a bumper on an xbox controller. Its a lot of fun and really simple to make.
Step 1: Materials
You will need...
-2 flat, tactile push switches
-1 tall button with flat sides
-some way of connecting to the GPIO pins, I used a ribbon cable but simple female headers are fine if you have those
Step 2: Positioning Your Buttons
Lets start with placing the two top buttons. Take the two flat, tactile push switches and place them in a comfortable position, somewhat centered on the bread board. Next, take the tall button and place it about a centimeter from the top right corner, on the underside of the breadboard. Before we glue it down, make sure to attach two wires to the terminals. Now, be sure that it is in a good, comfortable position, because it is a pain to take glue off and glue it back down. Now, cover the entire button with glue, you don't want it coming off.
Step 3: Wiring Your Controller
First, lets wire the two flat buttons on the top. This isn't a tutorial on GPIOs, but there is a good diagram of all the pins on the Raspberry Pi B+ on this forum:
Before we start wiring the buttons, you can use whichever pins you want for your buttons, but this is just an example with the pins that I used when making this.
Start with the left button. Take one terminal and connect it to a ground pin. Then take the other terminal and connect it to GPIO --. Now for the right button, take one terminal and, again, connect it to a ground pin. Then take the other terminal and connect it to GPIO--. Now, we have to do the same for the final button. You should already have two wire sticking out of the glue. Again take one and connect it to a ground pin. Then take the second wire and conect it to GPIO21. If any wires are feeling kind of loose, feel free to glue them down. You now have a simple three button controller which you can use with your pi. I will attach a small program that I wrote using this controller if you want to test it out. Feel free to put this on a flash drive and plug it into your Pi. You have to run it using an LX Terminal session.
Step 4: Final Touches
From here, you can customize it however you want. One idea that I had was to simply melt a couple pieces of a hot glue stick onto either side of the controller to make it a little more comfortable to use. You can also add more buttons or make your own casing so it isn't all open. It's up to you. Enjoy!
We have a be nice policy.
Please be positive and constructive.