Wednesday, March 30, 2011

Early Development

I plan to update as the project develops, but so far I haven't been keeping track. So here's the highlights so far.

Phase 0
Got an idea to improve the final project. Began investigating how to implement digital logic and how to hack a game controller. Found out what the Arduino does and how people hacked PS2 controllers.

Originally I thought PS2 controllers would be good because they are widespread, which means people are familiar with them and there are many 3rd-party (cheap) controllers. I also thought since they were older, there would be more information on the internet on how to hack these. I assumed that the newer controllers would be too high-tech to use, and too new for anyone to have a good way of hacking them. These assumptions turned out to be pretty bad (for reasons probably discussed later).

Phase 1
Ordered the Arduino Uno, PS2 Dualshock 2 (non-Sony AKA non-OEM), and accessories from Began to read Bill Porter's website on how to hack a PS2 controller: He goes into a lot of detail and has a Arduino library to boot.

Phase 2
Found out that Nintendo (Wii) Nunchuks are very easy to interface with an Arduino. The Nunchuk communicates over I2C, which the Arduino is capable of reading directly. Tod Kurt invented an adapter that is super easy to use: He also lists a corresponding Arduino library. I order an adapter ($4 from, free shipping!) as backup in case the PS2 doesn't work.

Also found out that people using non-Sony PS2 controllers were having a lot of trouble using them with Arduinos. In retrospect I should have invested the extra ~$4 and bought an authentic Sony PS2 controller.

Phase 3
Attempted to crimp wires from the PS2 to the Arduino, and didn't get it to work. Tried to solder the wires but they are very thin and weak copper wires, and hard to solder. Bought a Nintendo Nunchuk and hooked it up to the Arduino using Tod's adapter and got some test code ( working. Tested the accelerometers, Z, and C buttons. I had a lot of trouble getting the Arduino to print values to the serial monitor but eventually got it to work. Here's an example:

// This program prints out something when you press the z button.

#include <math.h>

#include "Wire.h"
#include "WiiChuck.h"
#include "nunchuck_funcs.h"

#define MAXANGLE 90
#define MINANGLE -90

WiiChuck chuck = WiiChuck();
int angleStart, currentAngle;
int tillerStart = 0;
double angle;

void setup() {


  Serial.print("Setup done!");

void loop() {
  if(chuck.zPressed()) {
    Serial.println("Zbutton pressed");
  else if(chuck.cPressed()){
    Serial.println("cButton pressed");

No comments:

Post a Comment