DaveyBot

Post here about your arduino projects, get help & ideas, etc!

Moderators: arduwino, adafruit

DaveyBot

Postby Len17 » Mon Apr 13, 2009 1:17 am

DaveyBot
A computer that plays Guitar Hero and Rock Band

Update (May 10): Software is now available for download. See below. It still needs work, but it gets 96% playing "Painkiller" on Expert.

Overview

I’m trying to hook up my computer to a Guitar Hero controller, and write software to play Rock Band and Guitar Hero. People have asked me why, but I don't think I have to explain it to you guys. :)

I’m not the first to make a Guitar Hero ‘bot. Here's one and here's another. I’m a software guy and I already have a computer that handles video input (to record TV shows), so I’m doing most of the work in software. The software should work with different games. (I have Rock Band, Rock Band 2 and Guitar Hero World Tour.)

The general idea is:
  1. The computer receives the game video from the Xbox 360.
  2. Software on the computer analyzes the video to figure out when to play the notes.
  3. The software sends commands via USB to an interface module in the Guitar Hero controller. (This is where the Arduino comes in.)
  4. The module in the guitar simulates the button presses to play the notes.

DaveyBot is named after a fictional guitar hero.
Last edited by Len17 on Sun May 10, 2009 9:18 pm, edited 3 times in total.
User avatar
Len17
 
Posts: 238
Joined: Sat Mar 14, 2009 6:20 pm

Postby Len17 » Mon Apr 13, 2009 1:18 am

Software

The DaveyBot software is written in C#. It uses DirectShow to capture the video input (via the DirectShowNet C# library). Each video frame is analyzed to see if a note is approaching the strike line. If so, DaveyBot sends a command out through a comm port, to tell the guitar to play a note.

Here’s a shot of the DaveyBot software in action with Rock Band 2:

Image

The coloured blocks overlaid on the image and above it show the notes that are detected and played. You can see that the image is quite blurry. It’s a challenge to get the software to accurately identify the notes. You may also notice that DaveyBot is losing the game. That’s because it’s not hooked up to a guitar yet!

Another challenge was the DirectShow API for video capture (part of Windows DirectX). I think that API was designed by a Sudoku fanatic who didn’t want anyone else to use it. I figured out how to navigate the maze corresponding to my TV tuner card, but I’m not confident that the software would work on a computer with different video capture hardware.

So far I’ve been using Rock Band 2 but I should be able to tweak the software to play Guitar Hero as well. Some of the specialized features won’t work (solo buttons and slider bar) but I hope to add support for overdrive/star power.
Last edited by Len17 on Mon Apr 13, 2009 1:47 pm, edited 1 time in total.
User avatar
Len17
 
Posts: 238
Joined: Sat Mar 14, 2009 6:20 pm

Postby Len17 » Mon Apr 13, 2009 1:18 am

Arduino

To interpret the commands from the computer and simulate pressing the buttons, I’m using an Arduino microcontroller embedded in the guitar. Actually I’m using a Boarduino, because it’s small enough to fit in the guitar, it’s powered by the USB connection from the computer, and its pinout fits nicely on a prototyping board.

The Arduino is connected to the computer via USB, but under Windows it appears as a serial comm port. The commands sent from the computer are each a single byte, with each bit representing the on/off state of one of the switches (fret buttons, strum bar, whammy bar, tilt switch).

The software running on the Arduino is simple. When it receives a command byte from the computer, it turns the appropriate output pins on or off. The strum bar is handled specially. It’s turned on momentarily, then off again after a brief time. The whammy bar also needs special handling, because it has to be moved continually, but I haven’t implemented that yet.

Here’s a video of the Boarduino in action, receiving commands from the computer and driving a set of LEDs in lieu of the guitar switches.
Last edited by Len17 on Mon Apr 13, 2009 1:53 pm, edited 1 time in total.
User avatar
Len17
 
Posts: 238
Joined: Sat Mar 14, 2009 6:20 pm

Postby Len17 » Mon Apr 13, 2009 1:19 am

Hardware Interface

Besides the Boarduino, the interface module in the guitar also has a set of opto-isolators, to keep the computer and Boarduino electrically isolated from the guitar controller’s circuitry. I found a pair of quad optocoupler chips (ILQ1) that should do the trick nicely.

Here’s my schematic for the interface board:

Image

Update: I had to change the wiring. Originally it was based on someone else's hookup for a Wii controller, but apparently the switches are wired differently in the Xbox version - can't just hook up the outputs using a common ground.

The next step is to assemble the interface board and wire it into the guitar. My current stumbling block is finding a USB socket. If I’d been thinking ahead when I assembled the Boarduino, I would have put its USB socket on a short length of cable instead of soldering it to the board, so I could mount it in a hole in the side of the guitar. I also need to hook up a reset button because the Boarduino doesn’t always start running its program when I plug it into the computer.

When I’m all done, the guitar controller should function normally unless the USB cable is plugged in.
Last edited by Len17 on Wed Apr 22, 2009 11:44 am, edited 2 times in total.
User avatar
Len17
 
Posts: 238
Joined: Sat Mar 14, 2009 6:20 pm

Re: DaveyBot

Postby adafruit » Mon Apr 13, 2009 2:31 pm

sweeeet. please keep posting up your progress!
User avatar
adafruit
 
Posts: 3863
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Postby Len17 » Mon Apr 13, 2009 4:13 pm

Oops, what did it say on that sticker?

Image
User avatar
Len17
 
Posts: 238
Joined: Sat Mar 14, 2009 6:20 pm

Re: DaveyBot

Postby adafruit » Mon Apr 13, 2009 5:27 pm

nice multitool you have there :)
User avatar
adafruit
 
Posts: 3863
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: DaveyBot

Postby Len17 » Mon Apr 13, 2009 5:40 pm

ladyada wrote:nice multitool you have there :)

I made sure it was in the picture. :) It usually lives on a keyring next to a USB thumb drive - everything I need for hardware & software hacking.
User avatar
Len17
 
Posts: 238
Joined: Sat Mar 14, 2009 6:20 pm

Postby Len17 » Mon Apr 20, 2009 12:26 pm

Useful side-effect of this hacking project: I was able to fix my niece's Rock Band controller the other day. (Using my adafruit bomb defuser, of course.)
User avatar
Len17
 
Posts: 238
Joined: Sat Mar 14, 2009 6:20 pm

It's Alive!

Postby Len17 » Mon Apr 20, 2009 12:45 pm

Here's the first full test of DaveyBot:
Image

And here's the result:
Image

I can't believe it worked the first time. Yay!

Next I have to mount the interface board permanently in the guitar, and then there's lots more work to do on the software.
User avatar
Len17
 
Posts: 238
Joined: Sat Mar 14, 2009 6:20 pm

Re: It's Alive!

Postby Len17 » Mon Apr 20, 2009 1:11 pm

Just received this email from a friend:
dan wrote:you've finally gone completely mad

:P
User avatar
Len17
 
Posts: 238
Joined: Sat Mar 14, 2009 6:20 pm

Postby Len17 » Wed Apr 22, 2009 5:15 pm

Here are a couple of pictures of the finished hardware mod.

(Click on this picture to see an annotated version.)
Image

Image
User avatar
Len17
 
Posts: 238
Joined: Sat Mar 14, 2009 6:20 pm

Re: DaveyBot

Postby adafruit » Wed Apr 22, 2009 7:42 pm

y0w!
User avatar
adafruit
 
Posts: 3863
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Download

Postby Len17 » Sun May 10, 2009 9:16 pm

Download

Windows program & source code, Arduino source code, hardware schematic.

Download here
User avatar
Len17
 
Posts: 238
Joined: Sat Mar 14, 2009 6:20 pm


Return to Arduino

Who is online

Users browsing this forum: Google [Bot] and 2 guests

Stuff to buy from the Adafruit store and links to product documentation!