Main Logo

Having finished the USB Controller, I was still left wanting more out of playing Nintendo on my computer. Namely, one of the classic original NES games, Duck Hunt. Most of the emulators allow you to play with the mouse and click on the ducks..... but that is terribly boring. So I set out to modify the Zapper to work over USB as well.

Before we figure out how we are going to modify the Zapper, we need to fully understand how it works. The Zapper is one of the more clever controllers to come out of 1984 in my opinion. The Zapper schematic, shown below depicts the internals of the gun. There are not many parts and I couldn't even find the datasheet for the IR3T07A IC datasheet anywhere. However, the theory is pretty easy to understand even without this datasheet. The IC functions as an IR preamplifier and demodulator. The frequency of the demodulation is set by R3 and C4. The outputs are open-collector, which means that the Nintendo must have pullup resistors on board. R4 serves to limit the current to the Zapper gun. R3 and C4 collectively set the filter frequency, although without the datasheet its difficult to know their exact values. R2 helps to bias the output transistor, Q1. Q2 is the actual phototransistor. C5 helps to debounce the switching noise generated by the fire trigger.

Zapper Schematic

The Nintendo system uses the following sequence of events to detect if you managed to snipe the duck off in mid-air. Once the trigger has been pressed, the Nintendo checks for a light signal from the gun. If there is a light signal (aka, the gun is pointed at the TV), then it blanks the screen (all black) and then checks the gun again. If the gun doesn't come back as no light, then it is a miss. If the gun comes back showing no light, then the console draws a white box around the target. If the gun registers white, then it is a hit. All of this takes place at the refresh rate of a NTSC, 15KHz. Since there is a bandpass filter for the detection circuit with a corner frequency of 15KHz, the gun certainly wouldn't work (without modification) on a CRT computer monitor because the refresh rate is 31KHz. Worse yet, it wouldn't work at all on an LCD because there is no cathode ray tube (CRT) in an LCD.

This presents some interesting challenges. On a normal CRT, one solution would be to modify the filter circuit and change the corner frequency from 15KHz to 31KHz. I have been told people have had success with this by simply placing a 390k resistor in parallel with the one already in the circuit to form a 180k resistor. However, this still leaves the LCD guys (like myself and many others) high and dry. However, I have not lost all hope yet. Since most emulators provide support for the gun in the form of the mouse, what if we could emulate the mouse with the gun? That is, moving the gun would move the mouse around... And the trigger button would serve the same as a mouse click. Now things are starting to sound a little better, but there are still quite a few problems to tackle!

First off, how do you check for movement of the gun? The idea that I have is to use an accelerometer and create an Inertial Measurement System. The main problem with this approach is that since we will be integrating the acceleration twice, small errors will accumulate to very larger errors over time. The other assumption, is that we do not know the initial conditions, so we will take them to be 0. Thus,

The other issue that we have not accounted for, and I believe it is actually fairly difficult, is to account for tilt of the accelerometer. We could easily add another accelerometer to measure acceleration in the Z axis, and use a linear transformation to transform the vector back into a single plane. However, that adds another expensive accelerometer ($20 each) and requires some very math intensive operations. Another option would be to use a gyrometer to measure the tilt and again use a linear transformation to put the vector back into the correct plane. Again, these sensors are also very expensive. So at this time, I think that we should just run with the one accelerometer and hope for the best.

In the schematic below, you can see that there is actually no accelerometer in the schematic. This is because it has to be on a different board parallel to the plane that we are measuring the accelerations to, namely the monitor. The board for this project will be designed to fit in the exact same location as the old board, which we will remove entirely since it is not of much use to us anymore.

New Zapper Schematic

Most of the component in the schematic are similiar to the previous project, so I won't talk much about them. R1 and D1 can be omitted, they are just for show. Since we don't have anything shooting out of the end of the gun, we use an LED so that it lights up when its being fired. J1 is the connector that will hold the accelerometer board. J2 is used to program the PIC. J3 is the USB connections. C1 is needed for the internal USB voltage regulator on the PIC, C2 and C3 are decoupling capacitors. Lastly, R2 is a pullup resistor for the switch since the old pullup resistor was inside of the Nintendo console, we need to explicitly add one here. The layout of the board is shown below. It is the exact same size as the original board. Note, that slots will have to be drilled in the board so that it fits into the slots in the gun.

Board Layout

The other board is the accelerometer board. The accelerometer board contains only a few components necessary to set the configuration of the Analog ADXL202 +/- 2.5g Accelerometer. The capacitors, C1 and C2 are filtering capacitors. R1 sets the period of the output PWM waveforms. R2 and C3 help to eliminate noise on the supply rail and give the IC the cleanest supply possible.

ADXL Breakout Board Schematic

The layout for the board is extremely compact since there is not a lot of room in the gun for a riser card. Also note, if you are making this at home, I made the pads on the ADXL202 a little larger than they really need to be to ease the soldering. The IC comes in what is called and LLP package, which has no leads. Normally, there wouldn't be any exposed pads, but it makes it much easier to solder if you don't have a reflow machine (I don't and I really suspect that if you are reading this, you don't either).

ADXL202 Board Layout