Click here to Skip to main content
13,290,729 members (74,711 online)
Click here to Skip to main content
Add your own
alternative version


105 bookmarked
Posted 1 Jul 2004

Stepper Motor Control through Parallel Port

, 16 Jul 2004
Rate this:
Please Sign up or sign in to vote.
Motion control of the most widely used Stepper Motor through PC's Parallel Port.

Sample Image - stepper_motor1.jpg



The article is on stepper motor, reaching ports, and controlling it. The article allows you to control speed, direction, and step size of a stepper motor. If you are interested in robotics, motion control, or just want to learn about this widely used motor in almost every electronic gadget like floppy drives, printer, scanner, robots, every device; then you should try building this versatile stepper motor control.

This article also provides precious information about the basics of stepper motors, as there is not much literature spread out about it. It will help you go grasp the understanding, and control the MASTER MOTOR. You will also learn how to interact between PC and external devices, (PC interface through parallel port).


Mmm.... For the circuit part, I hope you know the basics of digital electronics, so that at least the names of components look familiar to you. Not much advanced knowledge is required. As far as Parallel Port and programming is concerned, it will be better if you get a look on the article "I/O Ports Uncensored - 1 - Controlling LEDs (Light Emitting Diodes) with Parallel Port ---- By Levent S". And you should know either Visual Basic or C. I have chosen VB to program, as I think it is the most widely used and easy to understand language.

So to sum up, you should have background of:

  1. Either Visual Basic or C.
  2. Read about accessing parallel port, given in the article "I/O Ports Uncensored - 1 - Controlling LEDs (Light Emitting Diodes) with Parallel Port ---- By Levent S" published in this site itself.
  3. A little understanding of electronics.

Using the code

Well, I have chosen to program in Microsoft Excel VB editor and not using form, as in Excel, you can make dynamics changes, edit the code, and simply run it. No need to compile it by yourself again and again and build the exe file. Microsoft Excel VB editor is very easy to edit and understand, even easier than VB itself!!. You can reach VB editor from Excel by going to Tools Menu -> Macros -> VB editor.

Reaching VB editor in Excel

Before downloading the demo project and source code, I would suggest you to download my documentation Word file which is zipped, and read the file. It's a documentation of the whole project in Word format. I have explained everything there in a very systematic manner, as dumping all the circuits here will make it look like a monster.

The Important points to understand

If you want to send some signals to the parallel port, you can easily do it. The trick lies in the macros of Excel. Yes, just record a new macro, stop it, and edit it in VB. Delete the inside of macro and type the following following code:

out 888, 255

This command requires inpout32.dll in your system32 directory which is in C:\Windows generally, as explained in the I/O Ports Uncensored - 1 - Controlling LEDs (Light Emitting Diodes) with Parallel Port ---- By Levent S" article. And you have to import the DLL file into your program. The 888 is the parallel port address in decimal number, and 255 is also a decimal number, binary equivalent of which is 11111111. That is, all the 8 data ports will become logic high. Hence by varying the number, you can regulate which number is to be kept high.

Points of Interest

Performing this project is not merely understanding the controls but it is to achieve something that is real, physical, and emotional. When I first glow an LED from Parallel Port, it was an amazing experience of giving the power to control anything through PC. So, I moved on a bit... to the stepper motor where you have external power supply to run the device. The inside feeling cannot be expressed, as after this, your imagination can make you a millionaire. It can be used in many applications like building a car robot, you can fit a web cam, or digital camera to precisely control the rotation and position of it. You can build a robotic arm by using various stepper motors, You can do a thousand things it is up to your imagination...

The work on this project was started in 4 June 2004 and completed on 8 July 2004. I made it in Indian Institute of Information Technology, Allahabad (IIITA) India, Robotics Lab during 1st year holidays. I am especially indebted to Dr. G.C.Nandi sir who took great pains in going through the problems that came in between, materials availability, and providing me right direction, and he made valuable suggestions. And I like to thank Sir Ram Kishore who taught me the basics and helped in circuit enhancements.

Final Note

English is not my first language, so please excuse any mistakes. This is my first article for CodeProject, so any suggestions and/or feedback will be appreciated. Thanks for reading till here.

Sample screenshot


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

India India

You may also be interested in...


Comments and Discussions

