# Parallel Port Control

## deadbird

I am attempting to build a small robot out of an old laptop. I need to use the Parallel Port to control relays and servo motors.

What is the best way to do this? is there some program or c library for this? or do I need to make a specalized driver? I have knolwedge of C so if some programming is required that would not be a problem.

Any Ideas?

----------

## augury

just deleted my post  :Mad: 

You can just # echo bits > /dev/parport0 (needs ppdev kernel module)

http://www.electronickits.com/kit/complete/elec/ck1601.htm

kind of cheating (if this is an academic project) but even lcd screens have serial terminal chips nowadays and you can build the kit and maybe use it for more relays.

If you want to build your own IC module interface there are circuit designer and testers like oregano, qucs, xcircuit.

Most interfaces use the db-9 serial port for things like opening cash registers and programing commonly is in C.  For a manually controlled robot other languages, even bash, would do with a cuircuit board that reads pc output.  Timing is everything for good walking movement.  

What kind of robot are you building?

----------

## lbrtuk

I used to use something called parapin for this. A set of ready-made routines for flipping the port's bits so you don't have to bother constructing and writing out bytes.

http://parapin.sourceforge.net/

----------

## augury

That would be cheaper.  Although the cell phone switch is indispensable.  Nice robot   :Very Happy: 

How much power does the para port put out?

----------

## bjd

 *augury wrote:*   

> How much power does the para port put out?

 

Naff all. Depends on the chipset but you're looking at a tens of mA, enough to run an LED. You should optoisolate the outputs when using the parallel port otherwise you risk overloading and blowing something. 

Useful info in this thread too, didn't realise you could dump data to it in bash like that  :Smile: 

----------

## deadbird

yeah I am going to be using some combination of transistors and relays to make sure I don't mess it up.

How bout reading the status of bits back in?

----------

## augury

That might be more difficult.  Ordinarily, like back in the old days, pp's were one way only.  Now printers talk back and pp can run hdd's.  The interface should be the similar to a serial port ie external modems can be hooked to pp and are detected the same.  Obviously there are more pins.  It only uses 9 and so they can be mapped out the same.

from http://www.geocities.com/thetropics/shores/2250/pinout.html

```

4. IBM DB-25 and DB-9 numbering scheme. (Pin numbers)

Each pin has a number assigned to it. When connecting null modem, for example, it is important to know these numbers in order to select the correct cables, or when making your own cables. 

 

DB-25 Connector

Chart #1 (Female) 

  13              <------- 1

 

----------

## augury

parapin can do i/o I didn't notice that.  I should have figured it could being for linux and all.

check out 

/usr/src/linux/Documentation/parport.txt

/usr/src/linux/Documentation/i2c/busses/i2c-parport

----------

