Intro: Guitar Hero Arduino Bot.
The main idea of this project is quite simple. It is to modify a Guitar Hero controller so that it can not only play on its own, but also play perfectly.
Here is the First Song I did: "When You were Young" by The Killers
I am also working on Through The Fire and The Flames by Dragonforce and will upload it when finished.
UPDATE: I was unable (really just unwilling to put in the amount of time needed) to make it play perfectly. I was able to get it up to 98.549% a mere 1.451% away from perfection.
I may eventually fix it to be made perfect but for now only missing 54 of the 3722 notes is good enough for me.
So with out further ado here is the video of it getting 98%
Throughout this instructable you will see numbers written in each step. These numbers correspond to the pictures above the step(1 being the first etc.).
I got my first Arduino (Mega-2560) a few months ago. I love it. I've done a few really small projects with it, mainly with LEDs, but I have not done a big project yet. So I started thinking. My first idea was to create a system that would sync our Christmas lights to music like so many people have done. So I started doing research. I found out that this would be fairly easy to, all I would need to do is get some Relays and wire them up to the lights and use a serial connection from my computer to my Arduino to tell it when to turn on and off the lights. This was exactly what I was looking to do, except we don't really have a lot of outside Christmas lights nor do we have very many people in our neighborhood that would even see them. Also, being new to electric circuits, I didn't want to deal with AC as it can be very dangerous if you don't know what you are doing. So I decided against doing Christmas lights synced to music.
Throughout all the research I did on lights synced to music, I found out about a program called Vixen. Vixen is a program that many DIYers use to control their lights. It's got a really simple interface, it can output in serial commands, and it is really easy to get the timing on things really precise, even down to a couple of milliseconds. Since I had just ruled out doing Christmas Lights, I started to think about some way I could incorporate this awesome program into another project. I tried to think of something that I use a lot that I could automate with this. The first thing that came to mind was Guitar Hero. Ever since guitar hero came out I have been a huge fan. I have most of the games and 4 or 5 of the guitars. I love playing the game and have gotten really good, but there are still a few songs, like Through The Fire and The Flames by Dragonforce, that I cannot beat. So my goal was to build something that could beat that song on expert, but not only beat it buy play it perfectly. No, I didn't create this project to get the highest score on the leader boards, because that would be cheating and I could care less about a high score.
The way I went about this is different than many people who have done the same type project. First, many of the projects I have seen use motors/solenoids to physically push the buttons, but this is not the best method for a few reasons:
1. The motors/solenoids are not instant. They take time to push and release the buttons. 2. Motors/solenoids can be expensive. My method addresses these issues by using Solid State Relays (SSRs), which have switching times of about 1ms and are relatively cheep (about $1 per relay).
A second way mine is different is that mine is "programmed" instead of using light sensors attached to the screen like many projects I have seen use. While yes you must program each song you wish to play and programming the songs take a while, it seems to be more accurate with the notes and does not have to be calibrated.
How it Works:
The way this project works is kind-of complex, but once you understand it, it is quite simple. First you create an "audio note chart" of the song you wish to play. Next this "audio note chart" is converted by the application Vixen to serial commands. These serial commands are sent to the Arduino board. The Arduino board the turns on some SSRs which make the controller think that buttons are being pressed, thus "playing" the guitar.
Like with many projects, this project can be split into 2 different parts: Hardware and Software.
Step 2: Hardware - Parts & Tools
The hardware side of this project is fairly easy.
- 1x Protoboard - $1.50 - http://www.futurlec.com/ProtoBoards.shtml
- 6x 200(approximately) Ohm resistor - $0.20 - http://www.futurlec.com/Res14WMF.shtml
- 6 (or more) 5v Control Solid State Relays - $2.95 - http://www.futurlec.com/Relays/SSRDIP60Vpr.shtml
- Cat5 Wire
- 1x OLD Guitar Hero Controller
- 1x Arduino
Total Cost assuming you already have an Arduino and Guitar Hero about: $12
- Screw Driver (Phillips and Possibly Torx )
- Soldering Iron and Solder
Step 3: Taking Apart the Guitar Hero Controller.
1. - First, be sure to take out the batteries if your controller is wireless like mine is.
2. - If your controller comes apart at the neck now is the time to take the neck off.
3 & 4. - Remove the screws from both the body and the neck. Make sure to get them all, as some may be hidden behind stickers.
- Next lift up on the back piece of plastic revealing the internal components.
NOTE: There may be components attached to the piece you are lifting so be very careful not to damage them.
5. - With the back of the body and neck off you should now be able to see a few different components. There are 2 specific components you are looking for: The fret board (Where the Green Red Yellow Blue and Orange buttons are), and the strum bar.
Step 4: Modify the Fret Board
1. - If you look closely at the circuit board for the Fret Board you will see there are 8 wires connected to it for the 5 buttons. Because of this, we need to map out what wires go to what buttons.
- First, you need to use a Phillips head screw driver to remove the 2 screws holding the circuit board in place.
2. -Next flip the board over and look at the traces.
- Write down which wires go to each button as this will be helpful later. Some wires will go to multiple buttons.
- At this point, it would be helpful to mark, with a sharpie, both ends of the wire so that you know which wire you are designating as wire 1.
- The next step is to add our own wires so that we connect the Relays.
- Take about a 6-10inch section of Cat5 wire and strip the ends.
- Now take the Cat5 wire and find a place to connect it to the the wires coming from the fret board. If no place can be found that can easily be soldered to, then you could always cut the wire from the fret board and create a wire joint.
NOTE: If you controllers neck and body do not come apart you can solder the Cat5 wire to the fret board, and use a longer piece Cat5 cable. Just make sure it can reach back into the body of the controller.
3. - Finally, solder the wires into place.
Step 5: Modify the Strum Bar
- There are 3 wires and traces for the Strum Bar. One goes to both Strum Buttons and the other 2 only go to one button each.
1. - Chose one of the buttons and solder a wire to each lead on it.
- The wires should be about 6-10 inches
Step 6: Building the Relay Board
2. - The relays I chose to use came in a 2 relay DIP, by that I that there were 2 separate relays in an 8 pin DIP. Because of this I only had to order 3.
3. - The pinout of these relays is quite simple: Pins 1&2 and 3&4 are the control pins for relay 1 and 2 respectively, while pins 5&6 and 7&8 are the load pins of relay 2 and 1 respectively. More info can be found in the data sheet: ****
4. - The first step in building the relay board is designing the circuit.
- When designing the circuit you want to put the relays for the buttons that share wires close together. This makes it easier to connect t.
- It would also be helpful after you figure out what button each relay is going to connect to to mark it.
- Following the schematic above a resistor, in my case a 200 Ohm, is connected to pins 1&3 of every relay and pin 2&4 of every relay is connected to ground.
- Pins 5&6 and 7&8 are connected to the buttons on the Guitar Hero controller. Where 5&6 are the wires for one button and 7&8 are the wires for a separate button.
- Connect the resistor of each of the relays to Arduino pins 2-7. Connect Green Relay to 2, the Red Relay to 3, the Yellow Relay to 4, the Blue Relay to 5, the Orange Relay to 6, and the Strum Bar Relay to 7.
NOTE: you can change what pins they are connected to, but you must change the code.
- Connect Pins 2&4 of every relay to the ground pin on the Arduino.
Step 7: Software
The software side of this project is a little complex. The method I chose to program this is a very involved process and requires a few programs and ALOT of Patience.
1. - Arduino IDE http://arduino.cc/hu/Main/Software
2. - Vixen http://www.vixenlights.com/downloads.html
3. - Audacity http://audacity.sourceforge.net/download/
- A video editor that supports scrubbing through 60 fps video and exporting audio only (I had access to Final Cut Pro which was perfect. Adobe Premier/After Effects, Sony Vegas, or Avid should all work well)
The way the software side of this project works is by taking a simple audio file, a 10ms click, and using it to mark a video of a song every time a certain color note is played. This is essentially creating an audio note chart. Once all the notes of the same color are marked, the audio is exported then opened in Vixen which will convert the audio into a visual note chart that has perfect timing. After that you go back and do the other colored notes the same way. Vixen will be able to send this note chart to your Arduino via serial commands, making it "play" guitar hero.
Step 8: Audacity
The first step of this process is to create the click that will serve as the markers for our "audio note chart." We will use audacity since it is free and easy to use.
1. - Open audacity and create a new project.
2. - select Generate -> Click Tack....
3. - Change the following settings and click ok:
Beats per measure: 1
Number of measures: 1
4. - Zoom in a delete all the silence after the click ends.
5. - Click File -> Export and save it as Click
- Close Audacity
Step 9: Final Cut Pro or Your Video Editor
First, find or record a video of the song you wish to play on guitar hero. 60 fps video is preferred and will give better accuracy, but 30 will still work though you will have to spend a lot more time debugging.
- Open the video in the video editor of your choice. **make sure to mute or remove the audio from the video.**
- Import the Click audio file you just made.
- Using the arrow keys scrub through the video and add the audio file every time the green note crosses the strum bar line. It may be helpful and quicker if you copy and paste the audio file every time.
- Also add one of the audio files where the very first white line crosses the strum bar line. (This helps with getting the timing right)
- Once you have marked all the green notes export the audio only (make sure it is just the clicks and does NOT include the sound from the game) and save it as Green.
-Delete all the audio markers you just made and then mark and export the all the Red notes.
- Continue to do this for yellow, blue, and orange notes.
-** This is a really time consuming process and will take at least an hour, maybe even a day, depending on the length and complexity of the song.**
- Once you have finished with all the notes you can close the program.
Step 10: Audacity... Again
- Open Audacity and creat a new project.
- Drag in the Green, Red, Yellow, Blue and Orange audio files you made in the previous step.
- Export the audio and name it Strum.
- You will get a warning that the track will be mixed down to a single mono channel. This is exactly what we want for this, because it creates an audio track for the strum button.
Step 11: Vixen
Vixen is the heart and soul of this project. It is what takes our "audio note chart" and turns it into serial commands and sends them to the Arduino with perfect timing.
- Once you have downloaded and installed Vixen open it up.
- Create a new sequence by going to Sequence -> New Event Sequence -> Vixen Standard Sequence
- Click Next
- Click next
1. - Click profile manager and then the blue plus button.
2. - Name it Guitar Hero then add 6 channels
3. - Click on the Icon with the 4 colored squares
- Click New Color and add Green, Red, Yellow Blue, and Orange
4. - Drag Green to Channel 1, Red to Channel 2, Yellow to Channel 3, Blue to channel 4, and Orange to Channel 5 (Leave 6 as white. This is for the strum bar) and Click OK
- Now Click Output Plugins
- Double Click Generic Serial.
- Select it in the right box and click plugin settings
- Set the COM to what ever com port your Arduino is connected to and set the Baud to 9600
- Click OK then Done then Done again
5. - Select Guitar Hero from the drop down menu
- Click next
- Click Next Again
Click Create It
Go to Sequence -> Settings and change the event length to 10ms
Save it as the name of the song you are doing.
Now time to import our audio into vixen.
- Go to Sequence -> Audio
6. - Click Assign Audio
- Open the audio file you named green
- Go to Add-ins -> Waveform
7. - Click on Channel 1 so that it is highlighted and Click Start
- You will get a warning here. Just click Yes
- When it says Done Click OK
8. - If you scrub through the song you should now see a green box every where a green note should be hit.
- Now do the same thing for the Red, Yellow, Blue, and Orange audio files, choosing the appropriate channel for each.
Do it again for the Strum choosing Channel Six.
Once you have completed all 6 of the channels select all the events and cut and paste it so that the very first green note (the one that you put where the very first white line crosses the strum bar line) is at approximately 3.5 seconds.
Select that first green note and hit the space bar. It should not be green any more.
Select the very first event on the green channel and hit the space bar. (This will help us achieve perfect timing
Step 12: Arduino Code
Here is the code for the Arduino (I've also uploaded the .ino file):
int Green = 2;
int Red = 3;
int Yellow = 4;
int Blue = 5;
int Orange = 6;
int Strum = 7;
int i = 0;
if (Serial.available() >= 6)
for (int i=0; i<6;i++)
incomingByte[i] = Serial.read();
Step 13: Playing the Song
-To play the song, first, hook every thing up. Make sure the guitar is correctly hooked up the the Arduino and the Arduino is plugged into your computer.
- Next, open Vixen and open the song you wish to play
- Next, turn on the guitar hero game and select the song that you wish to play
- Push the green button on the guitar to start the song, but pause it by hitting the start button as soon as you possibly can
- Strum down until you get to restart. Hit the green button and then strum down again, but DO NOT hit the green button.
- In Vixen, Click the play button and the song will restart and should play everything perfectly.
- You may have to play around with the timing by cutting and pasting all the events, except the very first one, to move all the notes forward or backward as needed.
- If you did a good job in making the note chart you should have either a completely perfect song or a near perfect song.
- It took about 3 tries to get my first song completely perfect.
There you have it. That is how use an arduino to play a guitar hero song perfectly.
Then next step just covers why I think I should win the arduino contest.
Step 14: Why I Think I Should Win.
1. I put a lot of time and effort into making this Instructable. This wasn't just put together in a day it was the culmination of a few weeks of research, planning and designing. Followed by a couple of days prototyping and debugging.
2. This instrucable is really what the heart of instructables is about: finding a clever way of doing something and sharing it with the world.
3. I love building stuff with Arduinos. I have become addicted to building something new with it and it would be great to have more than the one that I have.
4. I really need a camera. As you can probably tell I took the pictures for this instructable with my phone. This was because I don't have a good camera.
Thanks So Much for taking the time to read this!!