Converting Parallel Port CNCs To USB

If you’re looking for a small, benchtop CNC machine for PCBs and light milling the ubiquitous Sherline CNC machine is a good choice. There’s a problem with it, though: normally, the Sherline CNC controller runs off the parallel port. While some of us still have a Windows 98 battlestation sitting around, [David] doesn’t. Instead, he built a USB dongle and wrote the software to turn this mini CNC into something usable with a modern computer.

First up, the hardware. The core of this build is the rt-stepper dongle based around the PIC18F2455 microcontroller. With a bare minimum of parts, this chip converts USB into a parallel port for real-time control. It’s fast — at least as fast as the parallel port in the ancient laptops we have sitting around and plugs right into the CNC controller box for the Sherline.

The software is where this really shines. the application used to control this dongle is a hack of the EMC/LinuxCNC project written in nice, portable Python. This application generates the step pulses, but the timing is maintained by the dongle; no real-time kernel needed.

There are a lot of choices out there for a desktop CNC machine made for routing copper clad board, wood, brass, and aluminum. The Othermill is great, and Inventables X-Carve and Carvey are more than up for the task. Still, for something small and relatively cheap, the Sherline is well-regarded, and with this little dongle you can actually use it with a modern computer. Check out the demo video below.

45 thoughts on “Converting Parallel Port CNCs To USB

  1. The older mills and driver boards are meant for a real time MSDOS control loop.
    LPT was the last low-level peripheral on PC accessible to the OS, and is still used by EMC/LinuxCNC RT kernel.
    This simple driver design has persisted for decades because it works.

    USB host software stacks are probably the worst for unpredictable latency issues given the physical layer protocol.
    It is why the buffer on emulated UARTs ballooned to several kB .

    Designers have to use several strategies to fudge multitasking like behavior around a RT system.
    Indeed, the RTlinux only can offer guaranteed latency, and other RT systems use dumbed down round-robin task schedulers.

    1. Since I will inherit a 4030 from a friend soon – with a early 2000s PC attached – what would be the easy conversion to get rid of the PC? I am thinking that either an Arduino GRBL or a Rasp could do the job well – as in “has plenty of GPIOs to do it”. Thanks for clarifying why USB is worse than LPT in this case – I was always wondering.

      1. Be careful about the 3d printer firmwares, almost none of them handle acceleration properly. GRBL uses a “junction deviation” hack because the 8-bit atmel cannot do enough math, and everyone inherited that weakness.

        LinuxCNC, KFLop, and Mach3/4 include proper corner rounding and s-curve acceleration although Mach won’t let you choose between CV and exact stop modes.

      2. EMC/LinuxCNC kernel modules does things Mach3 couldn’t dream of doing because Windows DDK/SDK has far less stable timing from the sand-boxed API and layers of task schedulers.
        EMC was originally built by Darpa, and can actually do hard problems like maintain consistent cutting speed in a spline curvature.

        However, Mach3 is easier to setup, so hobbyists think they are saving time… but they are wrong… and you can’t argue with them because it sorta works for the level of work they do.

        I have seen people try SBCs (Raspberry Pi etc.) on CNCs, but since they lack a true internal RTC they are just as problematic for timing.

        While Arduino and the like can do a lot for 3D printers as a gcode parser, they were designed by hobbyists… so make many inappropriate assumptions about physics. The are not meant for CNC mills, and you will never get it to work reliably for the mentioned reasons.

        Stick with the PC LPT method, and dedicate the machine for driving 1 and only 1 mill.
        One last remark, a true shop will have a minimum of 2 mills… one with a metric cut screw thread… and one with a US standard thread.
        ;-)

    2. I wouldn’t call MSDOS an RTOS since it’s not multithreaded and essentially all the interrupts can be disabled. There is no tasking except for the single program at hand. But that sounds like is is why it was so effective.

      A modern PC looks more like a collection of micro controllers than a CPU and peripherals. USB is one of those interfaces that driven by something that looks at least a bit like a micro controller.

      It does seem like using modern micro controllers that are much faster than DOS era PCs to run this stuff would be a better solution as long as the ‘operating system’ does not support multi-threading.

    1. Ebay usb to parallel port works quite well for old printers, but the latencies are much higher than with a “real” parallel port on a motherboard, preventing it to generate correctly the khz range signals needed to drive cnc steppers correctly.

      This project, much like GRBL, sends gcode to the PIC, which generates the signals without latencies problems.

      1. No, this project sends only pulse timing to dongle, not full gcode. Gcode to pulses is calculated on pc, but dongle only needs to maintain timer and send those pulses at correct times. It’s much cheaper and easier this way.

    2. A lot of ebay USB to Parallel /centronics adapters have nasty fudged drivers with timing issues & compatibility problems with software that wants to talk direct to hardware. Mercury laser products suffer these issues still, worst part is the printer driver that comes with the device (purchased last year ) is still windows XP based and not Win 7/8/10 with security catalog, the newer OS does not allow this USB port/driver combo at all, XP was the last version to allow this behavior AFAIK. In that case we used a windows XP virtual machine and printer sharing, the USB printer port adapter is handed over to the virtual machine and that then shares that printer over the network(virtual network) , a complete hack IMHO and not what I would expect of a brand new product. I mean it’s 2017 and a brand new laser engraver comes with old school centronics & serial (note the serial connection is so slow that it sometimes times out or it’s a firmware issue in the laser engraver) ,oh they did include a fake FTDI usb serial adapter but windows driver update took care of erasing the PID & VID.

    3. That $5 cable works with printers and ONLY printers. It’s emulating a centronics printing device, and offers NO low level access. With the real deal, you can toggle bits directly by writing the right number to the correct address in memory, and you can do it as fast as your CPU can write there. (that’s why the claim that this USB dongle is faster is utterly ridiculous and betrays how little the author knows about early PC hardware) The reason you can’t add a parallel port to a PC using USB or the like, is because they were originally mapped/wired directly into the physical address space of the machine. You just can’t do that anymore unless your chipset supports it. You either have a parallel port, or you do not.

      This is a neat trick, and it’s a decent stopgap for a device that has a parallel shaped connector that needs pins turned on and off, especially if it’s a mechanical machine that can tolerate mechanical-level latency, but it’s absolutely no replacement for a parallel port.

  2. “the ubiquitous Sherline CNC”
    Being out of the USA I entered “sherline cnc” on aliexpress and came up with results ranging from $2500 usd to one for $25000 the size of a small truck. so I guess neither is the ubiquitous sherline cnc you’re talking about. Was including a link too hard?

    1. Most of us buy a more or less manual sherline and then add on our own electronics, meaning the package is closer to $1400USD plus lots of labor. For about 50% more money you can get a full-sized mill, but the nice thing about the Sherline is it fits in a small space rather than requiring a concrete floor and a three meter high ceiling, hence its ubiquity.

      1. Not sure how it beats it, Smoothie has the best documentation around ( by very far ), has remote UIs, is compatible with way more things ( and actively works with host/cam software developers to make it even more so ), is more/easier to configure/get to do weird things, has a larger community, more features …
        Pretty much the only thing I can see is MachineKit can generate steps faster, but that’s insanely rarely relevant, and Smoothieboard v2 solves that soon.
        You need to read up on Smoothie :) I’ll admit we suck at showing how good it is though.

  3. Would love something like this to use with older parallel port software dongles. I’ve got some older hardware and software similar to this but it requires an older PC with serial and parallel ports. USB to serial works with the correct cable, not just any one would do, USB to parallel, have not found a solution.

  4. I have just finished converting my sieg x1 from lappy with mach3 to headless with ramps and lcd, just do not have the space for pc’s,
    I also built a small gear cutter, also headless, the advantage of ramps with repetier is that I can use bigger stepper drivers if needed.
    I looked for grbl on ramps with sd and lcd but could not find, anyone know of such a project, I would prefer grbl over repetier as it does not have all the 3d printer stuff.

      1. Yeah, I’m running a job that’s putting a three-dimensional contour in 12mm steel right now, on my Sherline. It’s not *happy* about it, but I’ve built a half dozen of them, and they have 0.1mm precision. Not great, but not something you can do on any shapeoko I’ve ever seen.

  5. If you have only your parallel port adaptor hanging of its own dedicated USB root port (no hubs between it and the root port) you can get jitter down very low using isochronous transfers (at the expense of variable transaction rates), or just wing it with bulk transfers knowing there is no contention and the longest they may have to wait is a couple microseconds.

    1. I have only heard good things about these boards. My only qualm is that they only seem to work with Mach3/4. They don’t even release specs on the communication protocol so people could write their own drivers.

  6. My answer was a lavabit pci dual lpt card in a more modern machine running linuxcnc. It was so cheap once I researched and tracked down the right card, I bought two, so I have a spare. Also gave masses of IO with its dual ports for extra axis’s, sensors, switches etc as I quickly ran out of pins on the first port breakout board.

    1. Nice cheap LPT cards seem to be one of the things that makers are really missing out on. Seems like a great way to play with GPIO on a full desktop machine. Of course a PI3 isn’t a bad desktop machine.

  7. GRBL with a parallel breakout($15 on tindie) does basically the same thing. And with that you can stream GCODE from any computer. However, it doesn’t have all the features of LinuxCNC

  8. Certainly not ideal for some of the reasons above, I created the “LPTshield” project. it was made for someone else that needed it for GRBL-tinkering: I’m sure it’s “too much” in some respects, and “not optimal” for other reasons. But… my CNC buddy is happy to play with it.

  9. I will give this a try. The issue I have is my Light Machines Spectralight mill (Sherline) requires an ISA card to control the mill via parellel port. A few people have reverse engineered the card but it is working for only a select few due to model#s and such. They still sell the card that you can buy for almost a thousand dollars but then to try and find a motherboard capable of running the card and having something other than a rock is not likely. I am planning to just replace the steppers and controller all together. Im done messing with it trying to rig it up to work.

    1. I have a Spectralight mill with the controller box but no computer card. It was fairly easy to get working on Linux CNC with a computer with a parallel port. The trick is to feed the output of the parallel port to a breakout board, then to the controller. There is information on the web on the pin map to use.

  10. Now that we are talking CNC and related stuff anyway a quick related question to the HaD CNC users community: What software are you using for CAD/CAM and generating the needed G-code/toolpaths? I got a bit spoiled using Solidworks and SolidCAM in university and since then haven’t found anything user friendly for hobbyist use.

  11. I’ve tried to use usb-to-parallel port adapters on old (non-printer) devices, but they never work! I guess printer drivers operate differently?

    Ideally, I’d connect to my parallel port devices using usb to a virtual machine running the original software (winxp/95)… but that means the usb driver has to intercept the _inp/_outp, that does the io read/writes to 0x378 and route it to/from the parallel port/db25 connector.

    Any suggestions or thoughts if this is possible? I found a couple sites that seems like there’s hope!
    http://www.drdobbs.com/windows/direct-port-io-and-windows-nt/184409876?pgno=3
    http://electrosofts.com/parallel/parallelwin.html
    https://web.archive.org/web/20130823054744/http://hem.passagen.se/tomasf/UserPort/

Leave a Reply to AlexCancel 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.