Arduino Retro Game Controller (Atari)

by millerman4487 in Circuits > Arduino

3464 Views, 16 Favorites, 0 Comments

Arduino Retro Game Controller (Atari)

IMG_20171220_165233828-01.jpeg

The Atari 2600 was a a home video game console made by Atari, Inc. It was released on September 11, 1977. You could play games like Frogger, Pac-Man, and Space Invaders. Since it is such an old console there's not a whole lot you can do with it, so I decided to repurpose its controllers and make something new with them.

Cut the Cord and Clean It Out

IMG_20171220_165418686-01.jpeg
IMG_20171220_165656516-01.jpeg
IMG_20171220_175234410-01.jpeg
IMG_20171220_165454302-01.jpeg
IMG_20171220_165638088-01.jpeg
IMG_20171220_165707831-01.jpeg
IMG_20171220_165732455-01.jpeg
IMG_20171220_165746080-01.jpeg
IMG_20171220_165834655-01.jpeg
IMG_20171220_165941688-01.jpeg
IMG_20171220_165923887-01.jpeg
IMG_20171220_170109770-01.jpeg
IMG_20171220_170230255-01.jpeg
IMG_20171220_170307171-01.jpeg

I tried just sticking some jumper wires directly into the pins but they were too small and didn't fit, so we'll just cut off the end of the cord. Next, you should clean the controller since its probably nasty from not being used in 30 years. Here you go:

  1. Cut the cord a little bit from the end
  2. Undo all four screws in the back
  3. Pull out the electronic board (with the cord attached)
  4. Take apart all of the plastic pieces
  5. Carefully pry off the little plastic circle
  6. Wash all of the plastic stuff with soap and water
  7. Rinse it off
  8. Let it dry
  9. Put it back together (the same as taking it apart, but in reverse)

Solder Pins

IMG_20171220_175753851-01.jpeg
IMG_20171220_175220520-01.jpeg

Like I said before, the built-in pins were too big for jumper cables. We'll have to make our own with some headers from SparkFun. If you're new to soldering, here's a helpful link.

  1. Strip the cord you just cut (you should see six new colored wires)
  2. Strip each of these wires as close to the end as you can
  3. Break off a six piece segment of headers
  4. Carefully solder the six wires onto the headers. It doesn't matter what order, but I did:
    • Black
    • Orange
    • Brown
    • White
    • Green
    • Blue

Connect to Arduino

IMG_20171220_161325443-01.jpeg
Atari2.png
IMG_20171220_161335908-01.jpeg

Follow the above diagram to connect this circuit to the Arduino board.

  • Black (ground) to GND - this isn't shown in the diagram, so just pretend it is.
  • Orange (button) to D3
  • Brown (right) to D5
  • White (up) to D6
  • Green (left) to D9
  • Blue (down) to D10

You'll notice we only used the PWM~ pins. This is because if we compensate for it in the code, we can avoid having to use resistors in the circuit.

Serial Code

This code will allow you to view all of the incoming data in the serial monitor:

void setup() {
  pinMode(3, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);

  Serial.begin(9600);
}

void loop() {
  digitalWrite(3, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);
  digitalWrite(9, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(10, HIGH);

  Serial.print("Button:  ");
  Serial.print(digitalRead(3));
  Serial.print("\tLeft:  ");
  Serial.print(digitalRead(9));
  Serial.print("\tRight:  ");
  Serial.print(digitalRead(5));
  Serial.print("\tUp:  ");
  Serial.print(digitalRead(6));
  Serial.print("\tDown:  ");
  Serial.println(digitalRead(10));
}

Alternate Circuit

Atari.png

This one is a bit more complicated, but it will allow the control of two servos using the Atari controller. I added a battery pack to the diagram because using multiple servos can draw a lot of power.

Test It in Real Life

IMG_20171220_165233828-01.jpeg

As an example to show you how this can be applied, I made a turret with two servo motors that can move in four directions (up, down, left, and right). Use this code:

#include <Servo.h>

Servo base;
Servo tilt;

int xangle = 90;
int yangle = 90;

void setup() {
  pinMode(3, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);

  base.attach(7);
  tilt.attach(8);

  base.write(xangle);
  tilt.write(yangle);

  delay(100);
}

void loop() {
  digitalWrite(3, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);
  digitalWrite(9, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(10, HIGH);

  int left = digitalRead(9);
  int right = digitalRead(5);
  int up = digitalRead(6);
  int down = digitalRead(10);
  int button  = digitalRead(3);

  if (right == 0) {
    if (xangle < 180) {
      ++xangle;
    }
  }
  else if (left == 0) {
    if (xangle > 0) {
      --xangle;
    }
  }

  if (up == 0) {
    if (yangle < 180) {
      ++yangle;
    }
  }
  else if (down == 0) {
    if (yangle > 0) {
      --yangle;
    }
  }

  tilt.write(yangle);
  base.write(map(xangle, 0, 180, 180, 0));
  delay(10);
}