pport v0.1 This is the first release of the pport package. At the moment
it only contains the source code for the software part of the controller.
It should come in handy once the hardware circuitry is released.

For the time beeing, or for those that already have the board attached to
the parallel port the following should make the program compile.

As usual, as root type:

make && make install

Then the program should be placed in /usr/sbin.
As root one can type:

pport -h

in order to obtain help.

The following scheme is taken as an excerpt from the Coffee-Machine howto
and enhanced with Tomi Engdahl's scheme. The two relays together with the
optoisolator (optional) and the zener diode should provide an excellent
way to protect the parallel port from damage.

                                                V+  (12V)
                                                 |
                                    +------------+-----+------+
                                    |                  |      |
Parallel                            |                  |      |
Port                                |          D1     ---     |
                                    |         1N4001  / \    1st relay coil
 data     R1     1 ----------- 5    |                /---\    |   |   |
pin(n)----1k------| Opto-     |-----+                  |      |   |   |   220V
                  | Isolator  |                  +-----+------+   |   | or 110V
 GND -----+-------|           |-+                |            |   |   |    |
          |      2 ----------- 4|                |            |   |   |    |
          |        CNY 17 or    |   R2        | /             |   |   |    |
         ---       4N25         |   4.7K    B |/  C T1        |  2nd relay coil
         |/  DZ                 +--\/\/\/\/---|     BC547A    |       |    |
         |                      |             |\  E           |      aparatus
         ---                    |             | V          | /
          |                     /               |        B |/C  T2
          |                     \  R3           +----------|    power
         ---                    / 10 kohm                  |\E  transistor
          -         fig.1       \                          | v
         GND                    |                            |
                                +----------------------------+
                                                             |
                                                external circuit ground

The parallel port mainly used to connect printers and similar devices
looks something like this:
                                  9 8 7 6 5 4 3 2
			-----------------------------
			\ o o o o o o o o o o o o o /
			 \ o o o o o o o o o o o o /
                          ------------------------
			  25 23 21 19                  fig. 2
			   24 22 20 18

Where pins 2-9 are the data pins (corresponding to lport -n {2,3,4,5,6,7
8,9}) and the pins 18-25 are ground pins. 

Good luck and happy controlling!
Comments and suggestions to RainMan@linuxmail.org

Rain

pport 0.2 As promised I want to add some more documentation or
implementations regarding the hardware part of the project. I will present a
possiblity to control several appliances using less pins. This is necessary
if you wish for example to control more than 8 devices in total. Obviously,
there are not enough pins to support a great number of devices. Thus, we
introduce the demultiplexer. What is a demultiplexer? A demultiplexer is a
small chip powered by an input voltage that on the basis of some binary
addresses, selects different pins so your input voltage can pass through the
selected pin. Let's take a simple example of a 1:4 demultiplexer:

	------------          + (+12V)
    p1  |          | o1       |                                + +
      --+          +--        +    _______            _        | |
    p2  |          | o2       \   |       |----------/ \       | |
      --+          +----------/---|  BC   |         | R |------+ |
        |          | o3       +   |_______|---+      \_/         /
        |   1:4    +--        |       |       |        |         /
        |  DEMUX   | o4       |       |       |        \________/
        |          +--        +-------+     \---/ 
     +--+          |                         \ /
     |  |__________|                        -----
     |                                        |
     |                                        |
     |                                       ---
     + (+12V)                                ///

Ok. Let's explain this now... So what does this DEMUX actually do? It's
really simple once you get the hang of it. Take the natural binary code on
two bits. There are four combinations of 0 and 1:

	     |	p1 | p2 |  DMUX Select  |
	     +-----+----+---------------+
             |  0  | 0  | 0,0 -> o1     |
             |  0  | 1  | 0,1 -> o2     |
             |  1  | 0  | 1,0 -> o3     |
             |  1  | 1  | 1,1 -> o4     |
             +-----+----+---------------+

