30-03-2012, 03:27 PM
Controlling a Stepper Motor with .NET
controlling a stepper motor with .net.doc (Size: 459.5 KB / Downloads: 27)
Introduction
In this article, we will connect a stepper motor to our computer's parallel port, and then we will write some code to control it with the scroll wheel on a mouse (video). If you have never worked with stepper motors, you will surely have a lot of fun with this project. With stepper motors, you can build things such as robots, automatic fish feeder, or even a computerized etch-a-sketch! I'll start off by discussing the basics of parallel ports and stepper motors. Then, we will build the driver circuit required for connecting a stepper motor to a parallel port. In the final section, we will learn how to communicate with parallel ports and how stepper motors are controlled.
Before we begin, I would warn you that the PC parallel port can be damaged quite easily if you make incorrect connections. If the parallel port is integrated to the motherboard, repairing a damaged parallel port may be expensive, and in many cases, it is cheaper to replace the whole motherboard than to repair that port. Your safest bet is to buy an inexpensive I/O card which has a parallel port and use it for your experiment. If you manage to damage the parallel port on that card, replacing it will be easy and inexpensive.
Parallel Port Basics
A parallel port is a socket found in personal computers for interfacing with various peripherals such as printers, scanners and even some webcams. On many computers, particularly laptops, the parallel port is omitted for cost savings, and is considered to be a legacy port. However, in laptops, access to the parallel port is still commonly available through docking stations. Here's a picture of a DB-25 parallel printer port on the back of a laptop:
What are stepper motors?
Stepper motors are brushless, synchronous electric motors which can divide a full rotation into several steps. While conventional electric motors spin continuously, stepper motors only move one step at a time. They can be used for precise motion and position control as they can be turned to a precise angle.
The simplest way to think of a stepper motor is a bar magnet and four coils:
Conclusion
We have reached the end of this article, but I sure hope it inspires you to start your own experiments with parallel port interfacing and programming. You can use this port to play with a lot of other things like LEDs, relays, etc. Over the last couple of months, I have been using my computer's parallel port for controlling several things, such as lights, fans, RC cars, robots and whatnot. There are things which could be extended, and added to this stepper motor project. You could, for example, use it as a web controlled camera panner. I have used mine as a camera panner which tracks moving objects using a webcam and lasers (video). Just remember that your imagination is the only limit. So, unleash your imagination and the sky is the limit. Have fun!