Connecting an Atari Controller to a Computer

I’m not sure what lead you here, but if you just want the code to be able to connect an Atari controller to a computer, using an Arduino Micro, head on over to my GitHub project. If you want to learn more about how I worked through this project, read on.

If you have any questions, comments or feedback, leave them below!

Introduction

Atari VCS “Heavy Sixer”

The Atari was my first video game system and I still enjoy the games to this day. Given I also like technology, I’ve been very interested in the approachability of the Atari, the controls and the 6502 chip. Where the complexity of a modern game or gaming machine is nearly incomprehensible, the Atari is much more approachable.

Another interest I’ve had is where hardware meets software. Because of this interest, I was looking for a project to use an Arduino. Putting all these interests together, I decided to create a project tha would allow me connect my real CX-40 Atari joystick to my modern computer to play the Atari emulator, Stella.

To be clear, what I did is not unique, it has been done a millions times in a million different ways. In fact, I have a commerical (now discontinued) product called 2600-Daptor that does exactly what I’ve done in a nice professional package.

The original CX-40 Atari joystick has a straightforward vocabulary: up, down, left, right, and fire. It connects to the Atari with a simple DE-9, 9 pin, connector.

Original Atari CX-40 Joystick with DE-9 Connector

Connectivity

Connectivity Diagram

But how do I connect a 40+ year old connector to a modern computer? To solve this problem, I need to connect the controller’s male DE-9, to a female DE-9 breakout, that I could wire to an Arduino board. The Arduino board could then attach to the computer via USB. This block diagram shows the connectivity from the joystick through to the computer

The build brought together wiring, small Arduino programs, and a USB joystick library.

The project’s final wiring, as documented in the repository
The wiring photograph from the project repository.

Parts list

These are the main parts I bought for the build, with the product links saved in my project notes:

  • Arduino Micro — the board that reads the joystick inputs and connects to the computer over USB.
  • DE-9 breakout connector — makes the joystick connector’s individual pins accessible through screw terminals.
  • Solderless breadboard — holds the Arduino and provides a convenient way to prototype the connections.

The setup also uses connecting wires, a USB data cable, and my Atari CX-40 joystick.

Making a Connection

The first thing I needed to understand was how to connect the Atari controller to the Arduino board. I started with understanding the Atari side, the DE-9 connector.

DE-9 Connector

The Atari joystick connects through a DE-9 connector, a nine-contact member of the D-subminiature family developed by Cannon in 1952. Atari adopted this connector for the Video Computer System, later known as the Atari 2600, when it launched in 1977, and the design went on to become a common joystick interface on other home computers.

For the basic joystick, the wiring uses only six of the nine positions: four for direction, one for fire, and a shared ground. If you look closely at the end of the joystick’s connector, you can see that some holes have no metal contacts inside, the unused positions don’t need an electrical connection. Moving the stick or pressing fire closes the corresponding switch, which is what makes this controller such an approachable starting point for an Arduino project.

Atari DE-9 joystick connector pinout, viewed from the front of the console-side port
Atari DE-9 pinout, viewed from the front of the console-side port.
Controller functionAtari DE-9 pin
Fire6
Up1
Down2
Left3
Right4
Ground8

Arduino Micro Pins

Another concept I learned about was the concept of a “pull up” resistor. In digital electronics, when a button isn’t pressed, the switch is “open”. However, you can’t reliably use such a set up because that pin can pick up electrical noise which would produce unpredictable readings. Pins like this are said to be “floating”.

To address this, digital circuits can use a “pull up” resistor. Below is a diagram to show how the circuit is wired. When the switch is open the circuit is read as HIGH.

When the circuit is closed, power flows from 5 V to ground and the input pin is read as LOW.

