5,317,598 members and growing! (24,626 online)
Email Password   helpLost your password?
Languages » VBScript » VBA     Intermediate

Stepper Motor Control through Parallel Port

By bhaskar_gupta

Motion control of the most widely used Stepper Motor through PC's Parallel Port.
C, VB, VBScript, VC6, C++, .NET, Windows, NT4, Win2K, WinXPVS6, Visual Studio, Dev

Posted: 1 Jul 2004
Updated: 16 Jul 2004
Views: 252,041
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
63 votes for this Article.
Popularity: 7.00 Rating: 3.89 out of 5
6 votes, 9.5%
1
0 votes, 0.0%
2
8 votes, 12.7%
3
12 votes, 19.0%
4
37 votes, 58.7%
5

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

About the Author

bhaskar_gupta


http://profile.iiita.ac.in/bgupta_b03

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

http://quiescency.blogspot.com/
Occupation: Researcher
Location: India India

Other popular VBScript articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 73 (Total in Forum: 73) (Refresh)FirstPrevNext
Subject  Author Date 
GeneralHigh Ampere ratingmemberpratik222221:47 26 May '08  
GeneralCODEmemberALAN CARDOSO8:15 2 May '08  
GeneralHi !!!!memberEleazar19:04 16 Jan '08  
Generalstepper control operationsussfrancis haba11:17 27 Dec '07  
Generalmultiple stepper motor controlmembercokyblaster16:37 2 Nov '07  
Generalstepper motormemberbottgadget20:15 28 Sep '07  
General4 wire stepper motormemberpaulravi7:48 6 Sep '07  
GeneralRe: 4 wire stepper motormembermitchandre7:29 7 Sep '07  
GeneralUSB 2 LPTmemberzafor4:35 1 Aug '07  
QuestionInterface Cardmember17:41 20 Mar '07  
AnswerRe: Interface Cardmemberchaz_s3:51 11 Apr '07  
GeneralFrom where the motor and the board ?memberabu_sager6:27 1 Dec '06  
Questionstepper motor control by parallel portmemberfuad20064:52 19 Sep '06  
QuestionRe: stepper motor control by parallel portmemberspringupman18:46 21 Sep '06  
QuestionFacing problem in parallel port programing in windows XPmemberanubhav aggarwal5:39 2 Sep '06  
AnswerRe: Facing problem in parallel port programing in windows XPmemberbhaskar_gupta10:09 2 Sep '06  
GeneralStepper motor controlmemberdemisphinx9:56 25 Aug '06  
QuestionPort control question.memberDan Boyt16:47 24 Aug '06  
AnswerRe: Port control question.memberbhaskar_gupta0:33 25 Aug '06  
QuestionRe: Port control question.membershanyx10:06 3 May '08  
Generalstepper motormembersssaaaadddd5:40 30 Jul '06  
GeneralStepper Motor Circuitmembersephirothzero8521:02 25 Mar '06  
Generalautomated carmemberiyesh3:47 20 Mar '06  
GeneralTwo Steppers at Once?memberRigidkitchen7:06 7 Nov '05  
Generalserial portmemberJohanBrother11:34 26 Oct '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 16 Jul 2004
Editor: Nishant Sivakumar
Copyright 2004 by bhaskar_gupta
Everything else Copyright © CodeProject, 1999-2008
Web11 | Advertise on the Code Project