Building a Light Pen Interface for the X68000

A light pen is a deceptively simple retrocomputing accessory. A sensor at the tip detects the bright spot produced when a CRT electron beam passes beneath it, while software converts that detection into a screen position. For the Sharp X68000, the project combines vintage display timing, custom electronics, and software written for a machine whose original documentation can be difficult to locate.

The most practical design is a small external adapter that observes the monitor’s sync signals, detects the raster beam with a photodiode, and reports the calculated coordinates through an input interface. A simpler version can provide only a click or trigger signal, while a more complete implementation behaves like a graphics tablet or mouse. Choosing the right level of complexity at the beginning prevents unnecessary changes to the hardware.

This project also provides a useful way to preserve the character of the X68000. It uses period-correct CRT behavior instead of replacing the computer with a modern display controller, yet the electronics can be built from readily available components. Careful documentation, testing, and reversible connections are more valuable than chasing absolute authenticity.

Understanding The Light Pen Principle

A CRT does not illuminate the whole image at once. Its electron beam scans from left to right, advances through successive lines, and repeats the process many times per second. When the beam reaches the location viewed by the pen, the phosphor becomes brighter for a short interval. A light-sensitive component can identify that flash.

The sensor normally uses a photodiode or phototransistor behind a small tube or shroud. The shroud limits the field of view so that room lighting and nearby screen content do not cause false triggers. A transimpedance amplifier or comparator then turns the brief optical pulse into a clean digital edge.

The sensor pulse alone does not contain an X or Y coordinate. The interface must know when each frame and line begins, then measure the time between those reference points and the optical event. Horizontal position comes from the delay after the line starts. Vertical position comes from the number of completed lines since vertical synchronization.

This approach depends on a real CRT raster. An LCD, OLED, or many modern video converters may display the same picture without producing a beam that the pen can detect. Some flat-panel displays also add processing latency, scaling, or frame buffering, making timing-based coordinate measurement unreliable.

Choosing The X68000 Connection

There are several ways to connect a light pen interface to an X68000. The least invasive option is to use a joystick or mouse input as a trigger and send coordinates through a separate serial or expansion interface. This produces a useful demonstrator, but the computer receives only what the application expects from those ports.

A more capable adapter can emulate a mouse. It measures the light event internally, converts the result into screen coordinates, and sends movement and button information using a protocol supported by the target software. This is convenient for applications already designed for mouse input, although absolute light-pen coordinates may need to be translated into relative mouse movement.

A custom interface connected to an expansion board gives the software direct access to measured X and Y values. This is attractive for demonstrations, drawing programs, and games written specifically for the project. The Nereid-X material on Nereid expansion work is useful background when considering how an X68000 expansion device can provide power, logic, and a documented path for custom peripherals.

Do not rely on an unverified connector diagram. X68000 models and accessories can differ, and a mistaken connection can damage an input port. Confirm pin assignments from service information, check signal levels with a meter or oscilloscope, and begin with a current-limited test harness. A modern microcontroller should normally communicate through a level shifter or open-drain output rather than driving a vintage input directly.

Designing The Sensor And Analog Stage

A photodiode is usually preferable to a general-purpose light sensor because its response is fast enough for raster timing. A visible-light photodiode with a modest active area gives a useful balance between sensitivity and spatial selectivity. A phototransistor can simplify the circuit, but its slower response and greater variation may reduce timing accuracy.

The optical head should be physically stable. A short black tube, heat-shrink sleeve, or 3D-printed barrel can shield the device from ambient illumination. The tip needs a soft, non-scratching bezel so it can rest against a CRT face without marking the glass. Avoid a design that requires the user to press hard; the pen should detect the screen while held lightly.

The analog stage can use a reverse-biased photodiode feeding a transimpedance amplifier, followed by a comparator with hysteresis. The amplifier converts photocurrent into voltage, and the hysteresis prevents noise from producing multiple transitions. A trimmer may adjust sensitivity, but excessive gain can make bright icons, reflections, or the monitor’s glow trigger the circuit.

Ambient light rejection deserves attention. A narrow optical aperture is the first defense, while software can reject pulses that arrive outside the active display interval. A digital blanking period after each accepted event also prevents ringing from being interpreted as several pen hits. Shielded wiring between the sensor and adapter is worthwhile, especially when the pen cable is long.

Measuring Raster Timing Accurately

The interface needs a stable timing reference. Ideally, it receives horizontal and vertical synchronization from the monitor or from a suitable video connector before any display conversion occurs. If sync is unavailable externally, a design can sometimes use known X68000 video timing and a local oscillator, but accumulated error will reduce accuracy and make calibration dependent on the particular monitor.

A microcontroller with input-capture hardware is well suited to this task. One timer records the latest horizontal sync edge, another records the vertical sync event, and an interrupt captures the sensor transition. The firmware then calculates the line index and the fractional position within the line. Hardware capture is preferable to measuring pulse timing inside ordinary interrupt code, where latency can vary.

The first prototype should log raw values rather than immediately pretending to produce perfect screen coordinates. Record frame number, line count, horizontal timer value, and signal strength if available. A short diagnostic program on the X68000 can display a marker at the reported position, allowing the builder to identify jitter, polarity errors, missed frames, or an incorrect active-area assumption.

The visible picture does not necessarily begin at timer zero. Blanking intervals, overscan, monitor geometry, and the selected X68000 video mode affect the conversion. Calibration should therefore use several known points, such as the corners and center of the displayed image. A two-dimensional affine adjustment can correct scale, offset, and slight skew without complicating the sensor hardware.

Design choice Simple trigger adapter Mouse-style adapter Direct coordinate interface
Sensor processing Comparator threshold Microcontroller timing Microcontroller with capture timer
X/Y calculation Performed by software or omitted Converted to mouse movement Sent as absolute coordinates
Computer connection Joystick or button input Mouse-compatible link Expansion or custom serial link
Hardware difficulty Low Medium Medium to high
Best use Proof of concept and games Existing mouse software Drawing, demonstrations, research
Main limitation No native position data Relative motion can drift Requires custom X68000 software

Writing The X68000 Software

The software layer should expose raw measurements and calibrated coordinates separately. A small driver or test program can read the adapter, validate a packet checksum, and show the current line and timing values. Keeping diagnostics visible makes it much easier to distinguish an optical problem from a communication problem.

For a serial protocol, use fixed-size packets with a recognizable header, coordinate fields, button state, and checksum. The microcontroller can transmit a packet after each accepted light event, while the X68000 polls the interface during its main loop or receives bytes through an interrupt-driven routine. A timeout should clear the pen state if the cable is disconnected or the sensor stops seeing the display.

A direct memory-mapped interface may provide lower latency, but it increases the amount of custom hardware and driver code. For an enthusiast project, a simple asynchronous link can be easier to document and repair. The important properties are deterministic timing, clear voltage levels, and a protocol that can be inspected with a logic analyzer.

Applications should account for the X68000’s active display area and video modes. Store calibration values per mode instead of assuming one fixed resolution. A drawing program can map the pen to pixels, while a game may want a larger hit region to compensate for hand movement and CRT geometry. Debouncing should be handled in software, with a configurable release delay rather than a long fixed lockout.

Building Safely And Testing In Stages

Never open a CRT monitor merely to obtain sync without understanding the risks. The high-voltage section can retain dangerous energy after the monitor is unplugged, and the neck board is fragile. Use an external video connector or an isolated pickup circuit whenever possible. If internal access is unavoidable, work only with appropriate training, discharge procedures, insulation, and test equipment.

Build the project in stages. First verify the sensor on an oscilloscope by moving it across a bright static image. Next connect the comparator and check that one clean pulse appears per intended beam passage. Then add sync input and confirm that the calculated line number changes predictably as the pen moves vertically.

After that, test the computer interface without connecting the X68000. A logic analyzer or USB serial adapter can confirm packet format, polarity, and timing. Use a sacrificial microcontroller board or breakout harness for initial electrical tests, and add series resistors or buffers before attaching a valuable vintage computer.

The project’s progress can be recorded alongside other hardware experiments in the X68000 project diary, including photographs of the sensor head, schematics, firmware revisions, and monitor-specific calibration results. Detailed records make future repairs possible and help other enthusiasts reproduce the interface without guessing which prototype was actually tested.

Calibrating For Real CRT Use

Calibration should be performed with the exact monitor, cable, video mode, and sensor casing that will be used in normal operation. Display geometry changes with brightness, warm-up time, and sometimes the monitor’s service adjustments. A calibration routine that appears accurate on a test bench may shift when the screen is installed in its intended setup.

A practical routine displays targets at known coordinates and asks the user to place the pen over each one. The firmware records multiple samples per target, rejects outliers, and calculates the transform used by the application. Averaging several events reduces random noise, while a median filter is useful when occasional false pulses remain.

The sensor should be held nearly perpendicular to the glass. At a steep angle, the optical aperture sees a wider section of the screen and the measured pulse becomes less distinct. A spring-loaded or foam-supported tip can help maintain contact without stressing the monitor. Brightness should be high enough for reliable detection but not so high that bloom enlarges the apparent target.

Useful recommendations for a dependable first version include:

  • Start with a CRT-compatible trigger detector before implementing absolute coordinates.
  • Use a photodiode, optical shield, comparator hysteresis, and adjustable threshold.
  • Capture sync and sensor timing in hardware rather than depending only on firmware delays.
  • Add level shifting, current limiting, and a detachable cable before connecting to the X68000.
  • Save raw timing data and calibration values with every hardware revision.

A working light pen interface turns the X68000 display into an interactive instrument rather than a passive output device. Begin with a safe external prototype, document every signal and timing assumption, and expand from trigger detection to calibrated coordinates only after the optical path is reliable. Share the circuit, firmware, and test results so the next preservation project can build on a repeatable design.

Nereid-X Expansion Board

A personally-produced LAN+USB+Memory expansion board for Sharp X68000 series computers. Multiple production runs were offered, including a final batch and a later revival reproduction run.

Power Supply Repair

X68 power supply repair and modification services were offered by the site owner, with documentation shared through diary entries spanning 2001–2006.

Server & Networking

Notes on FreeBSD administration, ISP changes, server migration, and networking topics. The site itself ran on FreeBSD with the hns diary system and Namazu search integration.

A two-ink risograph print in muted slate-blue and charcoal on off-white paper, showing a stylized desktop computer monitor beside a circuit board with soft geometric trace lines, conveying a calm retro-computing workshop atmosphere. A two-ink risograph print in deep purple and dark grey on cream stock, depicting a compact expansion card with connector ports and subtle Japanese technical annotations, evoking a hobbyist electronics bench. A two-ink risograph print in teal and charcoal on warm white paper, showing a server rack silhouette with soft network-line motifs and a small weather icon, suggesting a personal server room corner.

Get in touch

X68K.NET connects Sharp X68000 enthusiasts through community links and shared projects. Reach out with questions about the Nereid project or X68 resources.