Task: Augment an Atari 8-Bit Computer Program with an LED Array Connected Through the Joystick Port
Needed: Arduino UNO, Arduino IDE software, Atari joystick, Jumper wires, Breadboard, Atari XL computer, LED Array
Time: about 1-2 hours with all components ready
The goal of this project is to use modern hardware to augment a program running on an Atari 8-bit computer. In other words, this is an experiment in human-computer interaction (HCI) where an LED array is used to convey additional information from a game or other piece of software that might add value to what the user is seeing on the screen. Here, the LED array is connected to the Atari through the joystick port. I have covered in a previous post how to send binary or digital data out through the joystick port and have those signals read by an Arduino microcontroller. Here, the Arduino interprets those signals and displays information on the LED array. The Arduino could be programmed to display patterns, shapes (e.g. objects), pixel maps, numbers, or letters, for example. For example, you could imagine a rogue-like game where the rough location of the player in the dungeon is displayed on the LED array.
Before embarking on this project, I recommend reading and completing my previous post on sending data out through the joystick port. This will get you 80% of the way through the present project.
First, read and complete the previous project I mentioned on sending data through the joystick port. This will get you up to speed on how the Atari data part of this works. The key difference is that we will monitor all four PIA-controlled joystick port pins (1-4) for a stream of four bits to the Arduino.
Second, connect four jumper wires to the Atari joystick port (you could also a joystick connector like I did in the previous project). You will need jumpers with a female end (for the Atari) and a male end (for the breadboard). I used white (pin 1), yellow (pin 2), orange (pin 3), green (pin 4), and a black for ground (pin 8). I connected these to a breadboard and then connected additional jumper wires of the same colors to digital ports 2 (white), 3 (yellow), 4 (orange), 5 (green), with the black ground wire going to the Arduini ground port on the other side of the board. The photos below show the connection to the Atari and the breadboard wiring. You could skip the breadboard and run wires directly to the Arduino if you want. The breadboard does provide some distance from the Atari and the possibility of using a pulldown resistor which I did not use in this project.
The third step is to purchase an LED array. I ordered an 8×8 array from BTF Lighting on Amazon. This array is flexible, had decent reviews, and was only $10.
The fourth step is connect the LED array to the Arduino. The back of my array is shown below. There are several different connector types giving the user some flexibility. I am using the female connector shown on the bottom with a 5V input for power (red wire), a ground wire (white wire), and a digital input signal that controls which LEDs are lit. I used a red male-male jumper to connect the LED to the Arduino 5V power. I used a black wire to connect the ground to the Arduino. I used a green wire for the digital input plugged into digital pin 10 on the Arduino. The fully connected Arduino is shown in the next photo below.
The fifth step is to load the BASIC program into the Atari. Here is a text file with the BASIC code. The program is pretty short without the comments and can be typed in quickly. Alternatively, you could create an ATR file on your PC and boot from a FujiNet or other device such as SIO2PC.
The sixth step is to load the Arduino code into the IDE and flash it to the Arduino. Here is a zip file with the code for the Arduino IDE. This can be copied and pasted into the IDE. Once loaded you can then flash the Arduino. Note that the code requires the Adafruit_NeoPixel library freely available on GitHub. You can load this by navigating to the Sketch menu otion and choosing Include Library and then choosing Add Zip.
Finally, you are ready to try the demo. When you flash the Arduino you should see the LED array light up as shown above. You can set the DELAYVAL constant in the Arduino code to control how fast the LEDs are drawn. You can also control the brightness with BRIGHTNESS constant. A value of more than 50 is pretty bright and could hurt your eyes. You are now ready to run the BASIC code on the Atari. Once running a value of 0 should appear in the middle of the screen and the Arduino should be lighting up all the LEDs drawn in a snake like pattern. Use the – key to increase the value to 7 and the = key to decrease it back to zero. With a pause in between keystrokes, you should see the pattern change on the LED. Here is a short movie showing the demo in action.
This project opens the door to developing some pretty cool games augmented by an LED array or, with some extra effort, perhaps even a small LCD display (future project?). I love thinking about the possibilities. I would love to hear your ideas!
Note that I originally had joystick pin 1 coming to the Arduino through digital pin 1. I couldn’t figure out why that bit was always set to one. This drove me nuts until remembered there is a special marking of TX on that pin and pin 0 (RX) indicating these are used for serial communication. When I shifted the inputs over a pin it worked fine.
Also, I only used 4 bits coming from the PIA-controlled pins on joystick port 1. Further, I only used decimal values 0-7 of the possible 16 numbers. One could expand the options by using the additional bits from port 1 and the 16 from port 2 making an 8-bit byte. Of course, this would use up both joystick ports on an Atari 800XL leaving the keyboard for gameplay.
Note you can change the color of the LED pixels using the Adafruit Neopixel library command: pixels.setPixelColor(i, pixels.Color(0, 150, 0)); The three values represent RGB colors with values from 0 to 255.