Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

stepper motor wires

Status
Not open for further replies.
Hi ,

MY uln2803 was faulty , so tried to to run the motor directly with only diodes in series just to safe the microcontroller output pins .
but still it doesnt move , maybe i am not connecting it correctly.
Is there a manual procedure to find out which one is A1, A3 and the rest ????
 
Are you sure the uln2803 was faulty? Thats very rare. And I don't think your microcontroller can source that much current without an amplifier, also, diodes will only protect it from back current.

**broken link removed**, the 2803 and the 2003 are basically the same in how you'll connect them, just use your microcontroller pins instead of the paralell connector pins.
 
Last edited:
hi
according to your link , the ckt is sourceing out voltage in the range of 12-24v .
i tried it with 9v , and it didnt output the 9v dc.
well is 12v the minimum uln2803 works with ?
 
First test the rotation of your motor without any logic. The middle wire is the common. Use a battery, 9 volts is Ok, and plug this wire to one side of the battery. Label the 4 other wires as 1,2,3,4 from left to right or right to left. The sequence of this particular motor is 1,2,3,4, that is touch the other side of the battery to wire 1 then 2 then 3 and 4 or 4,3,2,1 and the motor will rotate. Put a piece of scotch tape on the axle to help see the rotation. Confirm this behavior and set your logic accordingly.

If you use a ULN2803. Parallel 2 inputs and 2 outputs for each wire as power stage for your logic. Do not use the freewheel diodes.

These motors are rated at 24 volts but even at 12 volts they will get very hot if left ideling with 2 phases energised (Full step mode). The chip will smoke pretty soon too if not properly cooled. You can run them at 9 volts and even at 5 volts they will work.

Not much to do with these motors unless you use a sophisticated driver, but fun to play with.

Edit:
I read a resistance of 13.4 Ohms per phase on my motor. It is already near 0.9A at 12 volts for one single phase. This is a lot to ask to a ULN2803 even paralleled. Prepare a fan! If possible, manage a way to put all the inputs of the chip low when the motor is not running.
 
Last edited:
ok , my uln2803 was broke so i had 2n2222 switch 12v on a input from microcontroller into its base and a 1kohm R in series on its emitter.
well its truns out it dosent output 12V but 8V and that is across 1Kohm R , so i replaced it wit 1.2Mohm .
Still it didnt give me full 12V , any how i connected the stepr mtr .
And with trials and error i did get it moving in CW and CCW.
but i physically checked the motor isnt giving me the torque i wanted ,
so i still have to derive it with uln2803 .
 
The book 'easy steppin' by square one is a great book for learning, years ago I made their stepper identifier circuit and it is perfect for checking which wires are correct for the step sequence. Basically its just 4 switch's a few diodes, a power supply and a 8 post screw terminal. If your just starting out with steppers this book is great although it is old and is based on the '84 chip.

I'm sure once you have a read you'll never look back

Cheers Bryan
 
OK , now i have the uln2803 working and conncted .
The stpr motr works but , when it is in stationary position it doesnt the torque ( i.e the holding torque )
here's my code :

char menu(void);
void drv_cw(void);
void drv_ccw(void);
void main()
{

while(1)
{


switch (menu()) {

case '1': {
drv_cw();
break;
}


case '2': {
drv_ccw();
break;
}



default: {
output_bit(PIN_A0,1);
output_bit(PIN_A1,0);
output_bit(PIN_A2,1);
output_bit(PIN_A3,0);

break;
}

}

}
}

///////User Selection Menu//////////////////////////////
char menu(void)
{
char ch;
output_bit(PIN_A0,1);
output_bit(PIN_A1,1);
output_bit(PIN_A2,1);
output_bit(PIN_A3,1);
/////////////////////////
/*output_bit(PIN_A0,0);
output_bit(PIN_A1,0);
output_bit(PIN_A2,0);
output_bit(PIN_A3,0);*/
printf ("\n\r <<<<<< Driving Stepper Motor >>>>>>>");
printf ("\n\r Press 1 to turn Clock Wise .......");
printf ("\n\r Press 2 to turn Counter Clock Wise .......");
ch = getc(); //wait for and get serial character
return ch;
}
/////////////////////////////////////////////////////////
void drv_cw(void)
{ // 1st Cycle
// Step1
output_bit(PIN_A0,1); // A1
output_bit(PIN_A1,0); // A3
output_bit(PIN_A2,0); // B1
output_bit(PIN_A3,1); // B3
delay_ms(1000);
//////////////////////////////
// Step2
output_bit(PIN_A0,1);
output_bit(PIN_A1,0);
output_bit(PIN_A2,1);
output_bit(PIN_A3,0);
delay_ms(1000);
//////////////////////////////
// Step3
output_bit(PIN_A0,0);
output_bit(PIN_A1,1);
output_bit(PIN_A2,1);
output_bit(PIN_A3,0);
delay_ms(1000);
//////////////////////////////
// Step4
output_bit(PIN_A0,0);
output_bit(PIN_A1,1);
output_bit(PIN_A2,0);
output_bit(PIN_A3,1);
delay_ms(1000);
//////////////////////////////
// 2nd Cycle/////////////////
// Step1
output_bit(PIN_A0,1); // A1
output_bit(PIN_A1,0); // A3
output_bit(PIN_A2,0); // B1
output_bit(PIN_A3,1); // B3
delay_ms(1000);
//////////////////////////////
// Step2
output_bit(PIN_A0,1);
output_bit(PIN_A1,0);
output_bit(PIN_A2,1);
output_bit(PIN_A3,0);
delay_ms(1000);
//////////////////////////////
// Step3
output_bit(PIN_A0,0);
output_bit(PIN_A1,1);
output_bit(PIN_A2,1);
output_bit(PIN_A3,0);
delay_ms(1000);
//////////////////////////////
// Step4
output_bit(PIN_A0,0);
output_bit(PIN_A1,1);
output_bit(PIN_A2,0);
output_bit(PIN_A3,1);
delay_ms(1000);
//////////////////////////////

return ;
}
/////////////////////////////////////////////////////////
void drv_ccw(void)
{ // 1st Cycle CCW //
output_bit(PIN_A0,0);
output_bit(PIN_A1,1);
output_bit(PIN_A2,0);
output_bit(PIN_A3,1);
delay_ms(1000);
//////////////////////////////
output_bit(PIN_A0,0);
output_bit(PIN_A1,1);
output_bit(PIN_A2,1);
output_bit(PIN_A3,0);
delay_ms(1000);
//////////////////////////////
output_bit(PIN_A0,1);
output_bit(PIN_A1,0);
output_bit(PIN_A2,1);
output_bit(PIN_A3,0);
delay_ms(1000);
//////////////////////////////
output_bit(PIN_A0,1); // A1
output_bit(PIN_A1,0); // A3
output_bit(PIN_A2,0); // B1
output_bit(PIN_A3,1); // B3
delay_ms(1000);
//////////////////////////////
// 2nd Cycle CCW //
output_bit(PIN_A0,0);
output_bit(PIN_A1,1);
output_bit(PIN_A2,0);
output_bit(PIN_A3,1);
delay_ms(1000);
//////////////////////////////
output_bit(PIN_A0,0);
output_bit(PIN_A1,1);
output_bit(PIN_A2,1);
output_bit(PIN_A3,0);
delay_ms(1000);
//////////////////////////////
output_bit(PIN_A0,1);
output_bit(PIN_A1,0);
output_bit(PIN_A2,1);
output_bit(PIN_A3,0);
delay_ms(1000);
//////////////////////////////
output_bit(PIN_A0,1); // A1
output_bit(PIN_A1,0); // A3
output_bit(PIN_A2,0); // B1
output_bit(PIN_A3,1); // B3
delay_ms(1000);
//////////////////////////////
return ;
}
/////////////////////////////////////////////////////////
 
