Monday, January 26, 2009

Determining which port to interface on

There are multiple ports on a computer to which you can interface, each has it's own pros and cons. My requirements were as follow:
  • it must be cheap,
  • it must be able to operate over distances greater than 10 meters,
  • I prefer not to use soldering iron extensively, because I suck at it :-) (note to self: take a soldering course).
I opted for the serial port, since I only needed 1 output pin which either has a signal or no signal; and it's cheaper compared to the other options. There were 3 ports which came to mind when deciding which one to use:
  • Parallel port
  • Serial port (also known as the COM port)
  • USB port
Let's review their characteristics first:

Parallel port
The parallel port offers 8 pins for data (it can send 8 bits, 1 byte, at the same time, hence the name parallel port). A bit with the value 1 is represented as a 5V signal, and a 0 bit is simply no voltage (0 V). 5V is perfect to work with, since IC do not require a high voltage. This port has 25 (!) pins in total and the male side of this cable has 36 pins (soldering hell!!).

Serial port
This port has 2 data pins, namely a read pin and a write pin. The total number of pins is 9. Not all pins need to be connected, hence a cable for this port is easily self-constructed and relatively cheap compared to a parallel cable. The data pins can deliver a voltage between -25 V and +25V, so a 50V peak-peak voltage can be drawn from this port. Note that a lower voltage may be drawn (it usually operates at ± 5 - 12 V), which is more desirable.

USB port
This one is tricky, I realized that when you connect an USB-device, the operating system usually asks the device what kind of device it is and other sorts of information. So in order to provide this information to the OS, you need an USB micro controller. I don't have an exact price range for this kind of hardware, but a quick search at my favorite supplier told me they have USB micro controller starter kits in the range of 65 – 200 Euro. (The actual controller itself is cheaper, but since neither the intended audience, or myself for that matter, has a clue how to use that thing, it's likely we need the starters kit which has some examples and documentation with it). The USB port has 4 pins, 2 for the power circuit which gives a continues ~5V and the other 2 are for data transmission.

Side note: In my case, I used an external power source for the IC, so I did not need to pay attention to the maximum amount of amps I can draw from the port, if you're planning on using the port as a power source, find out how much it can supply before it fries (it's usually not very high).

So the serial port is the cheapest option, requires the least amount of soldering and since I can create my own cable, it will be possible to make it over 10 meters long. Perfect!

In my next post I will explain how to create the connector.

6 comments: