[PD] Nintendo gun with Pd ?

Roman Haefeli reduzierer at yahoo.de
Sat Dec 4 03:57:21 CET 2004

hi mathieu
hi list

i don't really know how this gun works, but i suggest it's slightly
different from what you have explained. so have in mind that the
following is just a not verified theory.
a normal tv-screen (crt) is "scanned" by a electron beam (don't know the
correct expression) from top to the bottom in lines probably from left
to right. that means in every moment you would see only a point, if your
eye would be fast enough. because our eyes are so slow, we have the
illusion to see an image, which is redrawed 50 times a second (50
half-frames in PAL).
the photosensor of  the gun is fast enough to see the point. when you
point the target and click,  the console detects only at the moment,
when the electron beam is drawing the target, if the photosensor detects
light or not. if yes, it knows, that you were pointing the target, if
no, it knows you were pointing somewhere else. so this also explains,
how it works to identify different targets.
this works well with a console like nintendo and a crt-screen, because
the screen is synchronized to the video-signal from the nintendo. to do
something similar with a computer is a little bit more complicated. if
my suggestion is right, using a tft-monitor wouldn't work. but even with
a  crt-monitor you have to conisder different framerates and different
resolutions (which means different horizontal line frequencies). how
does the gun-interface get a sync-signal?
there you come to a few problems to solve.

may it's simpler to follow another approach than the one of the nintendo
gun. why not building a gun yourself? maybe colorsensitive, with three
photosensors? this means, that your target must have a defined color...
other ideas?


----- Original Message -----
From: "Mathieu Bouchard" <matju at sympatico.ca>
To: "Alexandre Quessy" <listes at sourcelibre.com>
Cc: <pd-list at iem.at>
Sent: Friday, December 03, 2004 11:36 PM
Subject: Re: [PD] Nintendo gun with Pd ?

On Fri, 3 Dec 2004, Alexandre Quessy wrote:

> Pd is quite amazing, and we can do just about anything. It's
> interesting to offer something else than keyboards to interact with
> electronic art. What about a Nintendo or SEGA gun ?

AFAIK, the way the Nintendo gun works is that it is a simple photosensor
that is made very directional by usage of both a lens and a thin cannon.
Therefore, for using it, when a click is detected, the program usually
blanks the screen except for a few targets, and then figures out whether
the gun detects a target.

I don't know how it differentiates between two targets; maybe it uses a
sequence of black frames containing one white region each, and then does
some tight realtime figuring out the exact frame that the gun detected.
It's also possible to figure out in one frame the vertical position on
screen using sub-millisecond timings and a lot of sync; but to
differentiate two regions at the same height you'd need two frames
i'm missing some trick)

I found this:


And from what i can guess,

   / o| 1
5 |o o| 2
6 |o o| 3
7 |o o| 4

1 is ground,
2,3,4 is a serial port for the 8 buttons not in the gun,
5 is +5 volts
6 is a bit (not an analog signal) for the lightgun value
7 is a bit (inverted) for the trigger of the gun

You could use one of the three available parallel port externals as a
to connect to pd. Then you plug nintendo pins 5,6,7 into, say, pins
2,10,13 of the parport. Then you send the 255 byte so that pins 2-9
provide +5V. I hope there is enough amperage in pin 2 for the gun to
but if you need more, try several pins at once (or maybe it doesn't do

Note: If using linux lp driver, you have to ground pins 12,13 (onto,
pin 25) to be able to send anything, else it blocks. Marc Lavallée's
parport external avoids this issue but requires root access to run.

It would also be possible to use the db15 joystick port for that, if
that's easier. See

Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju

PD-list at iem.at mailing list
UNSUBSCRIBE and account-management ->

More information about the Pd-list mailing list