Go Down

Topic: UL2003 / Mini Servo combo (Read 5070 times) previous topic - next topic

focalist

Jul 12, 2011, 07:49 pm Last Edit: Jul 12, 2011, 07:53 pm by focalist Reason: 1
There's a few vendors out there selling a module which uses a ULN2003 darlington array to drive a small geared stepper motor.  You can find these on eBay and many robotics stores.  It appears that directly using the module/motor with the arduino stepper libs is problematic, there's a phase issue due to the winding sequence not corresponding to the actual motor windings.  These are awesome little motors, and I'm using them coupled with a raw ULN2003, but I found that the module "mated" to the motors is not compatible with Arduino stepper libs because of sequencing.

Reference the motor pinout, you'll see that the winding pairs are blue/yellow and orange/pink (in that order, with the red being common).  The ULN2003 module is set up incorrectly in that case, and the motor will only rotate in one direction and at reduced speed because the windings are 90 degrees (?) out of phase.  The board is set up as: blue,pink,yellow,orange,red.. but to work, it needs to be blue, yellow,orange, pink, red to be operating in phase if using the arduino libs.

A custom lib or modified hookup is required to correct the tming sequence, at least as far as I have found.  Has anyone else run into this, or am I totally crazy?

Spec sheet for the motor:

http://arduino-direct.com/sunshop/index.php?l=product_detail&p=120  

It doesn't harm anything, but it doesn't work properly either.  The page link above is from Terry's web store, but it's the same module and motor sold by a number of vendors.
When the testing is complete there will be... cake.

mem

I have used a similar motor with the Arduino stepper library.  It may be that the diagram is wrong, try swapping the motor wires to see if you can find the correct sequence. If you have a meter than can measure the resistance that will help you figure out which windings are which.

Erni

#2
Jul 12, 2011, 10:47 pm Last Edit: Jul 12, 2011, 11:03 pm by Erni Reason: 1
I have two of thesse small steppers, and I am using this sketch, to make the steps correct.

It is not according to the manual, it should be A-AB-B-BC-C-CD-D-DA-A

I have omitted the double steps eg. AB-BC- and so on, as I couldn't see any differens.

With this sketch it runs very smoothly at about 10 RPM. If the delaytime get less than 4, it will not run, so i guess this is the max RPM with 2 cells LIPO (7,4V)
By the way the torque is exllent, can't stop it with my fingers

Ernst




Quote

int motorPin1 = 8;
int motorPin2 = 9;
int motorPin3 = 10;
int motorPin4 = 11;
int delayTime = 4;

void setup() {
 pinMode(motorPin1, OUTPUT);
 pinMode(motorPin2, OUTPUT);
 pinMode(motorPin3, OUTPUT);
 pinMode(motorPin4, OUTPUT);
}

void loop() {
 digitalWrite(motorPin1, HIGH);
 digitalWrite(motorPin2, LOW);
 digitalWrite(motorPin3, LOW);
 digitalWrite(motorPin4, LOW);
 delay(delayTime);
 digitalWrite(motorPin1, LOW);
 digitalWrite(motorPin2, HIGH);
 digitalWrite(motorPin3, LOW);
 digitalWrite(motorPin4, LOW);
 delay(delayTime);
 digitalWrite(motorPin1, LOW);
 digitalWrite(motorPin2, LOW);
 digitalWrite(motorPin3, HIGH);
 digitalWrite(motorPin4, LOW);
 delay(delayTime);
 digitalWrite(motorPin1, LOW);
 digitalWrite(motorPin2, LOW);
 digitalWrite(motorPin3, LOW);
 digitalWrite(motorPin4, HIGH);
 delay(delayTime);
}


focalist

Actually, Terry had it figured out and had sample code.. and we're complete goofs.

I did it by swapping wires, you did it in code by doing your own port manipulation.

However, the right way to do it is...

Change the pin sequence in the declaration.. stepper(1,3,2,4) instead of stepper(1,2,3,4)

LOL.... and D'oh!
When the testing is complete there will be... cake.

mem

Good to hear you have it going.

Swapping pins in the declaration does work if you have correctly identified and wired the connection to the center taps of the windings.
Sounds like that was not a problem in your case.

Have fun!

focalist

Well, I had it figured out, was more posting it so when others run into the issue, their searches will bring up the thread.  Hopefully it can help avoid a bunch of "It isn't working!" posts...
When the testing is complete there will be... cake.

Go Up