Building a USB keyboard adapter for the X68000 with Arduino

The Sharp X68000 remains remarkably usable, but its original keyboard is becoming one of the harder parts of a complete system to replace. Keyboards are expensive, fragile, and often sold separately from the computer. A modern USB keyboard is easy to find, yet it cannot be connected directly to the X68000 because the two devices speak entirely different protocols.

An Arduino-based converter solves that problem by sitting between the USB keyboard and the X68000 keyboard port. The microcontroller reads USB HID reports, translates modern key events into the scan codes expected by the Japanese computer, and transmits those codes through a compatible serial interface. The result can be a compact replacement keyboard adapter without modifying the X68000 itself.

This project is also a useful exercise in retrocomputing preservation. It keeps aging hardware in service while allowing the original keyboard to remain safely stored. The same careful approach used for other X68000 interfaces, including experiments documented in this MIDI port project, applies here: identify the electrical signals first, then reproduce the protocol conservatively.

Start with the keyboard protocol

The X68000 keyboard connector is not a USB port and should never be treated as a generic serial socket. Depending on the model and documentation source, the connector carries power, ground, clock and data-related signals, with the original keyboard handling the timing and scan-code exchange. Pin numbering can vary in diagrams because connector views are shown from different sides, so verify every connection against a service manual or continuity test.

Before building anything, obtain the keyboard pinout for the specific X68000 model. Check whether the host supplies 5 V, identify the signal reference ground, and determine whether the clock or data line is open-collector, driven actively, or bidirectional. A logic analyzer connected through suitable protection is more useful than guessing from an unverified internet diagram.

The original keyboard does more than report ordinary letters. It sends make codes when a key is pressed and break codes when it is released. Modifier keys, cursor keys, function keys, Japanese input keys and the unusual X68000-specific keys may use separate scan codes. Some keyboards also contain additional control logic for the mouse interface or keyboard LEDs, so a basic converter should begin with keyboard input only.

An Arduino should therefore be viewed as a protocol translator rather than a passive USB wiring adapter. On the USB side, it behaves as a host. On the X68000 side, it emulates the electrical and serial behavior of a keyboard.

Choose the host hardware

A standard Arduino Uno or Nano can read switches and drive serial pins, but it cannot directly host a USB keyboard through its built-in USB connector. Their USB interface is intended for connection to a computer, not for accepting another USB peripheral. A USB Host Shield based on the MAX3421E adds the missing host controller and is a practical choice for an initial build.

An Arduino Mega paired with a compatible USB Host Shield provides more pins and memory than an Uno, which can be helpful when debugging, displaying status information or adding support for keyboard LEDs. An Uno-sized board keeps the enclosure compact, but available RAM and program space become more important once the firmware includes a larger HID parser and a complete X68000 key map.

Other Arduino-compatible boards can work if they provide a suitable USB host implementation. Some boards have native USB host capability, while others expose only a device port. Confirm the board’s USB role before buying components. The important requirement is the ability to enumerate a normal USB HID keyboard and receive its reports reliably.

Use a board with a stable 5 V logic environment when possible. If the selected USB host controller or microcontroller uses 3.3 V logic, add proper level conversion for both the USB host signals and the X68000 interface. A resistor divider is not an appropriate substitute for a bidirectional level shifter on a line whose direction changes during communication.

Wire safely before writing firmware

Build the USB side and the X68000 side as separate circuits during testing. First connect the keyboard to the Arduino host shield and confirm that the board can enumerate it. The USB host library should report the device, its manufacturer information and the HID report structure. Test with a simple program that prints key presses to the Arduino serial monitor.

Only after USB input is stable should you connect an X68000-compatible output circuit. Use a sacrificial connector, a breakout board or a short adapter lead rather than repeatedly plugging loose jumper wires into the computer. Include a fuse or resettable polyfuse on the adapter’s 5 V input, and add a clearly marked power indicator so that an accidental short is easier to spot.

Do not assume that the X68000 will protect itself from an incorrectly driven signal. If the keyboard data line uses open-collector signaling, the Arduino must pull it low when transmitting and otherwise release it. A transistor or proper open-drain buffer can provide a safer interface than directly switching a GPIO pin. Series resistors can limit fault current, but they do not correct an incorrect voltage level or signal direction.

A logic analyzer is especially valuable at this stage. Capture the original keyboard if one is available, recording idle levels, bit order, clock frequency, inter-byte timing and the response to several keys. Test a letter, a modifier, a cursor key and a key release. These observations create a reference waveform for the replacement adapter and can reveal whether the protocol is synchronous, asynchronous or partly host-controlled.

Translate HID reports into scan codes

USB keyboards normally send HID reports containing a modifier byte and a set of currently held key usages. The report may describe six simultaneous ordinary keys, along with modifier states such as left Shift, right Alt or Control. The adapter must compare the newest report with the previous one. A usage present in the new report but absent from the old report is a press; a usage that disappeared is a release.

The X68000 expects its own scan-code vocabulary, so create an explicit translation table rather than trying to convert USB usage values arithmetically. Keep the table in a readable source file with comments identifying the physical key and the corresponding X68000 code. This makes it much easier to correct an unusual Japanese layout or add support for a key that is missing from a generic PC keyboard.

A useful internal design separates three jobs:

  • The USB task receives and decodes HID reports.
  • The key-state task detects presses, releases and modifier changes.
  • The X68000 driver schedules serial output with the required timing.

This separation prevents a long transmission routine from blocking USB polling. If the Arduino waits too long while sending one X68000 scan code, the host controller may miss a report, producing stuck keys or repeated characters. A small event queue between the USB parser and protocol driver provides useful buffering without making the firmware complicated.

Function USB keyboard side X68000 adapter side
Physical connection USB-A or USB-C host socket Model-appropriate keyboard connector
Device role Arduino acts as USB host Arduino emulates a keyboard
Data format HID usage reports X68000 scan codes and releases
Timing Managed by USB host controller Must match observed keyboard protocol
Key state Modifier byte plus usage list Press and release events
Electrical concern USB power and 5 V protection Correct voltage, direction and idle state
Initial test Print HID usages to serial monitor Verify one key at a time on the X68000

Start with a deliberately small key map. Letters, numbers, Space, Enter, Backspace, Escape, Shift, Control and the cursor keys are enough to prove the basic path. Add function keys, editing keys and Japanese-specific controls only after the fundamental press-and-release behavior is reliable.

Handle modifiers and special keys deliberately

Modifier handling is a common source of subtle errors. A USB report can represent left and right versions of Shift, Control, Alt and GUI keys separately, while the X68000 may use a different arrangement or combine functions in its scan-code protocol. Decide whether the adapter should preserve left/right distinctions or map both versions to the same host key.

The keyboard layout also deserves attention. A modern USB keyboard may be physically labeled in an English or ISO layout while the X68000 software expects positions associated with a Japanese JIS keyboard. The converter generally should translate physical USB usages into the X68000 key positions, not attempt to interpret the resulting character. Character selection remains the responsibility of the X68000 operating system and application.

For keys that do not exist on a modern keyboard, configurable substitutes can be useful. A rarely used key such as Scroll Lock might produce an X68000 Help or system function code, for example. Such choices should be documented and ideally selectable with a compile-time definition or configuration menu. Avoid hiding important functions behind an undocumented combination that users may forget.

Keyboard LEDs create a second, optional direction of communication. The USB host may receive LED state requests from the Arduino, while the X68000 may use its own protocol for Caps Lock or Kana indicators. Leave LED support until the key path is working. If the original protocol requires responses or acknowledgements, an incomplete LED implementation could interfere with ordinary input.

Test compatibility in layers

Begin testing without the computer attached. Confirm that the USB keyboard enumerates after every reset, that reports are decoded correctly, and that all pressed keys eventually generate matching release events. Test rollover by holding one modifier and pressing several ordinary keys. Also test unplugging and reconnecting the USB keyboard, since a converter that works only after power-on is inconvenient in daily use.

Next, use a logic analyzer or a second microcontroller to inspect the X68000 output. Compare the generated waveform with a capture from an original keyboard. Pay attention to the idle state between events, the order of bits, the delay between a press and its release, and the behavior when several keys are held simultaneously.

A staged build helps isolate faults:

  • Verify USB enumeration with the X68000 output disconnected.
  • Print HID usages and modifier states through the Arduino serial monitor.
  • Test the scan-code generator using a logic analyzer or loopback device.
  • Connect the adapter to the X68000 with only a minimal key map enabled.
  • Add cursor, function, Japanese and special keys after basic typing works.

When the adapter reaches the computer, test at the system level rather than assuming that visible characters prove full compatibility. Check command-line input, games, text editors, key combinations and long key holds. Some software reads raw scan codes, so an incorrect release code may remain unnoticed during ordinary typing but cause a game control or menu shortcut to become stuck.

Power behavior also matters. Measure the current drawn by the USB keyboard and host shield, especially if the adapter takes power from the X68000 keyboard connector. Backlit gaming keyboards can consume far more current than the original keyboard. A self-powered adapter with a carefully isolated signal interface may be safer than drawing all USB power from the vintage computer.

Make the adapter serviceable

Enclose the electronics in a case that prevents accidental contact with the X68000 connector and leaves access to the Arduino’s programming port. Label the USB socket and host-side connector clearly. Strain relief is important because a rigid board-mounted connector can transfer cable force directly to solder joints or the vintage computer’s socket.

Keep the firmware source, key map and wiring diagram together with the finished adapter. Record the Arduino board, USB host library version, connector orientation and any logic-level components used. Future repairs become much easier when the build does not depend on recollection or a photograph with no pin labels.

A small status LED can show USB enumeration, protocol activity or an error state, but avoid placing diagnostic code in timing-critical sections. A serial debug mode that can be disabled at compile time is usually more useful. If the adapter will be used with several X68000 models, document which connector wiring and protocol assumptions apply to each one.

The most dependable design is conservative: no direct connection until signal levels are measured, no oversized keyboard feature set until basic keys work, and no reliance on undocumented timing tolerances. Once stable, the adapter can become a practical everyday peripheral rather than merely a demonstration circuit.

Preserve a reliable working setup

For a durable build, prioritize these choices:

  • Use a USB Host Shield or a board with genuine USB host support.
  • Verify the X68000 connector pinout and signal voltage with documentation and measurements.
  • Implement press and release events through a clear HID-to-scan-code translation table.
  • Protect bidirectional or open-collector lines with suitable buffers and current limiting.
  • Test enumeration, timing, modifiers and long key holds before adding special functions.

Keep an original keyboard available for comparison if possible. It provides a reference for protocol captures and helps distinguish a firmware problem from an issue in the X68000 itself. The replacement adapter should complement original hardware, not make that hardware harder to diagnose.

Once the basic converter works, the project can grow in useful directions: selectable key maps, keyboard LED support, a diagnostic display, detachable cables or a small custom PCB. Each addition should preserve the same principle of separating USB handling from the vintage serial interface.

Build the first version on a well-documented prototype, test it with a logic analyzer, and save the final firmware and wiring notes alongside the hardware. A carefully made Arduino USB-to-X68000 keyboard adapter can return an otherwise idle computer to regular use while preserving the original keyboard for the future.

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.