# Pin IO for a computer running Linux [duplicate]

I'd like to control a few input pins (say 5) and a few output pins (at least 2) from a computer. The computer has no parallel port. What is the best way to do this? USB-to-parallel adapter (anybody have one to recommend which works on Linux)? Or perhaps there is some other general purpose USB "control board" where I can use read input from some pins and write output to others? I don't even know what to google for, so any pointers are appreciated!

It will depend what speed you need to read or write data at. However many of the FTDI chips support this sort of USB<->parallel using the D2XX interface (programmers guide here).

Some chips such as the FT245B (datasheet here) are designed for implementing custom parallel interfaces. See the block diagram below.

• Yes, though be aware that while it sounds like they should be, flexible parts like the FT245 are typicall not the chips typically used in USB parallel printer adapter cables - those typically use chips that are useless for much of anything beyond actual printing on printers. Pre-assembled FT245 cables do exist, but tend to be for niche applications such as device programmers or experimenter projects. – Chris Stratton Nov 26 '13 at 20:14
• @ChrisStratton Printing wasn't in the question - unsure if I'm missing something here? – David Nov 26 '13 at 20:16
• I was just trying to caution about the difference between your very appropriate but niche-market recommendation, and the easier to source but unsuitable cables sold for parallel printers. – Chris Stratton Nov 26 '13 at 20:18

If you have US\$108 to spare, this "Affordable Multifunction DAQ with USB" (http://labjack.com/u3), by LabJack, may solve your problems . Perhaps overkill for what you want (16 I/O pins) but it works with Linux, and it's programmable from all the major languages.

In general, if you search for linux daq usb you will find plenty of options.

It is very easy to make your own using a microcontroller like an Arduino or mbed. The microcontroller will appear as a virtual serial port when plugged in with USB, and you can send it commands. On the microcontroller side, write a small program that interprets the commands and changes output of the pins or returns an input. This may not provide timing as good as a "real" DAQ box, but if you don't need that kind of quality, it can be an affordable solution.