This guide will show you how to use the NI myDAQ along with LabVIEW to create a 3D Tennis Game. The project is low cost and simple to put together. The LabVIEW VI is given along with documentation on running the game. The hardware is easy to find at radio shack as well.
· 1x myDAQ
· 2x Infrared phototransistors
· 1x Infrared LED
· 2x 4.7K ohm resistors
· 2x 15 ohm resistors
· 1x small switch
· 25 feet of wire
· 1x Marker or Highlighter(large enough to fit AA batteries inside)
· 2x AA batteries
· Tape or Soldering Iron
Approximate cost: $14
First, start out by building the transmitter using two 15 ohm resistors in series connected to the long lead of the LED. Next, empty the internal parts of the marker and place the LED lead with the resistors into the marker. Try to make a spring from the lead of the last resistor so it can have some force and contact the batteries when placed inside the marker. Tape or glue the LED onto the edge of the marker. Connect the switch and wire in between the remaining LED lead, and the back of the last battery. See figures 1 and 2 for details.
Figure 1. LED assembly
Figure 2. Transmitter assembly
Next, you will make the receiver circuit using two phototransistors shown in figure 3. You should make all the wires about the same length as well, about 2 feet. Notice that 0-, 1-, and GND are all connected. The myDAQ provides 5V power to both phototransistors. The outputs 0+ and 1+ will be almost 5V when the IR LED is pointed towards phototransistor, and almost 0 V when the IR LED is pointed away.
Figure 3. Receiver Circuit
You can either solder the wires and resistors or use a bread board as shown in Figure 4. I also recommend using tape so the leads do not touch.
Figure 4. Receiver Circuit
It is also recommended that you secure the phototransistors to something hard with about an inch space away from each other diagonally in the upper right corner. The LED connected to A1+ is the vertical controller and the A0+ is the horizontal controller. Place them according to the Figure 5.
Figure 5. Receiver Positioning
The software for the myDAQ 3D Tennis game is included in the zip file. Unzip all the files into a single folder and run the myDAQ 3D Tennis VI. With the VI open, press the Run button on the top left. Immediately, the position of the racket should go to the bottom left corner. Point your transmitter somewhere to the left and down of your two receivers. These signify the upper right edge of the screen so the center is somewhere down and left. You might have to adjust the position of the receivers and possibly the angle as well. You should have the transmitter about 8 inches away. Continue adjusting the position of the receivers until you can control the racket well. You will notice the phototransistors are extremely sensitive so you will barely need to move the transmitter at all.
After you have successfully found the center of the screen and can control the racket on the front panel of the VI using the transmitter, you can click anywhere on the VI and the ball will start moving towards you. Move the transmitter so that you can block the ball from hitting you. When you’ve hit the ball, the racket will change color for a split second to let you know you have hit it. The ball will go deep into the screen and bounce back at you in some random direction. Each time it bounces back towards you, the speed of the ball will increase! I’ve gotten to about 15 before I lost from the few practice games I played. How high can you get?
When you’ve missed the ball and it hits you, it will stop moving. Just click anywhere on the screen to reset the ball position and click again to start. Good luck!!