PDA

View Full Version : CRT Light Pen



TandyMan100
November 11th, 2009, 06:34 AM
Well, I'm wanting to build a light pen. If you don't know, a light pen is a device that attaches to your computer, and it is able to sense where on the screen you are pointing it by timing the monitor refresh rate. I would like one of these on my Windows/Linux PC, but I am asking this in the 'General Vintage Computer Discussions' forum because these devices haven't been widely used since the 80s. Anyone know where I can find schematics/drivers?

carlsson
November 11th, 2009, 06:50 AM
Here is an instruction how to build a C64/Atari light pen:
http://www.atariarchives.org/ecp/chapter_6.php

I believe a CRT is an absolute requirement to get it to work, no matter if you would use it on a vintage PC or something newer. See also this reseller of light pens for current PC's: http://www.screendirect.com/page/ICPE/CTGY/PCLP

Another document on light pens which mentions custom hardware may be required to interface a light pen to a modern (VGA or better) graphics card:
http://www.epanorama.net/documents/pc/lightpen.html

Good luck! I suggest you build a device for those C64 or similar computers first.

TandyMan100
November 11th, 2009, 07:24 AM
Here is an instruction how to build a C64/Atari light pen:
http://www.atariarchives.org/ecp/chapter_6.php

I believe a CRT is an absolute requirement to get it to work, no matter if you would use it on a vintage PC or something newer. See also this reseller of light pens for current PC's: http://www.screendirect.com/page/ICPE/CTGY/PCLP

Another document on light pens which mentions custom hardware may be required to interface a light pen to a modern (VGA or better) graphics card:
http://www.epanorama.net/documents/pc/lightpen.html

Good luck! I suggest you build a device for those C64 or similar computers first.
A CRT is an absolute requirement? Are you referring to a TV set? Or would it work with a VGA computer monitor as well?

nige the hippy
November 11th, 2009, 07:59 AM
Yes a crt monitor - or ANYthing with a CRT.

Do you know that there's a light pen connector on the original IBM CGA monitor adapter? I haven't looked at the schematics, but I'm pretty sure the 6845 CRTC has a light pen register that loads the current scan position whenever the light pen is triggered.

P2 is a 6-pin header for a light-pen:

* Pin 1 is light pen input
* Pin 2 is not present
* Pin 3 is the light pen switch input
* Pin 4 is logic ground
* Pin 5 is +5V
* Pin 6 is +12V

The light pen needs only to be a phototransistor and a resistor, and a switch (and possibly resistor) to say "here please!"

http://www.reenigne.org/blog/cga-reading-the-current-beam-position-with-the-lightpen-latch/

do a bit of a google!

Chuck(G)
November 11th, 2009, 08:05 AM
I've still got the surplus light pen from some old late 60's era system that I adapted to the PC connector. It's one of those that doesn't register until you push on the (fiber optic) tip. Internally, it's got a phototransistor as well as a couple of transistors to boost the signal. I've played with it a bit; it's interesting, but I'll take a touchscreen or a graphics tablet any day.

Note that almost all EGA and a few VGA boards still had the lightpen connector.

TandyMan100
November 11th, 2009, 08:05 AM
Okay, so is there anyway to make one of these for a semi-modern computer with a VGA card that is lacking a lightpen input? Perhaps parallel? Or Serial?

Chuck(G)
November 11th, 2009, 09:19 AM
Okay, so is there anyway to make one of these for a semi-modern computer with a VGA card that is lacking a lightpen input? Perhaps parallel? Or Serial?

The light pen thing happened to come along with the 6845 CRTC on the original adapters. Unless the chipset for your VGA happens to have provision for light pen input, it's going to be pretty difficult knowing exactly where the spot is on the CRT screen.

I suppose you could synchronize to the vertical retrace interrupt and extrapolate spot position from there, but I'd think that the resolution would be less than wonderful. Of course, if what you're involves just getting "close" to a big area on the screen, then it might work. But timer resolution is pretty coarse on the PC, compared to the dot clock on a VGA.

per
November 11th, 2009, 09:31 AM
In fact, I think I actually got a ligth pen (along with some other uncommon graphics hardware). However, somebody I know in Stocholm store it rigth now as I haven't gotten the time to travel there and pick it up.

---

The Professional Graphics Controller got some pads that looks like it's designed for a ligth-pen connector, however, IBM didn't bothered soldering on a header.

I wonder if I could make it recognize a ligth pen? maybe one of the undocumented jumpers have to be altered first. I don't know...

carlsson
November 11th, 2009, 01:56 PM
Let me quote from my third link, in case TandyMan didn't bother to click and read it himself:


So adding a light gun to a modern PC get much harder, because the graphics card does not have the necessary hardware built into it. If you want to get the location information from light pen signal, some special external hardware that connects to light pen and graphics card connector needs to be added. The hardware can measure the Y position by counting the number of HSYNC pulses between last VSYNC pulse and the pulse from the light pen sensor. For X-position the time from las HSYNC pulse to light gun pulse needs to be measure accurately (counting the number of pixel clock pulses from grahics card is the idea, but generally you can't get the pixel clock out of PC graphics card through the standard connectors in them, so other tricks needs to be used)

It seems those commercial light pens with a RRP around $180 need an interface card for another $200. The shop I linked to have some serial and USB interfaces where you can plug in the light pen. It is possible you can find cheaper solutions or design something yourself, but I doubt it designs itself.

NeXT
November 11th, 2009, 02:47 PM
I got an older 8-bit ISA ATI card with a pin block for a light pen. I wonder if this could be rejiggered to work with that?

per
November 11th, 2009, 03:18 PM
I got an older 8-bit ISA ATI card with a pin block for a light pen. I wonder if this could be rejiggered to work with that?

Any ligth pen accepting +5v, +12v and GND, that has one output for the switch and one output for the optical-observation data should work.

Pinout for the ligth-pen connector:


1 2 3 4 5 6
+-------------+
| O X O O O O |
+-------------+

1 = Optical data (to graphics card)
2 = NC, key
3 = Switch signal (to graphics card)
4 = GND
5 = +5v (from graphics card)
6 = +12v (from graphics card)

geoffm3
November 24th, 2009, 12:11 PM
Instead of relying on hardware to do this, another possibility would be to blank the display and show a successive set of blocks across the display. Would be slow and not very high res though.

Bungo Pony
November 25th, 2009, 06:20 PM
One thing I was always tempted to try was interfacing a Nintendo Zapper gun to a Commodore computer, and use that instead of a light pen. Not knowing anything about either technology, I'm not sure if that would work.

Imagine using light pen software with a zapper gun... Being productive would be challenging :)

edit: Judging from THIS (http://electronics.howstuffworks.com/question273.htm), it looks like it's quite possible to do so.