If you worked with computers back in the 1970s, there’s a good chance you used a light pen at some point: a simple input device that you’d point at the CRT screen to highlight text, choose menu options or manipulate graphic objects. Although ubiquitous in those days, the light pen lost the battle for ergonomics to the humble mouse and was all but extinct by the late 1980s. Touchscreen styluses implement a similar function today, but touching the screen somehow doesn’t feel the same as simply pointing at it.
We therefore applaud [Maciej Witkowiak]’s efforts to bring the light pen into the 21st century by building a USB interface for a Commodore 64/128 light pen. At its heart is an Arduino Micro Pro that implements the USB HID protocol to communicate with any modern computer. It connects to the classic light pen as well as to the computer’s analog display signal and uses those to calculate the delay between the video synchronization pulses and the light pen’s output. The sync pulses are extracted from the video signal by an LM1881, a sync separator chip that will be familiar to anyone who’s worked with analog video signals.
The Arduino calculates the light pen’s position based on the measured timing intervals and reports it to the computer, using the absolute positioning mode that’s also used by things like drawing pads. [Maciej] demonstrates his system in the video embedded below, in which he uses it to operate the menus on an X window system. A great success then, although there’s one catch: light pens only work on CRT displays, so you’ll need to drag one of those big glass beasts out of storage if you want to try this yourself.
We’ve featured the Commodore light pen before in this odd gaming input device. A similar device built with a discrete LED matrix is a good illustration of the light pen’s working principle.
cool project!
I never used a light pen. They existed on minicomputers, and saw some use on home computers, but my impression was it was a minor thing. So when there was software for learning, light pens saw some use. Maybe some other niches. But never as a general peripheral the way mice and touchscreens are used.
Lightpens were easy, a photodiode and likely a schmidt trigger. But no standard place to plug them in.
IBM’s CGA card had a standard port for the lightpen, I vaguely remember.
Not sure about the clones, though. 🤷♂️
https://www.seasip.info/VintagePC/cga.html
Alternative method to trigger a light pen on any screen is to use show dark and bright image in a pattern.
By using multiple flash frames and lighting different areas of the screen it can be determined, over multiple flashes, where the pen is. Once the initial pen position is identified a much smaller area on the screen can be targeted for the same effect to track the pen.
Modern OLED screens also have noticeable screen refresh swipe, which probably could be detected. But it is only in one direction, so only gives X or Y coordinate (depending on display panel scan direction).
Use 2D binary subdivision: Flash half the screen, detect light or dark, identify which half sensor is over. Flash half the remaining area, identify which half of that (1/4 screen area) the sensor is in, rinse and repeat. This can either be stepwise, or just use a fixed 2D pattern sequence if you think you can walk through the whole sequence before the sensor moves out of whatever you have defined as your smallest desired discriminable region.
This works great for displays that use binary PWM (e.g. DLP projection, Plasma) because you can display your sequence at the base driving rate of a few kHz, whereas with TFT or OLED your pixel switching time is capped close to your actual framerate.
I remember these… There were articles in Compute!s Gazette and Transactor magazines to build light pens for a C64; my memory is the pens weren’t much more than a light sensor in the tip with a button to trigger it.
Yes, same principle as the light gun for the NES.
You know, that controller for playing Duck Hunt.. 🙂