Beginner Concepts: LPT Instead Of UC

We see it all the time, a post based on an Arduino board with multiple comments calling it overkill. How exactly should you control your homemade peripherals if you’re not using a microcontroller (uC)? [JKAbrams] and [Tim Gremalm] answered that question with this printer port (LPT) adapter. They wanted an indicator light when someone in an IRC room was talking to them. By connecting a blue rotating light through a relay to the output of this fob they’ve done just that, but there’s room for much more.

The adapter uses a Darlington transistor array IC to protect the computer. A resistor between the LPT and the base pin on the chip ensures that current flow will be well within the safe levels for the computer. The Darlington transistor amplifies the output using an external power supply in order to drive heavier loads.

If you want a deeper understanding of the printer port check out this tutorial. LPT ports are becoming less common and that’s why so many projects are migrating over to USB (plus there’s no need for external power with most USB connected projects) but if you’ve got one, it’s probably not being used for anything else.

28 thoughts on “Beginner Concepts: LPT Instead Of UC

  1. Nice little writeup here, and shows how easy it is to interface simple devices to the PC. It is amazing now many people think you need a microcontroller to do something as simple as blinking an LED from their software.

    Though I suppose somebody is going to make the point that parallel ports are getting rare on more modern machines.

  2. This made me realise that alot of new Motherboards arnt coming with LPT support. Amazing to think that just 10 years ago i had a daisy chain of those things for various Printers and Scanners. Even an Early digital camera connected to my computer through the LPT.

  3. Nice writeup. But a word of caution from someone who has fried a motherboard or two, with a little mistake interfacing on the LPT port with a setup very similar to the writeup… Nothing beats opto isolation in my mind.

  4. You can pick up parallel ports on a PCI card relatively cheaply (I added two serial ports and one parallel port to my desktop using such a card). Be warned that USB parallel port adaptors are usually only good enough for printers, as they won’t give you direct access to the parallel port registers for direct control of the pins.

  5. For those of us who haven’t seen a LPT port in years, go dig out your old server and desolder the ISA connector and scavenge the ISA printer port card, You can use the SCSI ribbon cable to make the connections. Then make a USB to LPT adapter and Bob’s your uncle.

    Alternatively, buy a $15 FTDI usb cable and shove an AVR in the end of it.

  6. For decades the LPT port had been the ultimate joy of hardware hackers. Then, some 5 years back, the microcontrollers have become ubiquitious, FTDI made USB much lesser a mystery and today even the elder folks don’t lament glitchy, unreliable, windows-hogged LPT ports anymore.

    And there we go in 2010: breaking news, LPT port can be used as I/O!

    Having said that, my AVR programmer is still hooked to an LPT port ;)

  7. There is something very nice about the simplicity and accurate real time nature of the parallel port. The biggest problem with it is the pincount, 25 pins. Back in the day(70’s-80’s) they should have designed a generic 9 pin or 10 pin port that can either be used as a parallel port with 8 bits or 2 serial ports at the same time. These days PC’s no longer run real time OS’s, and there is no way to ask to temporarily suspend multitasking and request some realtime. Though staring at the hourglass in old Win 31 on a 386, or Vista on a fairly recent computer provides similar user experience, without feeling like the user is getting something in return for a temporarily disabled interface.

  8. Ok, using an arduino and using a microcontroller are not mutually exclusive.

    All microcontrollers are not Arduinos, and all microcontrollers are not considerable overkill for most projects like the arduino.

    There is no problem using a PIC or ATMega/ATTiny or something for your project, as long as you build something within the scope of your project and know how it actually works.

    A tweeting plant waterer with full TCP/IP service and ethernet? Ok, that might need an Arduino. A LED driver to RGB mix a few LEDs? Gimme a break, you can do that without a uC at all and you certainly don’t need what is in effect a small pre-built computer to do it for you.

    Also, it’s a Parallel port. LPT is a specific software identifier which can be mapped to any number of ports of several different types.

  9. The USB port has quite a complicated packet based protocol, where header packets, payloads, and status packets have to be analyzed and sorted. Still, besides the 1.5MBps/12/480 lo/full/hi speed settings, they could have added a packetless rs232 option, where something plugged into the port and not responding with an intelligent ack packet within a given time is automatically treated and brainless rs232 300baud-480Megabit/s. USB to a 3.5 mm stereo headphone RS232 connector you’d be talking really low cost devices, hobbyist hackable too. An FTDI chip that transforms the complicated USB to RS232 is $5-20, when we should have something for $0.05 instead. The USB protocol is too complicated for simple things. If anything, a uniform TCP/IP based system should have been used for USB packets too, and then if I can get it from USB, I can get it across the web, without needing intelligent translation “drivers” and OS in between, just dumb routers of blind copies of packets.

  10. Analyzing the rs232, needing precise timings, capturing the rs232 byte packet, plus it’s time characteristics, to find out why something is not working is still more complicated than looking at the debugging LED’s light up on a parallel port, as you step through your program one instruction at a time. Unfortunately the minimum pincount of an LPT is 8 pins for 1 byte at a time, plus some ack line for hardware clock transfer. But 9 pins and wires are a lot easier to solder/crimp than 25. But usb to dumb 9 pin is impossible, because USB only has only 4 wires, and 2 of those are power, but USB to dumb serial, and dumb serial to intelligent 9pin parallel could be possible via something as cheap and simple as a shift register right inside the 9pin connector, without drivers, directly in hardware of USB, bios configurable as either a driverless dumb RS232 or driverless realtime LPT port.

  11. If you are looking a a quick way to interface your computer with the real world, then there is nothing cheaper or simpler than the parallel port (but NOT the USB adapter version).

    One of the best reference books is “Parallel Port Complete” by Jan Axelson (check Amazon, etc for it).

    You don’t need particularly high skill levels, or sophisticated tools. You can pick up an older compute to run this for next to nothing these days (kerbside pickup, relatives hand-me-downs, etc).

    It’s a lot simpler than V-USB, etc (no micro-controller programmer needed, no device driver needed, etc) and people have been doing it for years, so there is a lot of material around on the ‘net and in print.

    If someone is looking at dipping their to into the water, then leave USB until later – the parallel port is much simpler and easier to understand.

  12. @slincolne “but NOT the USB adapter version”

    What is the cheapest USB to digital IO that is avaialable off the shelf and immediately usable?

    There are plenty of very cheap USB to RS232 or USB to LPT cables… The question is which ones have the ability to read and write to pins?

    It would be great to find a $5 cable that anybody could buy, that was easily controlled digitally from either Windows or Linux. (An Arduino does this, but is expensive overkill if you only need a few digital IO, and we can make our own cheap and easy solutions, but that isn’t an off-the-shelf solution for the masses.)

  13. Unfortunately the reality of the parallel port is much harsher than stated here, often you’ll find ports that are not standards compliant, have no input mode setting in the bios or are just plain broken or crap. So if you’re going to use parallel in your next project, test your intended computer’s port before you invest any time.

  14. If you have to buy/acquire an entire computer to GET a parallel port, you might as well just use the Arduino… less waste, lower energy requirements, smaller footprint, lower overhead.

    You can be purists if you want to, but, it gets kind of ridiculous…

  15. @robocat “There are plenty of very cheap USB to RS232 or USB to LPT cables… The question is which ones have the ability to read and write to pins?”

    I recently bought a $3 usb->rs232 adapter from dealextreme. It uses a pl2303 chip, so just works under linux. I was also surprised to find all control lines (rts, dtr, dcd etc) are properly hooked up. If you’re not trying to bitbang time critical protocols but just turn a couple of relays on/off I think that should work. Pretty easy to interface through something like pyserial too.

  16. FTDI chip also makes the 245 USB to Parallel chips, which come on a DIP module for about 20 bucks, which works nicely if you want an 8-bit port, and it runs on the same drivers as the serial chips.
    I think I like that better since all newer computers have USB and only the DIY desktop motherboards seem to still come with parallel ports.

  17. It’s not just that hardware parallel ports aren’t available any more. There’s no point to them; Windows doesn’t let you anywhere near the hardware, and Windows isn’t suitable for timing critical applications anyway. (Yeah, I know, Linux. Tell it to my customers.)

  18. actually, the hardware is still available – if you have a laptop, you can get an Expresscard parallel Port and, from my understanding, they work just fine (though someone should confirm if they can)…

    -Jimmy

  19. Jimmy, yes the express card parallel port works just fine ‘n’ dandy.
    My understanding is that these exist because people need them for CNC machines which use the parallel port.

    With my last laptop, I wanted a way to program Xilinx stuff without shelling out a couple hundred for the official Xilinx USB platform cable.. so I picked up an express card parallel port on ebay for about 60 bucks and it worked like a charm.
    I had read around that the USB-parallel would not work since they were designed strictly for printers and not made to be full featured.

    However it’s kind of overkill for hobby stuff. Like everybody in this thread has been saying, for much less money you can get an FTDI chip cable and an AVR, no need for any external power supply.

  20. Interesting discussion regarding parallel ports, seams to be a touchy subject for some.

    Myself I just like the simplicity of it, I think many people would like to get some basic I/O out of their computers, and this might just (for those with a parallel port) be the most simple way to do it when you like to understand all the parts involved, the complexity is close to zero.

    In our case we already had the computer (with an unused parallel port) and going mc only in this case would be programatically overkill having to implement tcp/ip and IRC on the microchip.

  21. I find “just move on” rather curious. The Bleeding Edge makes good sense in manufacturing, but to the individual hacker the past represents a rich *resource*. Machines with parallel ports are unfashionable and a dime a dozen, but that doesn’t mean they are useless, far from it.

    It may be *sexy* using an expensive laptop for bench experiments, but given the real risks to your gear it is much more sensible to use one of the many castoff old junkers like are stacked in my storeroom. They all still do what they were built for and that is normally way in excess of hacker’s needs.

    It’s a damn shame it wasn’t fully bi-directional from the start, but you can still do a hell of a lot with it.

Leave a Reply to mrgoogfanCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.