Higinbotham, head of the Instrumentation Division at Brookhaven National Laboratory, designed his game as an exhibit to improve what was an otherwise lackluster visitors’ day at the lab. Tennis for Two presented a tennis court– shown from the side– on an oscilloscope screen, where handheld controllers allowed the two players to toss the ball to each other. Each controller had two controls: a button and a knob. With the button, you could hit the ball at any time of your choosing when it was on your side of the net, and with the knob you could choose the angle at which the ball was hit.
The game was based on the best contemporary technology: analog electronic computers built out of op-amps, relays, and the occasional transistor. It took Higinbotham and his technicians several weeks to design and build the game. Of course, some things have changed over the last 50 years. Using convenient modern electronics, we have designed a functional and playable replica of the original that can be put together by a hobbyist in a couple of evenings. You can watch the video of our recreation on YouTube or embedded here:
So, the next question you might ask is, “How do you build this?” And, if that is in fact what you’re asking right now, you’re in the right place. The quick answer is, “with an oscilloscope, an AVR microcontroller, and a digital to analog converter.” Ready to get going?
Before we start, let’s be clear that this is not a tutorial in how to build an oscilloscope. Tennis for Two is supposed to display on a ‘scope, so beg, borrow, or buy one if you don’t have one handy. Older low-end analog scopes like mine (a Hameg!) usually go for $50-$150, and if nothing else, you can always make a Scope Clock out of it later.
There are three parts to the electronics that we’re building. First, there is the AVR microcontroller– the brains of the outfit. The specific variety that we’re using is the ATmega168, the same chip used in (for example) the Arduino platform. Secondly, there are two handheld controllers that connect to the ATmega168 microcontroller. Each handheld controller has a knob and a button. Third, there is the digital to analog converter that takes the output from the AVR and uses it to drive the scope.
First, let’s look at the handheld controllers:
There two controllers are identical little project boxes that each have the button and knob, as well as a cable going back to the other electronics. The controllers themselves are built from 3x2x1″ plastic project boxes with aluminum lids, e.g., Philmore #PB140 or Radio Shack #270-1801. Let’s take a peek inside.
Inside each controller we have a 10k single-turn pot (Jameco #286206) and pushbutton (Jameco #26623). The knob on the pot is a fancy machined aluminum type for extra snazz. (Jameco #138482). The pot is used to vary an output voltage (that controls the firing angle) between 0 and 4.5 V, and the button, when pressed, pulls one of the inputs from 4.5 V down to 0V. (We use an external 10k “pull-up” on the pin to make that happen.) The circuit diagram for one of the controllers looks like this:
To simplify the wiring, we used some old Cat-5 (ethernet) cable as the cables for the controllers. Inside Cat-5 cable are four color-coded twisted pairs: orange, green, blue, brown. For each of these, we stripped and twisted the two conductors together to make four effective (but thicker) color-coded wires. We used orange (+4.5 V) and green (ground) for power, and the other two for signals: brown for the analog knob output and blue for the button switch output.
Next, let’s look at the AVR microcontroller:
(This is admittedly messy but it will make sense in a moment. )
To use an AVR microcontroller, we need to provide it with power and ground– usually 3-5 V– and we also need to be able to hook it up to a programmer (at least once). How do do that is described in this article about “minimal target boards” for AVR microcontrollers. I took the easy way out and just used one of our business cards which takes care of the power and programming connections. (The cards are available here),
Power for the board comes from a 3xAA box (4.5 V output). I use a usbtinyisp programer (See review); there are other neat ticks like using an Arduino as a programmer.
Let’s look at a diagram for what else is connected to the microcontroller:
We’ve already discussed how the power and programming pins come into play. The other two things to notice are the connections for the handheld controllers and the digital outputs. The blue and brown lines from the two handheld controllers hook up as shown, and the power and ground (orange and green) lines to the handheld controllers also get hooked up to the power and ground pins on the AVR, or anywhere on its target board.
The remaining pins labeled on the diagram of the microcontroller are the 16 digital output lines: PB0 – PB7 and PD0 – PD7. These two eight-bit output ports will be used to control the output that goes to the scope– the “PB” outputs will control the “X” position and the “PD” outputs will control the “Y” position of the oscilloscope beam. But, the scope takes analog outputs and these signals are digital. So, what we need next is a
digital to analog converter (DAC).
For our DAC, we used a very simple and forgiving topology, the so-called R-2R scheme with 8 bits of resolution. When compared with the other (cheap) method of making a DAC on an AVR, the advantage of this scheme is that it has higher frequency performance– a big plus for drawing clean dots on our scope screen. On the down side, it is a little more tedious to build and has only 256 resolvable levels. Still, a 256 x 256 grid turns out to be just fine for playing games on the scope screen. (See also this article about building a R-2R DAC on an Arduino Protoshield.)
Each of the R-2R chains is composed of nine 10k resistors and seven 5k resistors. (Note the name “R-2R”– you can actually vary the values a bit as long as you keep the ratios and locations the same– e.g., nine 20k resistors and seven 10k resistors should also work fine.) To actually hook this up, we brought the PB and PD signals over onto a new piece of perfboard with a couple of ribbon cable segments, so that we’d have room to set up all of our resistors:
The output of each R-2R chain goes to a BNC cable that hooks up to the scope. Because we actually need two BNC inputs to the scope, we used one single BNC cable, cut in half and stripped. Be sure to hook the shielding braid of the BNC cables up to the ground of your circuit.
And then as the last hardware step, hook the two BNC outputs of the R-2R chain up to the scope and put the scope in X-Y mode.
The firmware for the AVR is being released under the GPL. You can download it here (6 kB .ZIP file) and install it through your favorite interface.
That’s it– you should be good to go. You will need to adjust the X and Y offsets and scales on the scope so that the court and ball show up where they are supposed to. And, if you are so inclined, there are plenty of parameters and routines to mess with in the source code.
Finally, special thanks to Grow-a-Brain where we first heard about this wonderful game. We wouldn’t have built it if we hadn’t found out about it in the first place. :)