So basically, what the DMUX does, is to select an output pin according to
what address is at its input. Suppose we set pin 1 (p1) to 0 and pin 2 (p2)
to high, then the DMUX "builds a connection" between the +12V and o2,
powering up the rest of the circuit. In two words: A DMUX is a binary
switch.

So what comes after the DMUX? Well we need some "device" that will alter
it's state every time we supply it a signal. Furthermore, if we remove the
power at it's input, it should still remain in that state until it receives
an impulse. This device is called a bistable latch or a flip-flop. The graph
below shows how it alters its state using the clock (input feed):

              | (V)
              |
              |
       (+12V) |__    ____     ____     ____
              |  |  |    |   |    |   |    |
              |  |  |    |   |    |   |    |
              |  |  |    |   |    |   |    |                (t)
         -----+--+--+----+---+----+---+----+------------------>
              |
              |
              |_____           _______
              |     |         |       |
              |     |         |       |                     (t)
          ----+-----+---------+-------+----------------------->

So as you can see... When the latch gets an impulse it changes it's state
and keeps that state until it receives another impulse, and when it does, it
shifts its state. Thus in our circuit, I've set a led which will light when
the latch is "off" and the voltage drains to the ground through the light
emitting diode.

Using this technique you can... control an infinite number of devices. Think
about it... We haven't discussed the case when you add another DEMUX to the
output of our DEMUX. In any case, the possibilities are infinite.

To use this circuit with our small program, you'd have to know which pins to
set to high and which to low (can be done using the -p switch). To eliminate
this inconvenience I will add in the close future (couple of days, maby
weeks) a web interface. That should shift this project to 1.0.

As usual, comments and suggestions to Rain@home.ro :-)
Rain

pport 0.5d Another schmatic came across my mind while inspecting my own
setup. It is faily possible to wire a multiple power supply so that each
socked can be controlled by your pins. This way of course you will get rid
of having to wire each applicance manually. The device can be switched on
and powered only when the corresponding pin is set. This is our common
multiple power supply:
          ___________________________________ _ _ _ _ _
         /   __     __     __     __                   \               
        |   /  \   /  \   /  \   /  \                   |               
        |  |  O | |  O | |  O | |  O |                  -----              
        |  |  O | |  O | |  O | |  O | etc...           ----- extemder cable                     
        |   \__/   \__/   \__/   \__/                   |                     
         \___________________________________ _ _ _ _ _/

Now the schmatic of such a thing is quite simple:
                                                           +----(phase)
         _________________________________________________/
          O     O     O     O     O     O etc..
           ----------------------------------------------------+
         _O_____O_____O_____O_____O_____O____________________  |  ___
                                                             \_|_/   \
                                                               |      +-(null)
                                                             --+--
                                                             /////

The above is your standard radishack socket extender. When you get yourself
such a thing for this project try to search for simplicity. We don't need
phase regulators and other great stuff. Just a simple plug extender that you
can pull apart easily using some screws. The schmatic you'll see inside is
something like the above: 3 wires, 2 for the actual plug (the phase and the
null) and 1 for grounding. It is not important in our schmatic to know which
one is phase and null, in fact they invert 50 times/second. Now lets focus
on 1 plug from your extender:
          _______
         /   __  _____                              +-----> leave as it is
        |   /  \/     \                            /        wired.
        |  |  O |__    +--------------------------/
        |  |  O |  \_____        +----------------> relay. <---> leave as it
        |   \__/ \____   +-------|----+                         it is wired.
                      \        +-+    |
                       +------/     --+--
                                     /// leave to gnd as it is wired.

So what do we do? Baseline: we take one of the wires that lead to the
"hole", either the phase or the null and cut it. Then the two end we solder
them on the relay making a switch. So when you activate the relay with you
computer it'll make the connection and the circuit will be closed so power
will flow through the relay, activating your device. In order to realise
this project at its full extent, you'll need a 8-plug extender and 8 of
those small devices we built up there in the document. With some careful
solering and carefulness you can integrate the devices and the relays into
the socket extender itself and have only two wires coming out of it: The
normal plug and a parallel port cord to control your relays inside.

Comments and suggestions: 
Rain@home.ro
Rain
