Saturday, March 7, 2015

A better gamecube controller? (Part 2: Electrical Execution)

Please read part one if you missed it!

Planning out what you're going to do is fine and dandy, but this is where all the fun happens. We actually get to build and test stuff in this post!

Figure 1: Final concept for modified controller.

Cause you can't do cool electrical stuff without the right stuff.

The tools you need are:
  • TV & Gamecube with Melee
  • Multimeter
  • Sidecutters
  • Precision Tweezers
  • Soldering Iron/Station - You'll want to click this link, trust me....
  • Sand paper - fine grit (300?)
  • Heat gun or lighter
The materials you need are:
  • Gamecube controller
  • 7 24mm buttons
  • Wire - I use rainbow ribbon cable cause it's neat and automatically color codes your wiring for you
  • This and this - You could just solder wire straight to the buttons, but this makes it so that the user can freely move buttons around if they choose to.
  • 1.27 kΩ 1% resistor
  • 5.62 kΩ 1% resistor
  • heatshrink

We are going to be starting here because it can be a slightly tricky part of a pad hack. We plug our controller into the game console and start a match in training mode (characters and stage don't matter). This powers up our controller. The first thing we need to do is figure out the voltage levels for when the trigger is not pressed, the voltage when we are light shielding, and the resistance of the pot. From the back of the board we can clearly see the right trigger pot and the 3 pins on the front that correspond to it (figure 2). Using the multimeter to measure the voltage at each of its pin, we find that pin 3 is 3.44 volts (VCC), pin 2 is 0 volts (GND), and pin 1 changes as we move to pot so it is the pin that goes back to IC on the board. We also find that when we are not shielding the voltage on the pot is at ground (0 volts), and when we move it just enough to light shield the voltage on this pin reads 0.623 volts.
Figure 2: Controller pcb with potentiometer highlight and pin out marked.
We can now unplug the controller and measure the total resistance of the pot between the ground pin and the supply pin. We find it to be about 6.9 kΩ. With all the information we now know, we can use the equations from our first post to find what resistor values we need to use. 
R2 = 1.249 kΩ ≈ 1.27 

R1= 6.9-1.27
R1 = 5.63 kΩ  ≈  5.62 kΩ

In this case we need a 1.27 kΩ resistor and  5.62 kΩ resistor since those are our closest standard 1% resistor values.

We are now ready to build our circuit for the light shield button. We first need to remove the right trigger's pot. Since we don't need to save the pot, I'm just going to use a pair of sidecutters to carefully cut it off the board. I can then use the soldering iron and a pair of tweezers to remove the remaining bits of pins left in the pot's holes.

Figure 3: Schematic of light shield button design.

Now that the holes for the pot are free we can solder the resistors and 2 wires leading to a button to implement our design from part 1 (figure 3). Figures 4 and 5 shows how we need to connect the resistors to implement our design.

Figure 4: Drawing of how the resistors will connect to the pcb to implement light shield button.
Figure 5: Soldered light shield circuitry.

The all the buttons (except power shield and Z) can be seen on the pcb as black pads in figure 2. This black is a conductive material, and underneath it is copper. One side of the black pads corresponds to GND and the other side runs directly to a pin on the controller's integrated circuit. Using the multimeter we can find that the bottom half of each pad is ground and the top half is our signal the IC reads.

Since we want to solder our buttons in parallel with the existing buttons, we find a place we can solder our wires to the button's copper traces. The way to do this is simple use our sand paper to carefully sand away the black conductive materially on each button's pad. This will reveal the copper pad underneath that we can solder our wires to. NOTE: this copper is very thin, so don't over sand. Figure 6 shows the button pads after I sanded the black material away.

Figure 6: Gamecube controller with button pads sanded to copper and Z and shield buttons removed

Since all of the buttons connect directly to ground, we can solder our ground wire to just one spot marked in figure 6. Figure 7 shows the controller with all the button and light shield circuitry soldered.
Figure 7: All soldered buttons.
Since we are detaching the C-stick from the rest of the controller, we need to lengthen the wire used to connect it to the rest of the controller. We also need to further modify the C-stick circuitry to be able to rotate it 135 degrees in the original controller so that it will operate the most naturally in its new orientation on the final controller (up will be up, down will be down, etc.). This means we'll have to cut the awkward leg on the c-stick pcb (figure 8). Figure 9 shows this modification.

Figure 8: Top and bottom of unmodified C-stick pcb.
Figure 9: Top and bottom of  modified C-stick pcb.
Cutting off the leg also means we need to find a new location to solder our wires. Figure 10 shows this pin-out on both the main pcb and c-stick pcb.

Figure 10: Pin out of C-stick connections on main pcb and C-stick pcb.

TESTING IT ALL (a.k.a. "Show me your moves"):
The easiest way of testing is to start melee and make sure all our inputs are working properly.

Figure 11: Controller pcb after modifications. Non-conductive hot-glue was used on soldered wires for structural support.

Watch me stumble around with making a case! Yay for little to no woodworking experience... There's probably a good reason I'm an electrical engineer and not a mechanical engineer...

Part 3 is HERE!!

About a year ago my best friend's band released an album. I got to preview another album they plan on releasing soon, and am really excited for it. Give their last album a listen!

A better gamecube controller? (Part 1: Electrical Planning)

Recently my friend Fidi, who moved to Colorado, came back to Iowa for a visit. He has recently been suffering from hand issues. He has been playing Super Smash Bros competitive for several years now, but he had to recently cut back to not harm his hands further. We started talking about making a controller that would allow him to continue playing smash without hurting his hands. Something that would be similar to a fight stick, but still allow him to use the GCN controller's joysticks like normal. This sounded like a great project to me and I jumped on the opportunity to help him.

I plan on this project being posted in 5 parts: Electrical Planning, Electrical Execution, Case Planning, Case Execution, and a Reflection on the project as a whole once completed. I am going to try to explain things as fully as possible so people with very little electrical understanding can follow along and possibly mod their own controllers.

Figure 1 is a mock up of the end goal. The right-hand side of the gamecube controller has been replaced with a box with arcade style buttons. The buttons used will be 23mm buttons (as opposed to the normal 30mm) to allow for a slightly smaller form factor and allow the hand to rest more comfortably. The  c-stick from the gamcube controller is mounted sideways on the box to allow the users thumb to rest on the analog stick similar to how it would if you were holding a gamecube controller. The left hand side remains as a controller, but with the left-trigger (L) disabled.

Figure 1: Concept art for finished controller.

Since rolling your hand in towards the thumb is more natural than rolling out towards the pink, the button layout was chosen to allow for the most natural movement while playing. Common advanced tech are wave-dashing (X > R), waveshining(B > X > R > B > X > R >...), jump-cancel grab (Y > Z), rising arials (Y > A), etc. One thing you lose using buttons to replace the triggers is the ability to light shield where you only push the trigger in a little bit. I plan on replacing this with the (r) button.

Lucky for us, Nintendo still makes gamecube controllers. We will be dissecting one of these new gamecube controllers for this project.

Figure 2: New gamecube controller fresh out of the box.

The Unfortunate thing about Nintendo hardware is that it is a pain to get into without a tri-wing screwdriver. Luckily my friend Sam had one he could loan me. Below are what the insides of the controller.

Figure 3: What you see upon opening a gamecube controller

Look at those beautiful pcb's just ready to be analyzed and mutilated modified!!!!!!

After detaching the rumble motor and setting all the plastic bits aside, we are ready to plan out what we are going to do to the board electrically to get our end project. Figure 4 shows the front of our PCB.

Figure 4: Gamecube controller main printed circuit board (pcb).

At this point we need a basic understanding of how a controller recognizes button and trigger presses to make a good plan of how to succeed in a project like this. 

On every controller there is an integrated circuit (IC) that just reads the voltage of its pins and relays this information to the game console. Every pin on the IC corresponds to a different button on the controller. So all we have to do to have the controller recognize when we press a button it to have the button change the voltage of the pins. Figure 5 show a schematic of how we can accomplish having our buttons change the voltage on a pin.

Figure 5: Schematic of button press with equivalent circuit

Electrically the buttons are considered switches. A switch can either be open (not pressed) or closed (pressed). From Figure 5 we can see that, when our switch is open, the voltage of the IC pin is basically at our supply voltag,VCC (5 volts). However, when our button is pressed, the pin is basically connected directly to ground (0 volts). So if we want to replace the existing buttons with new buttons, all we have to do is wire our button in parallel with the existing button as seen in Figure 6.
Figure 6: How we plan to electrically attach our new buttons.
Now that we know how we're going to connect the buttons, the only other electrical modification we need to make so we can light shield by pressing a button (r). In smash you light shield by pressing on of the triggers in a very slight amount, so we need to know how the IC in the controller knows how far the trigger is pressed and how we can emulate this with a button press instead.

Since triggers can take a range of values, the voltage sent to the IC of the controller needs to also be able to take a range of values. This is accomplished with what is known as a potentiometer (pot). Think of a pot as a resistor with a movable tap in the middle of it. As the middle tap moves, the resistance on both sides of the tap move. This forms what's known as a voltage divider seen as the equivalent circuit in Figure 7. The voltage at our IC pin can be expressed as (R2/(R1+R2))*VCC. The resistance of R1 and R2 is the same as the total value of the pot (R1+R2=R) and the value of R2 changes linearly with the change in position of our pot's center tap (R2=position*R where position is between 0 and 1). Plugging those 2 formulas into our voltage divider formula we have that the voltage at our IC pin is position*VCC.

Figure 7: Schematic of gamecube controller's trigger circuit.

So when the trigger is not pressed at all, the pot position is either 0 or 1 and the pin voltage is either 0Vs or 5Vs. We can use a multimeter to measure this voltage to see which one it is, we are going to assume it is pulled to ground (0Vs) when not pressed (I'll change this post if I find it to be the other way). When we are light shielding, the pin voltage is some value between 0 and 5 volts. Figure 8 shows us a circuit that will let us use a button to light shield. 

Figure 8: Desired schematic for light shield button. 

When the button is not pressed no current is flowing, so our IC pin is essentially at 0Vs. When our switch is closed, we essentially have the equivalent circuit for our pot as seen in Figure 7. R2 and R1 are chosen so that their sum is close to the value of the pot (which we can find with a multimeter) and that they give us our desired voltage for light shielding (also found with the multimeter). Notice how the pot doesn't appear in our desired schematic. This means we're going to have to remove it from the PCB.

In the next post we'll take a closer look at the gamecube controller's printed circuit board (pcb), decided where we need to solder our buttons, and then actually execute and test our changes. There will be plenty of pictures, and possibly video!!!!

Part 2: HERE

My friend Ben from back home recently released an EP. It's awesome!!!! You can hear it here: