I’ve finished my rough-and-ready “napkin” design for a USB to ADB converter, building off the ideas discussed in my previous post. This device will enable modern USB-based keyboards and mice to be used with vintage ADB-based Apple IIgs and Macintosh computers. I’ll be designing this for low cost, and offering it for sale in the BMOW store when it’s done.
The design doesn’t need much more than a microcontroller and some clever software, along with the necessary USB and ADB connectors. After looking at several options, I think the best microcontroller for this project is the PIC32MX2xx series. These have hardware support for USB Host functions, are well-documented with lots of examples, and are cheap. I’ve never worked with a PIC before, but that’s OK.
The ADB protocol is described in detail in the Apple Guide to the Macintosh Family Hardware. It’s a 1-wire open collector bus protocol without an explicit clock. Each bit is 100 microseconds wide, with a 0 bit being 65 us low and 35 us high, and a 1 bit being 35 us low and 65 us high. Unfortunately it’s not a good match for any of the microcontroller’s standard SPI, I2C, or UART modules, so it will need to be bit-banged through software. Documentation is not great, but there are enough examples of other ADB projects that I’m confident I can get this working.
The PIC32MX2xx, like almost all other microcontrollers with USB Host functions, has only a single USB interface. To connect a USB keyboard and mouse at the same time, then, I’ll need a USB hub. Early versions of Microchip’s USB framework for PICs didn’t support hubs, but fortunately hub support was added sometime around 2014.
My first thought was to build a hub directly into this device. I might use a separate 2-port hub chip like Microchip’s USB2412, along with the required crystal oscillator for the chip and other support components, and a 2-port USB type A connector. But then I looked at how cheaply you can get a stand-alone 2-port or 4-port USB hub, when buying in wholesale directly from Asia. It’s far cheaper than the cost for me to integrate equivalent functionality into my device! So I’ll probably design the device with a single USB type A connector, and package it bundled with a basic USB hub.
The device will be powered directly from the ADB bus. Apple’s spec allows for 500 mA current draw at 5V from ADB, which should be plenty for the device itself plus an attached keyboard and mouse. Powerbooks reduce this limit to 200 mA, which might be a problem. Two possible solutions:
- State that Powerbooks are not supported by this device (or are not guaranteed to work).
- Add a power jack for an optional external 5V supply.
I’d prefer to avoid an external power supply, even as an optional item. It just feels clunky, and even an optional jack will add to the cost and complexity. Some method of switch-over would be needed, to avoid back-feeding current from an external supply into the Mac’s +5V ADB line.
Some ADB-based computers have two ADB ports, and some only have one. Is there a need for an ADB pass-through on this device? Without one, it will be impossible for a computer with a single ADB port to use this USB-to-ADB device and another ADB device at the same time, without resorting to a 3rd-party ADB-splitter. But my guess is that would be a rare need, and an ADB pass-through connector would go unused 99% of the time. It’s probably better to keep things simple and omit it.
Standard ADB keyboards have a power/reset button, which is the normal way to turn on most Macintosh models. This is the only ADB feature I can’t see a good way to replicate using USB input devices. In an ADB keyboard, the power button is a physical switch that grounds a pin in the Mac’s startup circuit, activating its power supply. Before the switch is closed, the keyboard and computer are truly off, and there is no source of power available to ADB devices.
Without power, my USB-to-ADB device and any attached keyboards and mice will be fully turned off. That means there’s no way a magic key combination on the USB keyboard can be used to power on the Mac.
I can add a physical power button to the USB-to-ADB device itself, and that will work, but it’s not ideal. Were it not for this, the device could be shoved behind your monitor, out of sight. Using it for the “on” button requires it to be in your workspace and accessible. An external power supply (or batteries) could provide another solution, keeping the device and USB peripherals always on even when the computer is off, but I’d prefer not to go down that route.
Time to buy a PIC experimenter board and some ADB (aka S-Video) connectors, and start hacking!Read 23 comments and join the conversation