I have tried changing this piece of code :

/*output_bit(PIN_A0,0);
output_bit(PIN_A1,0);
output_bit(PIN_A2,0);
output_bit(PIN_A3,0);*/
printf ("\n\r <<<<<< Driving Stepper Motor >>>>>>>");
printf ("\n\r Press 1 to turn Clock Wise .......");
printf ("\n\r Press 2 to turn Counter Clock Wise .......");
ch = getc(); //wait for and get serial character
return ch;
}


to

output_bit(PIN_A0,1);
output_bit(PIN_A1,0);
output_bit(PIN_A2,1);
output_bit(PIN_A3,0);
printf ("\n\r <<<<<< Driving Stepper Motor >>>>>>>");
printf ("\n\r Press 1 to turn Clock Wise .......");
printf ("\n\r Press 2 to turn Counter Clock Wise .......");
ch = getc(); //wait for and get serial character
return ch;
}

it does give me holding torque , but then it takes a huge step back both in cw and ccw .
Also how to make it rotate full 360 deg in one direction ???
 
I don't know about your programming but since this is an unipolar motor the apropriate sequence to energize the coils is like this:

1000
0100
0010
0001

energized in the sequence I was pointing out in my previous post. This is called "wave driven". The motor will rotate but the torque will be low. For a better torque, the motor should be run in the full step mode, that is 2 coils always energized at the same time like this:

1100
0110
0011
1001

This will gives the best torque. A stepper motor can also be driven half step or with microsteps.

Using LEDs instead of the motor would help tuning up the logic.

**broken link removed**

In my humble opinion the ULN2803 is not really the best choice for this project. It will overheat pretty fast while ideling, I mean when the motor is stopped with one or worst 2 phases on. As far as I know, there is no overheat protection on this chip.

The TIP120 darlington transistor for one would be more adequate.
 
Last edited:
Hi , Thanks for the schematic and the giving me the sequence of bits to energize the coils .
What i really wanted was when it has done its Clock Wise or CCW rotation and it is waiting for the next sequence od bits to make it rotate , i want it to be energized for a stationary position . With my code , i have noticed during rotation it does have a lot of Torque with only 12V Dc , but after one cycle in a stationary position it is not energized .

e.g

char menu(void)
{
char ch;
output_bit(PIN_A0,1); // this is predefined bit setting
output_bit(PIN_A1,0); // after selection has been made it is called it comes here and rotate it in the reverse direction
output_bit(PIN_A2,1); // rather than just stop there and have a strong holding Torque ???
output_bit(PIN_A3,0);
/////////////////////////
/*output_bit(PIN_A0,0);
output_bit(PIN_A1,0);
output_bit(PIN_A2,0);
output_bit(PIN_A3,0);*/
printf ("\n\r <<<<<< Driving Stepper Motor >>>>>>>");
printf ("\n\r Press 1 to turn Clock Wise .......");
printf ("\n\r Press 2 to turn Counter Clock Wise .......");
ch = getc(); //wait for and get serial character
return ch;
}
 
This code stuff is why, unless it's absolutely a requirement, a regular stepper driver is a better way to use a stepper motor.
You only need one chip with a couple of inputs, which can come from your PC or micro controller or even toggle switches and your good to go!
 
Pls help... I have the same problem...

I AM USING 6PINS PM55L 048....CANNOT DETERMINE WHICH WIRE SHOULD BE CONNECTED TO MY DRIVER IC ULN2803... i cant determine which wire is to be connected to 05 06 07 08..all i know is black and orange which is the center are the common.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top