View Full Version : I'm a beginner, need help to control stepper

09-01-2009, 11:59 AM
I am new to this hobby, but I have working knowledge of c/c++, assembly etc.
I have an Atmel 89S52 microcontroller and a stepper motor (unipolar I think). I have downloaded some basic programs and tested them (I have a board which has everything connected like, led's buttons LCD etc. and a bus which is directly connected to the chip).
I tried connecting the motor directly but it did not work, which I think is due to the fact that the voltage is low. My stepper can run on 5V. I don't have a driver IC, or the one that converts a TTL 1 to 5V (I browsed the net first).

Can you please help me?
Thanks in advance

09-02-2009, 09:38 AM
Try driving motor through ULN2003 or ULN2803.

09-05-2009, 04:32 PM
Thanks for replying :D

I did not get the IC so I tried getting the TIP120/121/122 transistors. I din't get that either. :cry:

So I am trying to make an equivalent circuit 8O (given in its datasheet at:

I am making that now (ie. before I decided to check for any replies). :wink:

09-05-2009, 06:34 PM
I have a feeling you will end up wasting time. better buy the IC online !!!

Save your time and energy for rest of the project.

09-05-2009, 06:41 PM
I live in Delhi, where/how do I buy online? I read about Innovation Roboshop (I live very near to the address they specified, but no one picks up the phone, can you give any suggestions.

PS: I guess you are, right, the circuit isn't working (I used a breadboard, so it can be modified quickly)


09-05-2009, 06:57 PM
As a second thought, can I use relays, and if yes, how do I get them?


09-05-2009, 11:24 PM
If you are in delhi then its very hard NOT to get ULN2003 :-)

You will SURELY find it in shop number 614 or 629 at LRM (Lajpat Rai Market).
But these shops overcharge so try at other shops first.

Also look at the "Parts and Prices" thread in "Buy and Sell" sections for loads of information on what people have bought from where and at how much price.

09-06-2009, 12:40 PM
The problem with LRM is that it isa from my house, and i cannot make frequent trips there (as I am a school kid, and have to depend on my mother to go there, till the delhi metro opens in my area that is). :roll:

Do you have any idea of in what kind of shops these are available? Like I buy normal parts(transistors, diodes etc.) from an electronics repair shop.


09-06-2009, 12:53 PM
You either have to buy online or go to LRM.

Hmm i never thought how a kid would buy things ? No CC , NO BAnk Acc access ... CoD Maybe but no one offers it/

09-06-2009, 02:31 PM
Is it possible to interface it with an Op-Amp (741 I think). I mean can the uC atleast give enough power to power an opamp?

09-06-2009, 05:47 PM
uC can give enough power out I guess about 100mA. At the same time op-amps take a very little power I guess in microAmps.

But if are thinking of driving a stepper motor using opamps, then dont because opamps dont give out that much power. Even though they are named amplifiers, they cant drive even LEDs I guess.

You will still need to amplify the output after the opamp.

About buying stuff I can understand your problem. Being a kid is difficult :-(
Going to LRM is really pathetic. Hope metro whenever it comes to Noida will solve that issue.

Hey, probably your repair shopkeeper can get stuff for you ? But be sure to tell him your budget so he doesnt come back with stuff and says its for 100 bucks or so.

09-06-2009, 05:53 PM
I am having problems with that repair shopkeeper, since I don't give him much business(and profit), so he doesn't want to waste time on me when he can tend to ther customers, so I have to be careful of not demanding too much, so that he doesn't refuse to sell.
I'll see though :?

Thanks for the advice :)

09-06-2009, 07:23 PM
I am having problems with that repair shopkeeper, since I don't give him much business(and profit), so he doesn't want to waste time on me when he can tend to ther customers, so I have to be careful of not demanding too much, so that he doesn't refuse to sell.
I'll see though :?

Thanks for the advice :)

That used to happen to me. The shop keeper used to tend to the other heavy customers first and then me, though I was the first to arrive. But some will pay heed if you are keen and keep going there regularly.

Relays were a good idea in the way you were thinking. But since steppers need fast switching, you will not be able to do run the stepper efficiently. The ULN2803/2003 is a good choice.

09-06-2009, 07:36 PM
I'll try :)
I think I'll be going regularly to him now... :?
Else I guess I'll have to do with relays, and I won't be doing too much speed initially (ie. before I get to make another trip to LRM, where I can buy the).

As an after thought, how good is the stepper motor driver, and how available is it? :?:

09-07-2009, 01:12 AM
Hey take a look at this !!


09-10-2009, 05:51 PM
Thanks, will try it :)

09-12-2009, 04:58 AM
Hey Venkboy!!
Looks like you have a ready made Microcontroller Dev. Board, probably from the hi-tech workshop guys. A lot of people are profiting by dumping these ready Micro kits on school kids, in the name of Robotics. They should have told you all these things and you should ask them too. I can almost guess where that board ( & the stepper) came from.... or maybe someone gave them to you as a present??

1. Throw the stepper- it does'nt help anyone for anything anywhere. Open it up and see how its made. or use it as a 'generator'. and I don't believe it is a 5v stepper either. Have'nt seen them for a long time now. A lot of "Engineering" students have been duped by rip-off agents with old junk hard disk steppers as 5V steppers. If there are only a set of garbled numbers on that motor then it sure is NOT 5V. The Industry is going off steppers, so why should you bother about them?? You must run ahead of or at least with the times, not go back to junk and obsolete stuff.
I did. 10 yrs ago.

2. By now, you might have fried the Micro too, if you connected the stepper direct to it. You're lucky if you have'nt. Take a pic of the Microcontroller board and post it here so that we can tell you what all you can do with it and how.

3. Start on ordinary DC motors first. These are easily available everywhere. You can drive the DC motor through a transistor. Maybe you can make a H-bridge out of the TIPxxx pretty easily.

Post your address here- I will dump some 2003s and a couple of L293Ds through the post to you- FREE. .....provided you promise to throw the stepper :lol: :lol:

09-12-2009, 05:19 AM
I did. 10 yrs ago.

Although your gesture is good, I would have to disagree that he needs to throw away the steppers and stop working on them. Steppers are still very commonly used in high precision automation/robotics. It would be good if he gets to make it move and learn about it and gets some satisfaction. Agreed controlling DC motors are 10 time as easy. He will at least have a better understanding between DC and steppers.

On the subject that he may have destroyed the micro, he can always run a check by hooking some LEDs to the pins.

In any case, I liked the way he was thinking on how to control his steppers with his limited options - that's the way to go.

09-12-2009, 05:34 AM
:lol: I somehow knew you'd react Jerry , as soon as I saw you online!!

Whatever the Steppers role in the industry, it certainly doesnt have a place with a beginner. I've seen 100s of students struggling with steppers, for micromouse, and got fed up with the entire process. They have ducked out of Robotics in frustration.

One can have a better understanding between DC and Steppers if one knows the DC motor first. I have seen enough ( 2 pages) of posts and still nothing much has happened.

Please dont take the kid to high-tech Industrial Robotics just now. You cant run before you can stand. :lol:

09-12-2009, 05:39 AM
.... You cant run before you can stand.
Agreed, DCs are simpler to control.
Hope he gets to run his motors.

I'm kind of surprised you remembered my name. Nice to be back.

09-12-2009, 06:20 AM
Hey!!! Out of sight need not mean out of mind !! What makes you think i can forget you? ( could have goofed on the J for the G, though :oops: )
anyway, good to see you around, more so now.... Vikas sure needs all the help !!

.....and the kid- He has stuck around for 2pages & 15 posts ( Not the one-post-one-timer's) so guess he'll be fine!

I'm sure we can help him out if he sticks around a little more!

09-14-2009, 02:50 PM
I didn't burn the micro (The led's are still fine) , and is it possible to control a DC motor with just a transistor to amplify? Will surely try


09-14-2009, 02:59 PM
Nice to hear the Micro is OK.
Yes it is possible to drive a DC motor with a transistor, but it will only switch it ON or OFF.
You need a set of relays or 4 transistors ( in a H-Bridge connection) for forward & reverse.

Which transistors do you have??

09-14-2009, 08:51 PM
What's an H-Bridge connection exactly?

As for the transistors I have the BC547 (NPN silicon transistor), and a PNP transistors, I don't remember the number though.

And how do I go about connecting the motor? Let me guess:
1) The emitter will be grounded
2) Base will be connected to micro controller
3) Not sure about the collector though, do I connect one end of the motor to the power supply and the other to the collector, or should I use the normal amplifier layout, that connects the collector to one end of the motor and the power supply? (sorry if it is not clear but I can't think of a better way to express it with words)

I guess I should tell you my strengths and weaknesses:
1) I am quite comfortable with c++, and ok with asm
2) I am really terrible at soldering, though I have a breadboard, on which I can do the prototyping (makes things a LOT easier and faster)