GeneralRe: bipolar 4 wire Pin
Bhaskar Gupta13-May-05 19:02
sussBhaskar Gupta13-May-05 19:02 
GeneralRe: bipolar 4 wire Pin
Tomuk513-May-05 21:49
memberTomuk513-May-05 21:49 
AnswerRe: bipolar 4 wire Pin
tekmark8-Jun-07 14:09
membertekmark8-Jun-07 14:09 
Generalneed it urgently Pin
aammiitt_221-Apr-05 21:48
memberaammiitt_221-Apr-05 21:48 
GeneralRe: need it urgently Pin
Bhaskar Gupta21-Apr-05 22:19
sussBhaskar Gupta21-Apr-05 22:19 
GeneralRe: need it urgently Pin
Member 8586564-Feb-10 20:20
memberMember 8586564-Feb-10 20:20 
GeneralConvert the code to .exe format Pin
Anonymous31-Jan-05 5:00
sussAnonymous31-Jan-05 5:00 
GeneralRe: Convert the code to .exe format Pin
Tahir 454518-Nov-11 22:30
memberTahir 454518-Nov-11 22:30 
GeneralConvert code to .exe format Pin
Anonymous31-Jan-05 4:53
sussAnonymous31-Jan-05 4:53 
GeneralRe: Convert code to .exe format Pin
Gary Reese4-Mar-06 5:39
memberGary Reese4-Mar-06 5:39 
GeneralData in trough parallel port Pin
kharma26-Jan-05 8:40
memberkharma26-Jan-05 8:40 
GeneralADC interfacing with a PC Pin
Nisha200523-Dec-04 20:15
memberNisha200523-Dec-04 20:15 
GeneralRe: ADC interfacing with a PC Pin
Anonymous5-Jan-05 6:34
sussAnonymous5-Jan-05 6:34 
GeneralThe Optocoplers Pin
Sagfu23-Oct-04 19:23
memberSagfu23-Oct-04 19:23 
GeneralRe: The Optocoplers Pin
bhaskar_gupta24-Oct-04 0:17
memberbhaskar_gupta24-Oct-04 0:17 
GeneralRe: The Optocoplers Pin
nripun17-May-05 1:40
membernripun17-May-05 1:40 
GeneralRe: The Optocoplers Pin
Bhaskar Gupta17-May-05 7:00
sussBhaskar Gupta17-May-05 7:00 
GeneralRe: The Optocoplers Pin
Gary Reese12-Feb-06 17:16
memberGary Reese12-Feb-06 17:16 
GeneralWhy use inpout.dll Pin
vmelkon22-Oct-04 7:11
membervmelkon22-Oct-04 7:11 
GeneralRe: Why use inpout.dll Pin
vmelkon24-Oct-04 5:21
membervmelkon24-Oct-04 5:21 
GeneralRe: Why use inpout.dll Pin
bhaskar_gupta24-Oct-04 9:32
memberbhaskar_gupta24-Oct-04 9:32 
GeneralRe: Why use inpout.dll Pin
vmelkon24-Oct-04 16:36
membervmelkon24-Oct-04 16:36 
GeneralRe: Why use inpout.dll Pin
raizada28-Apr-06 6:50
memberraizada28-Apr-06 6:50 
GeneralRe: Why use inpout.dll Pin
Anonymous25-Oct-04 8:04
sussAnonymous25-Oct-04 8:04 
GeneralRe: Why use inpout.dll Pin
vmelkon25-Oct-04 16:05
membervmelkon25-Oct-04 16:05 
GeneralRe: Why use inpout.dll Pin
wormer9017-Nov-04 0:22
memberwormer9017-Nov-04 0:22 
GeneralStepper Motor Control Pin
Anonymous2-Aug-04 16:36
sussAnonymous2-Aug-04 16:36 
GeneralRe: Stepper Motor Control Pin
bhaskar_gupta3-Aug-04 0:36
memberbhaskar_gupta3-Aug-04 0:36 
GeneralRe: Stepper Motor Control Pin
inschris5-Sep-04 10:28
memberinschris5-Sep-04 10:28 
GeneralRe: Stepper Motor Control Pin
bhaskar_gupta7-Sep-04 2:58
memberbhaskar_gupta7-Sep-04 2:58 
GeneralRe: Stepper Motor Control Pin
paolopix24-Mar-07 9:05
memberpaolopix24-Mar-07 9:05 
GeneralRe: Stepper Motor Control Pin
Member 1018858525-Aug-13 4:22
memberMember 1018858525-Aug-13 4:22 
GeneralRe: Stepper Motor Control Pin
criker3-Aug-05 3:03
susscriker3-Aug-05 3:03 
GeneralRe: Stepper Motor Control Pin
mallows14-Feb-05 19:49
membermallows14-Feb-05 19:49 
GeneralRe: Stepper Motor Control Pin
Thet Htun19-Aug-05 8:54
memberThet Htun19-Aug-05 8:54 
Generalgreat article Pin
Vasanth S2-Aug-04 9:54
sussVasanth S2-Aug-04 9:54 
GeneralRe: great article Pin
bhaskar_gupta2-Aug-04 12:08
memberbhaskar_gupta2-Aug-04 12:08 
GeneralRe: great article Pin
Vasanth S2-Aug-04 15:13
sussVasanth S2-Aug-04 15:13 
GeneralRe: great article Pin
bhaskar_gupta3-Aug-04 0:19
memberbhaskar_gupta3-Aug-04 0:19 
GeneralRe: great article Pin
Gary Reese30-Oct-04 19:06
memberGary Reese30-Oct-04 19:06 
Generalhow reallay we control stepper motor through Pin
FutureDream28-Feb-05 13:34
memberFutureDream28-Feb-05 13:34 
GeneralRe: great article Pin
ThatsAlok17-May-05 23:48
memberThatsAlok17-May-05 23:48 
GeneralNeed some help about Stepper motor Pin
Amir Hussain30-Jul-04 8:04
sussAmir Hussain30-Jul-04 8:04 
GeneralRe: Need some help about Stepper motor Pin
bhaskar_gupta30-Jul-04 8:12
memberbhaskar_gupta30-Jul-04 8:12 
GeneralRe: Need some help about Stepper motor Pin
prashant patke10-Feb-05 19:57
memberprashant patke10-Feb-05 19:57 
GeneralControlling a Stepper Motor through a Parallel Port Pin
Anonymous29-Jul-04 16:48
sussAnonymous29-Jul-04 16:48 
GeneralRe: Controlling a Stepper Motor through a Parallel Port Pin
bhaskar_gupta29-Jul-04 23:30
memberbhaskar_gupta29-Jul-04 23:30 
GeneralRe: Controlling a Stepper Motor through a Parallel Port Pin
Anonymous1-Aug-04 16:11
sussAnonymous1-Aug-04 16:11 
GeneralRe: Controlling a Stepper Motor through a Parallel Port Pin
bhaskar_gupta2-Aug-04 9:06
memberbhaskar_gupta2-Aug-04 9:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171207.1 | Last Updated 17 Jul 2004
Article Copyright 2004 by bhaskar_gupta
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid