Click here to Skip to main content
11,414,234 members (74,296 online)
Click here to Skip to main content

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

program

Introduction

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).

Background

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

License

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

Share

About the Author

bhaskar_gupta
Researcher
India India
http://profile.iiita.ac.in/bgupta_b03

http://www.flickr.com/photos/bhaskar4006/

http://quiescency.blogspot.com/

Comments and Discussions

 
QuestionParallel Port Problem Need Urgent Help Pin
Saddam Khan, 20-Sep-11 18:30
memberSaddam Khan20-Sep-11 18:30 
Questionconvert parallel cable to usb for stepper motor control Pin
TizyTwo, 15-Jul-11 17:06
memberTizyTwo15-Jul-11 17:06 
NewsStepper Motors Pin
Johnstepper, 31-Mar-11 7:37
memberJohnstepper31-Mar-11 7:37 
Generalpls send me code in c or assemply and tell me how we can use this Pin
m_ejaz, 8-Oct-10 21:09
memberm_ejaz8-Oct-10 21:09 
Generalrequest for guidance Pin
gloriaR, 1-Oct-10 10:08
membergloriaR1-Oct-10 10:08 
GeneralStepper motor Pin
Danish.ssuet, 8-Apr-10 9:40
memberDanish.ssuet8-Apr-10 9:40 
GeneralRe: Stepper motor Pin
syed hussain nasir rizvi, 26-Jun-10 11:37
membersyed hussain nasir rizvi26-Jun-10 11:37 
Generalconveyer system Pin
karimah, 24-Dec-09 16:33
groupkarimah24-Dec-09 16:33 
GeneralStepper Motor control with USB Pin
rajaofap, 11-Dec-09 21:35
memberrajaofap11-Dec-09 21:35 
Generalproject Pin
prabodh kumar, 6-Nov-09 18:00
memberprabodh kumar6-Nov-09 18:00 
GeneralClueless about the stepper motor thing Pin
vince creed, 10-Jul-09 18:10
membervince creed10-Jul-09 18:10 
Questionproblem regarding number of loops Pin
rocketbar, 9-Jun-09 19:08
memberrocketbar9-Jun-09 19:08 
AnswerRe: problem regarding number of loops Pin
Member 591859, 7-Jul-09 16:43
memberMember 5918597-Jul-09 16:43 
Generalproblem with stepper motor rotation Pin
vaibs4u, 28-Apr-09 5:14
membervaibs4u28-Apr-09 5:14 
AnswerRe: problem with stepper motor rotation Pin
Crioa, 19-May-09 11:29
memberCrioa19-May-09 11:29 
Generalstepper motor control using 8051 microcontroller Pin
mohamed laving, 15-Apr-09 11:39
membermohamed laving15-Apr-09 11:39 
GeneralMultiple High torque stepper motor controller! Pin
Elshine, 18-Mar-09 3:02
memberElshine18-Mar-09 3:02 
AnswerRe: Multiple High torque stepper motor controller! Pin
Member 591859, 7-Jul-09 16:50
memberMember 5918597-Jul-09 16:50 
Generalsteper motor design Pin
orked mohamed, 29-Jan-09 11:29
memberorked mohamed29-Jan-09 11:29 
Generalsequences to the parallel port Pin
razan oglah, 26-Dec-08 2:28
memberrazan oglah26-Dec-08 2:28 
GeneralRotate Stepper motor Pin
manjusl, 18-Dec-08 7:56
membermanjusl18-Dec-08 7:56 
Generalurgent need Pin
nikhil jais, 3-Dec-08 9:58
membernikhil jais3-Dec-08 9:58 
GeneralVista Pin
bossier17, 3-Oct-08 8:15
memberbossier173-Oct-08 8:15 
GeneralHigh Ampere rating Pin
pratik2222, 26-May-08 21:47
memberpratik222226-May-08 21:47 
how to control stepper motors of high ampere rating (i have 2.7 Amp,1.8 deg, 6 wire) ? plz help.
GeneralCODE Pin
ALAN CARDOSO, 2-May-08 8:15
memberALAN CARDOSO2-May-08 8:15 
GeneralHi !!!! Pin
Eleazar, 16-Jan-08 19:04
memberEleazar16-Jan-08 19:04 
Generalstepper control operation Pin
francis haba, 27-Dec-07 11:17
sussfrancis haba27-Dec-07 11:17 
General[Message Removed] Pin
immetoz, 4-Oct-08 16:09
memberimmetoz4-Oct-08 16:09 
Generalmultiple stepper motor control Pin
cokyblaster, 2-Nov-07 16:37
membercokyblaster2-Nov-07 16:37 
Generalstepper motor Pin
bottgadget, 28-Sep-07 20:15
memberbottgadget28-Sep-07 20:15 
General4 wire stepper motor Pin
paulravi, 6-Sep-07 7:48
memberpaulravi6-Sep-07 7:48 
GeneralRe: 4 wire stepper motor Pin
mitchandre, 7-Sep-07 7:29
membermitchandre7-Sep-07 7:29 
GeneralUSB 2 LPT Pin
zafor, 1-Aug-07 4:35
memberzafor1-Aug-07 4:35 
QuestionInterface Card Pin
Member #3931521, 20-Mar-07 17:41
memberMember #393152120-Mar-07 17:41 
AnswerRe: Interface Card Pin
chaz_s, 11-Apr-07 3:51
memberchaz_s11-Apr-07 3:51 
QuestionFrom where the motor and the board ? Pin
abu_sager, 1-Dec-06 6:27
memberabu_sager1-Dec-06 6:27 
Questionstepper motor control by parallel port Pin
fuad2006, 19-Sep-06 4:52
memberfuad200619-Sep-06 4:52 
QuestionRe: stepper motor control by parallel port Pin
springupman, 21-Sep-06 18:46
memberspringupman21-Sep-06 18:46 
QuestionFacing problem in parallel port programing in windows XP Pin
anubhav aggarwal, 2-Sep-06 5:39
memberanubhav aggarwal2-Sep-06 5:39 
AnswerRe: Facing problem in parallel port programing in windows XP Pin
bhaskar_gupta, 2-Sep-06 10:09
memberbhaskar_gupta2-Sep-06 10:09 
GeneralStepper motor control Pin
demisphinx, 25-Aug-06 9:56
memberdemisphinx25-Aug-06 9:56 
QuestionPort control question. Pin
Dan Boyt, 24-Aug-06 16:47
memberDan Boyt24-Aug-06 16:47 
AnswerRe: Port control question. Pin
bhaskar_gupta, 25-Aug-06 0:33
memberbhaskar_gupta25-Aug-06 0:33 
QuestionRe: Port control question. Pin
shanyx, 3-May-08 10:06
membershanyx3-May-08 10:06 
Generalstepper motor Pin
sssaaaadddd, 30-Jul-06 5:40
membersssaaaadddd30-Jul-06 5:40 
GeneralStepper Motor Circuit Pin
sephirothzero85, 25-Mar-06 21:02
membersephirothzero8525-Mar-06 21:02 
Generalautomated car Pin
iyesh, 20-Mar-06 3:47
memberiyesh20-Mar-06 3:47 
QuestionTwo Steppers at Once? Pin
Rigidkitchen, 7-Nov-05 7:06
memberRigidkitchen7-Nov-05 7:06 
Generalserial port Pin
JohanBrother, 26-Oct-05 11:34
memberJohanBrother26-Oct-05 11:34 
Generalbipolar 4 wire Pin
Tomuk5, 13-May-05 5:27
memberTomuk513-May-05 5:27 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150427.2 | Last Updated 17 Jul 2004
Article Copyright 2004 by bhaskar_gupta
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid