Saturday, April 30, 2011

It's Finished!

Sorry about the lack of updates, as most of you know I've been practically living in Detkin lab for the past seven days working on this project, and I have entirely neglected this blog...

The real take home message from this blog post is...
WE'RE DONE!

As is, our project implements all of our baseline goals and our first reach goal of getting the design working with the XBox 360.

 To recap, our final design consists of two parts.  First, the transmitter (or the gun):


Total construction time: 40(+) hours

Set in the case of the gun are an analog stick, trigger, and buttons to implement the entirety of the XBox 360 controller interface (except the d-pad, giving a total of 12 buttons).  Inside the hollow stock is an XBee wireless antenna, where the chamber would be (in a real gun) we fitted a gyroscope, and in the front there's an mbed, with wires connecting to everything else in the gun.  For an idea of how messy the insides of the gun got, check out this picture (and note that this has 10 or so fewer wires than the gun does now!)


Time required to properly re-close the gun after adding a new component: 2 hours.
Finally, using a drill, hand saw, spare PVC pipe, and quite a bit of luck, the daughter screen of a portable DVD player car kit was mounted on the gun.  It is actually secure enough that you can flail around trying to find a pesky AI shooting you in the back on Modern Warfare 2 and the display won't slide loose in the slightest.  We measured and trimmed the sight rails on top of the gun such that the display fits in perfectly (i.e. eventually slides in with a substantial amount of shoving).


The other component of our project is the receiver.

Microsoft, you should be ashamed of what you made us do here, but I know you're not
The buttons were all implemented using relays (which are essentially just electrically controlled "buttons"), while the analog parts (triggers and analog sticks) were implemented using both the mbed's DAC, a pair of external I2C DACs, and also a home-made 3 (technically 4, but with bit 3 hardcoded to 0) bit DAC.  If the XBox 360 controller USB protocol were documented, this wouldn't have been necessary... but the probability of that ever happening is essentially 0.  Data is received from the gun using a second XBee wireless antenna. 


After we plugged the receiver into the XBox 360 and the gun into any USB port, we were ready to go: the project worked more or less out of the box, there were only a few things both in-game and in software that needed tweaking.  As it stands now, games are entirely playable (as long as you don't need the d-pad), however, because of the cord tether, it can be difficult to experience the full range of motion.

Once I find someone to lend me a capture card, I will make a recording of me playing Call of Duty or something (possibly even online), but until then, this picture of Henry playing will have to suffice:


Don't mind me, just pwning some noobs on XBL
The demo is tomorrow, so let's all pray to god that this project will still work when we wake up in the morning.  FYI, the current time record for "The Pit" on MW2 stands at 1:07 with the gun controller (my fastest run).  After the project demo, we will take any challengers to beat this time - obviously, only a perfect run will count.

Wednesday, April 13, 2011

mbed Minecraft! Well, Almost...

Today, we added some parts liberated from Detkin lab to the circuit from our last update, and here's the results:

Hey Kevin, I carry around the mbed "credit card" too
We used a nice 8-switch package that we found in a Detkin drawer to implement eight game controller buttons (with eight 10k resistors used to make the switches drive both high and low).  In place of analog sticks (we couldn't find any), we used four potentiometers for the four controller axes.

Of course, you can always see for yourself in this video (of Paul playing Minecraft):


 
Pardon the awkward-looking actions in game: it's not easy to look around by adjusting potentiometers with a screwdriver.

Parts order went out today, so hopefully by Monday we'll have everything we need to get this thing actually working.

Paul

Tuesday, April 12, 2011

Milestone 1 Complete

Here's something I managed to throw together this afternoon:
Sorry to whoever's ESE 171 board that USB cable was for... :)
The white cable you see is a standard USB cable.  I cut the cable open, separated the red (+5V), black (ground), green (D+), and white (D-) wires, and then connected the D+ and D- wires to the corresponding pins on the mbed.

Using modified code from mbed.org, I managed to make the mbed use four ADC inputs and twelve GPIO pins to implement a 4-axis, 12-button game controller that uses the USB HID (human interface device) protocol.  This means, of course, that if those pins on the mbed were actually connected to buttons and joysticks, you could use this to play games on PC already!

It even successfully identifies as a game controller (with the proper buttons/sticks) in Windows 7:
Generic "USB Input Device" FTW
It will even recognize button presses if we connect the mbed's 3.3V regulated output to one of those 12 GPIO pins!  Unfortunately, I don't have a pot on hand to test the analog functionality... this will wait until one of us makes it to the lab.

Technically, this means our first (albeit relatively simple) milestone is complete!  To anyone who is currently still deciding on a micro-controller to use, from our experience so far, I strongly recommend looking into the mbed.  If you can get over writing in C++ and having to use the online IDE/compiler, the community seems great (it didn't take me long at all to find both a guide and the majority of the source code I used for HID), the board is loaded with peripheral features, and the libraries available online are pretty extensive.


Paul