Interfacing

USB

USB is the Predominant I/O option

It is, after all, The Universal Serial Bus.

USB is a time division multiplexed, bit serial bus capable of running at different speeds in order to support peripherals of varying performance levels. It can be expanded to connect larger numbers of peripherals through use of external expansion hubs. The connectors are made with the power pins longer than the data pins so that peripherals are "hot plug-able When a new peripheral is connected, the USB controller detects the addition and queries the new device for its vendor ID and product ID. The controller then notifies the operating system which, in turn, loads the appropriate drivers.

USB is substantially more complex than older I/O options such as the serial and parallel ports. It is not possible to simply write code to directly touch USB I/O ports or control registers. Kernel level drivers are required. Fortunately, Windows includes generic drivers for HIDs (human interface devices) such as keyboards, mice and joysticks. Also, a newer BIOS will include basic support of USB mice and keyboards to allow system boot up. Non-generic devices require their own drivers.

Option: Use a USB I/O Module

You can put all of USB's complexity behind you by using a commerically available I/O module. There are no worries about interface hardware or drivers; just connect your lights and switches and plug it in to a USB port.

Leo Bodnar has developed an I/O module which is widely used by the hobby flight sim community.

Phidgets are plug and play USB I/O modules which, while not specifically designed for the flight sim community, are nonetheless used there.

Arduino is an open source electronics prototyping platform which provides I/O capability. There are several devices in the Arduino family. Some have USB capability. Arduino modules are available from multiple sources in several countries. This approach is more involved than the above two, but offers more flexibility.

Option: Hack an existing USB device

Another approach is to buy a USB device with the sorts of inputs you need (pots & switches) and use the electronics out of it. This may seem a bit wasteful, but it provides the functionality of USB, plus comes with its own driver. Compared with the cost and effort of building from scratch, this is a very viable approach when not too many inputs are needed. In particular, take a look at USB gamepads. While early gamepads were little more than button boxes, some of the more current models have two analog joysticks.

Option: DIY

As the number of inputs/outputs grow the option of developing your own USB interface starts to look attractive. Available USB chips make this quite doable. one option is the FT8U245 chip from FTDI which supports USB v1.1 and comes with drivers that make the device look like an additional COM port. Programming becomes a much more pedestrian task. For more involved applications FTDI also provides a DLL with greater functionality.

Take a look at the USBee development products. They offer two versions of a small USB interface board; one for full speed and the second for high speed.

Microchip, makers of the ubiquitous PICmicro micro controllers has also gotten in on the act with the PIC16C745/765, as well as some new stuff. You should also checkout GigaTechnology, a firm based in Australia that sells some nice board level USB interfacing products.

USB Resources

You can learn more about USB and USB interfacing from the two part article, "USB Made Simple" by Eddy Insam in the February and March 2002 issues of Electronics World. Also see "16 Bit I/O Via USB", by Colin Attenborough in the April 2002 issue, and "Wide digital I/O from the USB port" in the November 2002 issue.

Beyond Logic has on-line USB articles as well as links to other informational sites.

USB Complete, now in its 3rd edition, by Jan Axelson is definitely worth a look. See her website for details.

The Microchip web site has a few items for your perusal. Go to the technical document section and check out technical briefs TB054 through TB058, the first of which is appropriately titled "An Introduction to USB Descriptors

The Cypress Semiconductor site is also a wealth on USB info: lots of tech notes and sample code.

And of course, don't forget Circuit Cellar. The February 2003 issue has an article about a project based on the FTDI chip for talking to a parallel port device. The August 2003 issue has an article describing a USB to CAN bus bridge, and a second overview article on USB connectivity.