Sometimes the simplest of projects end up revealing the most interesting of things, as for example is the case with [Ryo Mukai]’s light pen for the Vectrex console. It’s an extremely simple device using an integrated light sensor with built-in Schmitt trigger, but for us the magic isn’t in the pen itself but in discovering how it worked with the Vectrex’s vector graphics.
Light pens were a popular accessory in the 8-bit computing days, offering a relatively inexpensive pointing device that gave your micro an even more futuristic feel. On most computers that used a raster-scanning TV display they simply picked up the flying dot on the screen as it passed the end of the pen, but the Vectrex with its display not scanning all of the screen at once needed a different approach.
This piqued our interest, and the answer to how it was done came from PlayVectrex. There was a target X on the screen which could be picked up with the pen, and when picked up it would surround itself with a circle. Crossing the dot as it flew round the circle would tell the console where the pen was, and the position would move to fit. For those of us who only saw a Vectrex in a shop window back in the day, mystery solved! We’ve placed a video showing the process below the break.
This isn’t the first light pen we’ve seen, they can even be connected to modern computers, too.
I wonder if a variation of this trick could be employed to work with a modern monitor, so you could have a light pen, without having to emulate a raster scan. Perhaps you could get away with effectively slowing down the sensor response time. Sense the initial dot, when you loose the dot, you start counting, drawing a black circle around it and a white dot moving in a spiral out from the centre, to a certain radius. When the spiral catches up with the sensor, you do some math to tell you the angle from the original dot. As long as the sensor is slower than the frame rate, taking an average in software or just having slow hardware, it might just work.
With modern equipment you could even use a dot to send serial data.
There are probably more responsive methods on modern monitors. For instance, a stylus with an IR led at the tip, and one or more cheap IR cameras (there is code online for using Wiimotes for this) pointed at the screen.
Sadly modern PCs don’t have a serial port where light pen is alternative input to mouse.
Light pens were originally invented for use with vector displays, long before bitmapped raster displays were feasible.
On a raster display, the light pen triggers on the portion of the “display list” that is currently being drawn by the vector hardware. In that way, it is the quintessential “pick” input device, i.e. it allows the user to pick which screen element that they wish to indicate. The screen element would be a line or group of lines (say, a box or glyph).
Unlike raster displays, a vector display aims the electron beam only where needed, and a light pen can only detect something when a vector is being drawn underneath it. To choose an arbitrary location on the screen, instead of an already displayed vector, software would have to search for the light pen, often by displaying expanding boxes or something similar.
Oops, I meant to say, “On a *vector* display, the light pen triggers on the portion of the display list…”