Stepper motors are electromechanical devices that can be accurately controlled without the need for feedback information to know their position. This means that stepper motors do not need sensing and feedback devices, and their positions can simply be determined by keeping track of the input pulses fed to them. They can be controlled to move slowly, quickly, in reverse, and they can pause or do partial and complete revolutions to the accuracy of less than a degree. They are used where precise motion and position control to precise angles is of utmost importance. A number of methods exist for controlling stepper motors from a computer.
- Skill level:
Other People Are Reading
Things you need
- Stepper motor
- ULN2003 IC
- DB-25 male connector
- DB-25 female / male parallel port cable
- Power adaptor
- Solder-less breadboard
Lay out the circuit for the motor on the breadboard as shown on the circuit in the article "Computer Controlled Stepper Motor" (see Resources: Channel 9).
Label the stepper motor wires using your multimeter to determine the common power wire that carries current (see Resources: Identifying the Common Power Wire in Stepper Motors).
Solder the DB-25 male connector to the connecting wires on the board and ensure all connections are correct using a multimeter. This makes it easier to plug and unplug. Test all connections to ensure there are no short-circuits and then plug the connector to the computer when all is fine.
Write the code that will be used to control the motor. The code can be written in either C# or in Visual Basic (VB). The following sample code uses the "InpOut32.dll" library file found in the "Systems32" folder of Windows systems:
private class PortAccess
public static extern void Output(int address, int value);
Private Class PortAccess
Public Declare Sub Output Lib "inpout32.dll" Alias "Out32" (ByVal address As Integer, ByVal value As Integer)
Tips and warnings
- Stepper motors can also be controlled via the USB. All you need is a StepperBee USB adaptor board and then use the installation disk to make the configurations. Alternatively, USB adaptor installation disks come with a DLL (Dynamic Link Library) that allows standard functions to be called using a wide range of languages without having to know USB operation details.
- By learning how to reach and control external devices using the parallel port, you will find it both easy and interesting when it comes to stepper motors. The same procedure applies to controlling LEDs with a Parallel Port.
- The parallel port can be easily damaged if wrong connections are made. Damaged embedded parallel ports require a motherboard replacement. It is thus recommended to have an I/O card with a parallel port and use it for testing purposes.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for