Parallel Port Control done right!

OK, we covered that with DOS you can easily control data pins of a Parallel port. Here is a short list of pros and cons.

Cons

  1. DOS is Outdated.
  2.  Can only turn on the pins and to turn off you have to turn them all off. So if you wanted Pin2 on and want to turn off say Pin5 you have to turn Pin2 off by issuing all the data pins to go low.
  3. Only good for turning things on.

Pros

  1. The retro aspect with DOS is fun.
  2. You know for sure it will work since every old machine has a parallel port.
  3. Low system resources is required.
  4. Easy to setup and use.

Now not all of us have DOS, know how to use DOS or prefer multitasking. With this done right approach we can issue a Linux system to do our bidding and a proper circuit to drive the parallel port.

Newer versions of Linux attend to leave out the Parallel port as a default kernel module. Since there are all sorts of flavors of Linux lets stick with Debian as the example.

To see if the kernel has a parallel port configured we need to run a command. It would help if you are a member of the sudoers file so you can issue root commands.

dmesg | grep parport

That command will search the system output log for the parallel port. In Linux the parallel port is typically /dev/parport0.

On the output of that command yo should see something like this.

[   13.265525] parport_pc 00:0a: reported by Plug and Play ACPI
[   13.265525] parport0: PC-style at 0x378 (0x778), irq 7 [PCSPP,TRISTATE]
[   48.673384] lp0: using parport0 (interrupt-driven).

If you don’t get a response then you’ll have to compile a new kernel or you might be able to load the kernel driver. Since we’re using Debian then chances are the driver is loaded since the Debian installer scans the hardware and adds the proper kernel modules.

Now we need to make sure your user can access the parallel port. Issue the command whoami Now we know the exact name the system sees you as.

Issue the command

ls -l /dev/parport0

You should see something like this.

crw-rw---- 1 root lp 99, 0 2016-02-17 10:15 /dev/parport0

Now we need to add your user to the lp group. Just change the adduser in bold to your user name from the whoami command.

sudo adduser user lp

The software side is pretty much done. If you have the development stuff installed on your system you can download this, compile it by issuing make and you can turn Data and Control pins on and off. Also check out this page. Same info I used for this guide.


Since we got the basics of the computer ready we need a solid circuit to be able to plug into. It’s up to you on how to connecting it the parallel port. I myself use a old printer cable but yo can buy a breakout board. But as for controlling Relays and such we need a proper circuit. Now the voltage from a parallel can range from 3.3v to 5volts. This isn’t you’re typical 3.3v and 5v but digital voltage since this is a digital output. It’s low voltage and very low current. Too much load your device won’t work right and too much you can burn up the parallel port.

If you’re planning to control some digital logic then you can toss on a transistor or two and bob’s your uncle but you’re still gambling because sooner or later you’ll need more power. If you want to control other things what is typically analog like lights and such then yo want to isolate it and bring in another power source. Even if you’re planning to do low voltage stuff you still want to isolate it. Granted you can use relays and some hex inverter to cancel out switch bounce but a simple opto coupler is cheaper and easier to use. For DC to DC isolation I would use a 4N35 opto coupler. If you so desire a relay I would use a 9000 series reed relay since it only needs 5mAs.

Isolating it will let you to properly use a external power supply without fear of it frying your computer. Also be sure to not share the ground path with the parallel port after isolation. Since the parallel port is a digital source it would be nice to have analog in the mix. For this we need a R- 2R ladder. It’s basically a digital to analog converter. Here is a video I found from w2aew on YouTube. It covers everything you need to know about R-2R ladders. Also a neat thing is you can toss on a voltage follower to the ladder’s output.

Later on I’ll toss on a schematic for a breakout board since I plan on building one.

Since the parallel port is isolated we can pretty much do what we want. If you plan to control AC voltage I would use a high voltage rated relay or a opto coupler that is rated for AC.

Honestly I’m looking into controlling my lab power supply project with it for fun.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s