Rather than having to complicate the circuitry of the the Arduino has  built-in pull-up resistors  to solve this. Setting a pin to INPUT_PULLUP enables an internal resistor that gently pulls the input toward the Micro’s 5-volt supply, giving it a steady HIGH reading while the switch is open. Pressing the button connects that input to ground, making it read LOW; the resistor limits the current flowing from the supply to ground. This simplified my wiring because I didn’t need to add an external resistor for each switch—just connect each controller signal to an input and the controller’s common ground to the Arduino’s GND. The slightly counterintuitive result is that LOW, or 0, means pressed, while HIGH, or 1, means released.

Arduino Pin Options

Arduino Micro pinout diagram
Arduino Micro pinout reference used for the controller interface.

The Arduino Micro’s pins also became less intimidating once I understood their different jobs. Power and ground pins provide electrical connections, digital input/output pins read or produce HIGH and LOW signals, and analog-capable inputs measure a range of voltages. Some pins have additional capabilities, such as PWM output or communication interfaces, so these categories overlap.

For this joystick, each control is simply a switch, making ordinary digital inputs a good fit. I used D2 for fire and D3 through D6 for up, down, left, and right, with each configured as INPUT_PULLUP. Those pins have other capabilities too, but this project only needs them to answer one question: is the switch open or closed?

Pin Mapping

Now that I know the right DE-9 pins and Arduino pins to use, I created a mapping table so that I could start to wire them up on the breadboard.

Controller functionAtari DE-9 pinArduino Micro connection
Fire6D2
Up1D3
Down2D4
Left3D5
Right4D6
Ground8GND

A small set of parts and a clear first goal

The hardware centered on an Arduino Micro, a breadboard, and a DE-9 breakout connector for the Atari controller. The breakout made the controller’s individual connections accessible to the Arduino.

I have never used an Aduino before and was not familiar with how to program it. The immediate goal was simple: read the fire button. Once that worked, and I could see the results in the terminal, the same approach could be extended to the four directions. USB reporting added another layer, translating those physical inputs into gamepad controls. So, overall, the steps were:

  • Determine the proper wiring between the DE-9 breakout and the breadboard
  • Wire up the fire button first and write a simple program that allowed me to detect the button press at the Mac terminal
  • Wire up the rest of the directions (Up, Down, Left, Right) and detect them at the terminal
  • Use a USB library to convert those symbols into something that could be interpreted by another program, in this case, the Atari emulator, Stella.

Program 1: Detect the Fire Button

First I wanted to create a simple program that would just detect the fire button and print it to the console. This would be a way to test out our connectivity and process from end today. Below is my first program with detailed comments included. You can also download it here.

// Set up - This section sets up the program
void setup() {
// put your setup code here, to run once:
pinMode(2, INPUT_PULLUP); // Set pin 2 for button
// starts serial communication between your Arduino
// and your computer at 9600 baud—the communication speed.
// This is needed so you can print output ot the serial monitor
Serial.begin(9600);
}
// This variable will be used in the IF statement below
String button = "Released";
// The bulk of the program is done within the the loop.
// With each loop, it is checking the inputs it is recieving and taking actions
void loop() {
// put your main code here, to run repeatedly:
// Establish a variable that holds the value of the fire button in this loop.
// If the button is pressed, the digitalRead will read "0", otherwise it will read "1"
int Fire = digitalRead(2);
// Debug lines:
// Serial.println(Fire);
// delay(1000);
// since this is a loop, if you just print to the console when an input is detected,
// it will send a constant stream of output to console (one value for each loop)
// I only wanted to send a value once when the button was pressed and once when it was released
// This IF confirm that the button is pressed AND that we didn't send Pressed command in the last loop
if (Fire == 0 && button == "Released") { // Use "&&" instead of "and"
// When the above condition is met, I set the variable to "Pressed" so that it cant be
// true the next time the comes around.
button = "Pressed";
Serial.println(button);
} else if (Fire == 1 && button == "Pressed"){
button = "Released";
Serial.println(button);
}
}

The result of the program is below. Each time you press and release the fire button, it is reported in the Arduino IDE terminal:

