Building Your Own Video Game Controller

Parts Needed:
1 BASIC Stamp HomeWork Board
1 Memsic 2125 Dual-Axis Accelerometer

Playing video games is always a great way to have some fun. Designing your own video games adds a little more to the enjoyment. But, what's next? How about building your own game controllers and interfaces? I believe that how we interact with video games has taken several leaps forward lately with the addition of the Wii-mote controller, the PlayStation3 with tilt and motion, and the extensions of guitars and drums from Guitar Hero and Rock Band.

In this tutorial, I will explain how to create your own video game controller / interface with tilt using a 2-axis accelerometer and a BasicStamp2.

To get started, we need to gather the necessary parts. First, we need a basic development board. For this tutorial, I would recommend visiting Parallax.com or the local Radio Shack and snatching one of the "What's a Microcontroller?" kits. It includes a development board with a BS2 stamp already plugged in. It also includes other parts such as LEDs, resistors, capacitors, push buttons, piezo speaker, and even a servo. It's definitely worth buying, especially if you've never done any kind of microcontroller design or development. It even comes with a very good book that explains what each part is and how to use it. You can order the kit online at Parallax's website (http://www.parallax.com or directly at http://www.parallax.com/Store/Microcontrollers/BASICStampProgrammingKits/tabid/136/CategoryID/11/List/0/SortField/0/Level/a/ProductID/327/Default.aspx).


Part #: 28152

The most important part of this kit is the development board. This version is called the HomeWork Board. It is a pre-built board that includes a solderless bread board, BS2 stamp, RS-232, etc... This is a great board for quick and easy development.

HomeWork Board

Part #: 28158

http://www.parallax.com/Store/Microcontrollers/BASICStampDevelopmentBoards/tabid/137/CategoryID/12/List/0/SortField/0/Level/a/ProductID/133/Default.aspx

I chose to go with the Parallax HomeWork board because it's a very simple design and it is powered by an attached 9V battery. Most of the other boards are powered with a detached power supply. For our controller, we want our board to be very mobile and don't want a lot of extra cables dangling from it.

Note: In a future tuturial, I will show you how to make your controller wireless.


The next part we'll need for our controller is the accelerometer. So, what is an accelerometer anyways? An accelerometer is a device that measures non-gravitational accelerations. Single- and multi-axis models are verticle to detect magnitude and direction of an accleration as a vector quantity, and can be used to sense orientation, vibration, and shocks.

Accelerometers are present in numerous portable electronics and video game controllers, including the Nokia N95, Sony Ericsson W910i, Blackberry Storm, iPhone, iPod Nano 4G, Nintendo's Wii Remote, and the PlayStation3 controller. Our controller will be using the Memsic 2125 Dual-axis accelerometer from Parallax (http://www.parallax.com). It's a tilt sensor with a tiny bubble of hot air, like a carpenter's level on two axes.


Part #: 28017

http://www.parallax.com/Store/Sensors/AccelerationTilt/tabid/172/CategoryID/47/List/0/Level/a/ProductID/93/Default.aspx?SortField=ProductName%2cProductName

We could've used an acclerometer with more axis, but this one will do fine for our project. All we need it to do is to measure if the controller is leaning backwards, forwards, or tilting left or right.






Basic Stamp 2 Source Code


C# Source Code
Comm.cs


C# Source Code
Game.cs