Welcome! Log In Create A New Profile


Control Steppers Via LPT

Posted by cheeswiz 
Control Steppers Via LPT
February 14, 2009 04:46AM
I was searching for an easy/CHEAP way to control steppers online and found several Parallel/LPT port for Unipolar stepper Motors. i was not able to find a simple Bipolar controller so i came up with this idea based on the designs i saw and what i know about this level of electronics. it has been a while since i worked on this stuff directly and i didnt get to, to deep into it but here goes.

If you connect the LPT as I/O to an H Bridge as step and direction X 2 for each stepper and then to the Bipolar stepper then the stepper can be easily controlled Via the computer directly.

Please let me know what you think, and how/why this can/cannot work. and how it can be improved.

Re: Control Steppers Via LPT
February 14, 2009 07:02AM
The trouble with this idea is that less and less computers have legacy ports (lpt, rs232) Also, with a microcontroller, if more pins are needed the chip can be swapped for a bigger one, whereas you face a hard limit for lpt. These may not be a problem for you, but I expect you'd have to write all the host software yourself. The cost is not much more for a microcontroller, a sanguino is $25, and the same H-bridge is needed for both. Compared to the cost of a reprap, $25 is probably not worth the effort IMHO.
Re: Control Steppers Via LPT
February 14, 2009 07:15AM

thanks for the input but, the software is already written, and i have several older computers with the legacy ports, as well as, legacy ports on PIC and IQA(??) boards. i can easily adapt to programing what ever need be as long as the concept is sound. what i really need is to know if there is something more i need to put into the Circuitry, eg resisters, capacitors, Diodes etc.

i have most of the stuff, if not all the stuff to do this concept, but even the low cost of sanguino is beyond my budget for the time being. also if this works the proof of concept would help me quite a bit.

Re: Control Steppers Via LPT
February 14, 2009 07:26AM
i think this is the first one i found that used this method, however, like this one, they have all been Unipolar steppers. this is i think from +/- 1998 not sure though. it drives a 3 axis "Home Build Hobby Plotter / Engraver" its very cool.

the web page is:


Re: Control Steppers Via LPT
February 14, 2009 07:32PM
Hi guys.

If you have a look over at Oatley Electronics [oatleyelectronics.com] under the 'CNC' section they have a few kits and may have posted diagrams.

One really important thing to bear in mind when using a PC to drive something directly is that it's really hard to get accurate timing, which will muck up your build accuracy or even cause complete failure to move. Also you probably won't be able to do PWM via the LPT at any reasonable rate.

If you're willing to install RTLinux (Real Time Linux) this will help, and apparently there are tricks that can be used with Win XP to tighten up the timing but they are tricky and may impair other functions of the machine (I recall someone talking about having to do things like stop OS services, disconnect network adapters, run as few programs as possible etc.)

Re: Control Steppers Via LPT
February 16, 2009 08:32AM
I started out using the parallel port:

I used a stepper driver from an old dot matrix printer connected to the parallel port, and a couple of FETs for DC motor control. The stepping code was written in C and wrapped as a Python module. (Message me if you would like a copy of the code)

I have since switched to the PIC electronics, as [see jbb post] I was having issues with timing, and also did not see that it was worthwhile re-implementing all of the pic firmware code.

You are still going to need all the stepper driver and DC motor driver and sensory electronics so the only bit you would really be saving on would be the arduino / sanguino.
Re: Control Steppers Via LPT
February 18, 2009 07:57PM
Do H-Bridge chips accept I/O? or is it PWM? if it is, then id have to have an LPT->Micro PWM out put->H-Bridge->Stepper

i know it will have timing issues, however, thats not really important to me, not at least until i get it working, once that happens i will upgrade to Sanguino and build it more standardly.

i would also love to get your code greenarrow.

Re: Control Steppers Via LPT
February 19, 2009 08:39AM
PWM is just switching a digital line on and off really quickly, and changing the ratio of on time to off time (duty) to make it appear like the voltage is varying.

I think H bridge chips will usually just have a digital input to switch them on and off, so you can put either just make the pin high to switch it on, or connect it to a PWM source to vary the output voltage.

I'll have to try and dig it out over the weekend, I haven't used it in a long time so it probably won't so much 'as is' but could be useful for reference. I never put and PWM code into it.
Re: Control Steppers Via LPT
February 19, 2009 06:56PM

Thank You Very Much, i look forward to using your code, as a reference or however i can. and Thank Your for the info on PWM. this is going to be fun if not hard. >grinning smiley<
Re: Control Steppers Via LPT
February 24, 2009 08:05PM
I figgured out how to bucher a few computers, thake the drives and turn them into a stepper controler with a simple loop. however the next step is getting the software to control them for rep rap via the lpt
Re: Control Steppers Via LPT
February 25, 2009 04:19PM
I've found the old code, I can't remember now if I was using this under windows, linux or both. The files are as follows:

pyStepper.c - this is all the low level parallel port stuff
It contains functions to step stepper motors, switch digital lines and read inputs.

Two stepper motors on the data port (4 bits each)
Two dc motors connected to the control port
Some switches connected to the status port
unfortunately all the addresses are hard coded and distributed throughout the code.

pyStepper.i & setup.py - these are used to build the above as a python module

reprap.py - this is a python module that uses the above c code. This gives some higher level control over the machine.

axisInterface.py & imgprint2.py - these are just some old programs in which I was using reprap.py

It's not very well written code, it was an experimental hack at the time that I never tidied up.

I think your best bet in terms of the least work to do would be to write a gcode interpreter that controls your machine over the parallel port.

hope this helps
open | download - lpt_stepper_stuff.zip (5.6 KB)
Re: Control Steppers Via LPT
August 06, 2009 10:40PM
control stepper via lpt schematic
Re: Control Steppers Via LPT
August 22, 2009 06:57AM
One problem i see with driving a H-Bridge thru LPT is that you have to be very careful about switching on the right FETs at the right time. If you try to do stuff too fast, you could provoke "shoot-thru" between the low and high side FETs, and that would mess with your powersupply and can heat up and even overload or destroy the FETs in the bridge.
The problem here comes mainly from the fact that the FETs gate is acting as a capacitor, so if you try to make a transition between states on the gate, you have to suck out the charge first to stop the FET from conducting, or fill up the charge to get it conducting. As you can see, you could end up in an intermediate state where both the FETs are still partially conducting, so you can end up with a short between VCC and GND for a very short time. This can have severe influence as you will have quite a bit of EM interference generated that can affect other circuits (especially your computer that is pretty much directly hooked up to the H-Bride thru the LPT).

If you use a Stepper Control Circuit like the A3982 that is used in the gen3 electronics you'd end up with a pretty simple step+dir interface for your LPT and don't have to take care of a lot of the gate driving and timing problems in your hard- and software. As you get the full H-Brigde in the circuit as well, this is imho the best way to go for controlling a stepper with any parallel interface.
Sorry, only registered users may post in this forum.

Click here to login