Simple Guitar Hero Controller for PC Using Teensy (Capable of Multi-player)

by swu_ in Circuits > Arduino

1419 Views, 4 Favorites, 0 Comments

Simple Guitar Hero Controller for PC Using Teensy (Capable of Multi-player)

IMG_0171.JPG

After making the Simple taped up DDR Pad, the natural next step is obviously a guitar hero controller :)

What I realized is I will run out of pins on my board if I wanted to add more players.

The solution?

Using analog value, which means I only need one analog pin for the four buttons.

The best part:

It was a lot easier to construct.

Since only a small number of pins are needed, I decided to pick up a teensy for this project

Concepts learned:

R2R Ladder and why it works

R2R Ladder and why it's not a good idea

Resistors don't always come with the value you want o.o

How to use teensyduino on Windows

Gathering Materials

IMG_0172.JPG
IMG_0171.JPG

1. Four Push buttons

Can pick them up from any electronics store. I used the ones that came with my Arduino kit from Sparkfun

Something like this will do

2. teensy or Arduino Leonardo for easy USB integration

- These boards can be used as Keyboard/mouse directly, but any other boards will work too assuming you know what to do :) (Create a program to translate serial input into keyboard actions)

3. Resistors

I ended up using 3x 4.7k resistors and 8x10k resistors.

(Ideally, 5k resistors should be used, I did not know that I didn't have them!)

4. Wires

A short length for each button - Ground connection

A long length for each button - For connecting to the R2R ladder

Three super long wires for connecting to the board

5. Breadboard

Again, I have limitations, this project was simple enough for a breadboard, feel free to use whatever you feel comfortable

5. Optional Reading

Resistor Ladder Explanation

Building the R2R Ladder

r2rladder.png
r2rladderconnection.png

R2R Ladder is a type of DAC (Digital-Analog Converter)

Its purpose is to translate a digital signal (ie. my button presses into an analog value)

Its role in this project is to save me some digital pins

Here's a good explanation on how it works

Build the R2R Ladder circuit on the breadboard

Note again I used 10k and 4.7k resistors when 10k and 5k resistors would have made calculation a lot easier

Add Buttons to the Circuit

r2r.png
IMG_0171.JPG

Build the circuit with the buttons using your pushbuttons and 10k resistors

Note with the Sparkfun buttons, the two pins that are closer together should be on the same side

Connect the Buttons to the R2R Ladder

breadboard.png
IMG_0171.JPG

Connect the buttons to the R2R Ladder, each button should connect to a 10k Resistor

Connect Board to Teensy/Arduino

breadboard.png

I'm using the same image as the last step

This is where the long wires comes in

Connect Yellow to A0 on Teensy/Arduino

Red Power to 3.3V output on Teensy/Arduino

Blue Ground to Gnd on Teensy/Arduino

Teensy Code

Here's the code made for my teensy

Notice the line float values?

That's because I didn't have perfectly matching resistors so the values could not be easily obtained from the analog value.

What I ended up doing was record all the combinations and the corresponding analog values

0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0

.....

Feel free to modify if needed. My data was recorded using 3.3V output. I imagine 5V would produce slightly different output values

Downloads

Upload Code Using Arduino IDE and Play

IMG_0171.JPG
IMG_0172.JPG

Upload code and play

Secure the connection between the breadboard and your teensy/arduino board

Optionally you can create a guitar like body.

I haven't found anything easy for it just yet

Will update when I come across something

Now, load up stepmania and play!

Troubleshooting Teensyduino

Here's the full link

Troubleshooting Teensyduino

The short summary is:

1) On Windows, make sure teensy drivers are installed

2) Serial port will not work unless the code has been uploaded

3) If serial port is still grayed out, sometimes, closing Arduino IDE, unplug teensy and plugging it back in and then start Arduino IDE will help.