The first obstacle: a button that would not register

My journal entry for August 24, 2026 captures the first debugging session. The Arduino could read an input when I shorted the connection, but it could not read it through the joystick and breakout.

That observation helped narrow the problem. A direct connection produced a response, so the next place to look was the physical path between the controller and the board. I checked continuity in the connector, which was OK, and then moved on to the breakout.

The problem was the breakout terminal: it had been screwed the wrong way. After correcting that, I was able to write the first program to detect a fire-button press.

It was a small fix, but a useful lesson from the build. Before changing the program, check whether the signal can actually reach it. The build journal records that breakthrough, along with my first notes about learning debouncing.

The repository’s Atari pinout is shown from the front of the console-side port. That viewing direction matters when matching the diagram to the connector; the pin numbers are the reference to follow.

Atari DE-9 joystick connector pinout, viewed from the front of the console-side port
Atari DE-9 pinout, viewed from the front of the console-side port.

The sketches configure the inputs with INPUT_PULLUP. In this arrangement, an idle input reads high, and an activated control pulls the input to ground so it reads low. In the program, that means 0 represents a pressed button or an active direction.

That detail becomes especially useful later, when translating a physical button press into a USB gamepad event.

Program 2: Adding the Four Directions

The ReadButtonAndDirections sketch extends that pattern to all five inputs. It reports when each direction starts and stops, alongside the fire-button messages.

This creates a way to check the controller wiring before involving USB gamepad behavior. Each control has its own readable response.

Lesson on Switch “Bounce”

One unexpected lesson was something called switch bounce. I had assumed that pressing a button produced one clean electrical change. In reality, the controller’s mechanical contacts can briefly make and break contact as they settle, and the Arduino can read those rapid changes as multiple transitions from a single press. What felt like one action in my hand could look like several events in software. This was the physics of the controller showing up as an issue I had to resolve in the program—a process called debouncing. I would never have realized this was happening if this project hadn’t taken me into the interface between hardware and software.

The sketch includes a 20-millisecond delay labeled as debouncing. The delay slows the polling as a simple first measure, though it does not implement a full check that an input has remained stable for a specified time.

Program 3: Bringing the inputs and USB interface together

Now I needed to send the detected inputs to USB. To do this, I used MHeironimus’s Arduino Joystick Library This a great library that can be included into your program to do the heavy lifting translating the inputs to USB inputs that presents to the computer as a gamepad.

The JoystickUSBInterface sketch brings input reading and USB reporting into the same program. It configures a gamepad with one button and X and Y axes, with each axis assigned a range of -1 to 1.

It reads the fire button and four directions through Arduino pins D2–D6, using internal pull-up resistors so an activated control reads as LOW. The program reverses the fire-button reading to match the USB library’s pressed/released convention, then translates left and right into X-axis values of −1 and 1, and up and down into Y-axis values of −1 and 1. Each axis returns to 0 when neither direction is active, and independent axis handling allows diagonal movement. The sketch also retains the earlier Serial Monitor messages, printing only when a control changes state, and pauses 20 milliseconds between readings as a simple measure to reduce switch-bounce effects.

What this build taught me

The most concrete lesson was the first one: a connection problem can look like a programming problem. Being able to trigger the Arduino directly gave me a useful comparison, and checking continuity led me back to the breakout terminal.

The other lesson is visible in the collection of sketches. A controller interface becomes easier to understand when each piece has a small, observable test: detect one button, read the directions, generate a USB button event, and then combine the pieces.

That makes the repository useful as a record of the build. It captures the wiring decisions, the first successful input, and the steps toward translating an Atari controller into a USB gamepad.

Explore the project

The wiring references, Arduino sketches, build journal, and final wiring photograph are available in my Arduino Atari Controller repository on GitHub.

Questions or comments?

Do you have any questions or comments about what I did? Leave them below!


Comments

Leave a Reply