Sunday, November 23, 2008

I've been very slack :( Too many new games out and been too lazy to update the blog. I did however managed to play through all the songs in Guitar Hero World Tour like five times, and completed the campaign on Gears of War 2 twice.

Anyway, back to the project. I pulled apart the Playstation 2 Dual Shock Controller, and soldered the 3.3v and Ground to a pair of wires so that I can play around with the button connectors, which connect to a ribbon.

But I discovered an issue. It looks like when the button connector ribbon is not connected, the xbox thinks that ALL the buttons are pressed ALL the time, rather and no button is pressed. This is backwards to what I expected. Apparently this is a result of the Dual Shock 2 being an analogue controller. This is a bit of a setback. I will need to use my original Playstation controller.

I dug around and found my Playstation controller that I haven't used even longer than my PS2 controller. I plugged it into the Xbox to make sure that it worked before I pulled it apart. And to my surprise, it still works perfectly, which is great news. I will pull it apart and hopefully it will be much easier to work with.

Tuesday, November 11, 2008



Yesterday, I wrote about the PC side of things, so today, I'll try and explain the game side of the project.

I own a Xbox 360 (you can see my HDMI mod in the photo!), and play Guitar Hero III and Guitar Hero: Aerosmith, and tomorrow, I'll have Guitar Hero: World Tour (yay!), but will be concentrating on GH3 and GH:A since I'm familiar with them. (I also own Guitar Hero: On Tour for my Nintendo DS, but we won't worry about it here)

I plan to pull apart my Playstation 2 Dualshock 2 controller to act as the interface between the Xbox 360 and my PC. Did you read that correctly? Yes, a PS2 controller on my 360. Let me explain...

First off, I needed decide whether I should pull apart my GH3 Les Paul guitar controller or use a standard Xbox 360 controller. The choice was pretty simple - go with the standard controller. Mainly because the standard controller is cheaper, but more importantly, when you play with the standard controller, you don't need to strum. So there's less timing to worry about - the robot will only need to press the buttons at the right time, and not have to worry about strumming in time as well.

I looked around, but a wired controller is pretty hard to come by, and they are expensive. I happen to have a Max Shooter for the Xbox 360, that I bought to give me autofire capability in annoying games that require button mashing (eg Fable II Pub Games, Eternal Sonata). Max Shooter also lets me use a PS2 controller on the 360, and PS2 controllers are dirt cheap, less than US$10. I also have a PS2 controller that I haven't used in a long time, so it was time to blow off the cobwebs and put it to good use.

Just to make sure that the PS2 controller can be used to play Guitar Hero (before I pull it apart), I fired up GH:A and played a song with the PS2 controller through Max Shooter and it worked perfectly. Here are the PS2 button mappings to the Les Paul guitar controller:

PS2---------------------------->Les Paul
L2 ----------------------------->Green
L1 ----------------------------->Red
R1 ----------------------------->Yellow
R2 ----------------------------->Blue
X ------------------------------>Orange
any direction on DPad--->Star Power
left analogue------------->whammy

I'll pull apart the PS2 controller for my next post, although with GH:WT arriving tomorrow, not sure when I'll be around next to update this blog :)

Monday, November 10, 2008

I needed a new project over the summer, and decided to try and build a Guitar Hero playing robot. All it needs is something that pushes five buttons in a set sequence - how hard can it be?

Seriously though, I thought it would be an interesting project, and as a side benefit, I'm hoping that the robot will be able to play songs that I can't with my old fat slow fingers ;)

First step of the project was to get something to interface the real world with my desktop PC. Most of the DIY projects around on the net seems to rely on the good ol' RS232 interface. RS232 is excellent, don't get me wrong, it got me through uni. However, most new PCs no longer have RS232 ports built in, and certainly, my current PC and my previous PC don't have one. So I needed something else.

This is were the USB port comes in. I've never played around with the USB port, so deciding on a project that relies on the USB was a gamble, yet alluring. I thought it would be really interesting to play with the USB at a low hardware level, and even if my robot doesn't work out, at least I come out with some knowledge of USB development.

I looked around the net for DIY USB projects, but they were hard to come by. Either they were overly complicated, or they were too expensive, or both. I needed a reasonably cost effective way to interface the PC to the real world. I initially decided to use the USB Experimenter's Interface Kit from Jaycar. But then, when I discussed it with my friend, he recommended that I try the Arduino Duemilanove from Little Bird Electronics. He read it in one issue of his fancy Wired magazine. It's an open source development board, with a very active community. This was a perfect fir for what I needed. It was cheaper than the Jaycar unit, come already assembled and open source so that it should be much easier to hack. I ordered one straight away.

That was last week, and this morning, the Arduino finally arrived! Initial impression was "wow, it's tiny". And it really is - it's smaller than a business card.

I followed the instructions and downloaded and setup the Windows drivers and software. Pretty straight forward.

I then followed the instructions and uploaded the sample test sketch "Blink". The instructions mentioned sticking in an LED to pin 13 and ground, so I was fully prepared to pull out the digital multimeter to measure the output voltage to check. But the newest Arduino that I purchased, the Duemilanove come with an LED built into the board! Awesome! Once the "Blink" was uploaded, the onboard LED started to blink as it was meant to. Couldn't believe how easy it was to get this going.

Next I decided to try something a bit more challenging. There is a sample sketch called "Dimmer" which allows to control the brightness of the onboard LED by moving the mouse on the PC. I thought this would a good example because it demonstrates something that I need for the roboto project - control the Arduino directly from the PC.

I uploaded the sketch just like I did for "Blink", and once it was uploaded. I moved my mouse around, but nothing. I checked the code, changed a few lines around, uploaded again, moved the mouse around - nothing.

I read the code, and it kept on mentioning 'processing'. I didn't know what it was referring to. Then I saw a small link to processing.org. I followed the link and found that it was a link to an open source programming language and environment. This solved another one of my issues - I thought I would have needed to find and install Visual Studio so that I could write programmes in Visual C++ or Visual Basic. Having Processing installed negated that need! Awesome.

I put that Processing sample code from "Blink" and ran it. It popped up with a little window and when I moved the mouse side to side within that window, the onboard LED turned on and off. I guess the onboard LED is binary and have no analogue option. But the important thing was that it was working! Yay!

Reading through "Blink" I realised what I needed to do for the robot project. I need to put the Arduino into monitor mode, where it will sit there and monitor the incoming serial signal and then press the Guitar Hero buttons when asked. The Processing sketch will read a text file with the song transcribed and send the commands down the line to the Arduino.