Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Stepper Motor Control

Status
Not open for further replies.

TheNewGuy

Member
I have this ULN2003 that I have connected to my Parallel Port. The ULN2003 is connected to my stepper motor. Using this circuit:

**broken link removed**

The only problem I have now is the software. Software is not my strong point at all. I'm learning the very basics of C++ right now. I'm running Windows XP, and from what I've read you cannot output info with Windows XP to your Parallel Port? So I would have to use linux (I have Ubuntu on CD right now)?

Can you guys help me out? How would I control this motor?

EDIT: This schematic was taken from Electronics-Diy.com.
 
Last edited:
As drawn your circuit won't work. everything is wired to the same positive pole of your supply voltage. A unipolar stepper is given +volts at the motor and then the controller switches each coil to ground in the correct sequence.

To start the journey on stepper motors start with this tutorial; Jones on Stepping Motors
 
It's not exactly true that you can't outptu to a parallel port under Windows XP. But you do need a special driver to do it. Fortunately, there is a free driver you can download and use. Look up the inpout32 parallel port driver. I use it for all my parallel port projects.

And I think you're schematic will work fine as long as your motor is like the one shown.
 
Last edited:
As drawn your circuit won't work. everything is wired to the same positive pole of your supply voltage. A unipolar stepper is given +volts at the motor and then the controller switches each coil to ground in the correct sequence.

To start the journey on stepper motors start with this tutorial; Jones on Stepping Motors

But the IC needs positive voltage as well. The only thing the coil windings are connected to is the IC, which means the only two things that the 12 Volts is connected to is the IC and the motor. Explain?. Also, thanks for the link.That website came up when I was researching this project in Google, it is very informative and helpful. But it did not explain enough on the software side on how to do it.

It's not exactly true that you can't outptu to a parallel port under Windows XP. But you do need a special driver to do it. Fortunately, there is a free driver you can download and use. Look up the inpout32 parallel port driver. I use it for all my parallel port projects.

And I think you're schematic will work fine as long as your motor is like the one shown.

Thanks for the driver, that saves me a lot of trouble. I tried searching on Google for some software already written to control a stepper motor. I was thinking, since I'm trying to learn C++ anyway, it would be a good learning experience to write it in C++. I found some code already written, but because of Windows XP and the Parallel Port, it would crash. I am hoping I can just edit it and make something work. So I will try this driver and see if I can use it in a C++ program.
 
Last edited:
The only thing the coil windings are connected to is the IC, which means the only two things that the 12 Volts is connected to is the IC and the motor. Explain?.

I think it's fine. It should work just as it is.

So I will try this driver and see if I can use it in a C++ program.

I think you only need to put the driver ".dll" file in the folder your program runs in, and the .lib in the folder with your sources. My dll file is in the "Debug" folder because I am running from that one. I can help with the code if you get stuck. I also suggest you test your code with 4 LED's connected to your port thru 330 ohm resistors. That way, you can verify the code before fooling around with the rest of the hardware.
 
Last edited:
I found a bunch of code written in C++ that used the outputportb and _outp functions that don't work. How would I go about replacing them with the functions/commands provided by inpout32.dll? Maby it would be easier to just start blank?
 
It shouldn't be too difficult to modify existing code. Once you have the files in place, as memtioned above, you first prototype the inp and outp functions:

Code:
short _stdcall Inp32(short PortAddress);
viod _stdcall Out32(short PortAddress, short data);

Now you are free to replace old functions with these:

Code:
int tdo, tdata;

tdo = Inp32(957);
...
Out32(956, tdata);

Use your computer's control panel to find the parallel port's address, and remember to convert it to decimal for these functions. There are good tutorials on a site called "Beyond Logic"

And, my code was copied from example code I found online. Follow the links from the site given above to the inpout32 site, and I think you'll find the example code there.
 
Status
Not open for further replies.

Latest threads

Back
Top