Unipolar stepper motor turning problem

Hi,

I succesfully used a unipolar motor to Arduino via a ULN2003 ic.
The problem now is when I use the same schema and a different unipolar motor, only the inside of the motor seems to do something. The output shaft does not move at all.

  • I checked for the right current and voltage already.
  • I measured the resistance of the coils, they are fine too.
  • I tried switching wires to the motor without results.
  • I tried to lower en higher the speed, this only makes the inside shake more.

Is there anything else I can check for or do? I really find it strange that the inside seems to shake or turn without noticing something on the outside…

Thanks.

it sounds like a step pin is not being held long enough and does not have enough time to complete the step. So the motor begin to move but then returns to its inital state.

Thanks for you fast reply.

In response to your answer I increased the delaytime between steps a few times, but this does not seem to work. Is this the right way to give enough time to the steps?

Could it be that this has something to do with the IC (ULN2003) being to fast or something?

Just in case it might help, this is the motor I use: http://www.velleman.eu/distributor/products/view/?id=75006

Could you post your code so we can see if there is a problem with that?

Also, your link brings me to the front page of the web site and not to the actual product page. What are we supposed to look at on that site? :-?

To make it easy I used the code from the arduino site:

/* Stepper Copal * ------------- * * Program to drive a stepper motor coming from a 5'25 disk drive * according to the documentation I found, this stepper: "[...] motor * made by Copal Electronics, with 1.8 degrees per step and 96 ohms * per winding, with center taps brought out to separate leads [...]" * [http://www.cs.uiowa.edu/~jones/step/example.html] * * It is a unipolar stepper motor with 5 wires: * * - red: power connector, I have it at 5V and works fine * - orange and black: coil 1 * - brown and yellow: coil 2 * * (cleft) 2005 DojoDave for K3 * http://www.0j0.org | http://arduino.berlios.de * * @author: David Cuartielles * @date: 20 Oct. 2005 */

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

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); }

Here is the schema I used. I already tried changing the wires to the motor (except for supply wires)

The site I mentioned earlier was about the specs of the motor: - resistance: 170 ohms - rated voltage: 12Vdc - current: 60mA - impedance: 200ohm - phase: 4 - step angle / step: 7.5° / 48 - reduction ratio: 1/85 - detent torque: 500gfcm - pull-in torque: 650gfcm - max. starting pulse rate: 350pps - max. slewing pulse rate: 800pps - temperature range: 45°C - noise: 40dB - cable: 450mm AWG 1007#26 - terminal: JST SXH-001T-P0.6 - insulation strength: AC 600V - 1 sec cut-off current: 10mA

I hope this makes it clear? Oh yeah, I red something about a geared motor, can this be a problem in my case?

Thx.

Does it seem like it just jiggles back and forth? Not all motors are wired exactly the same.

I had the same problem the other day. Another way to check the sequence of the motor is just to hook the +12v to your 2 center wires and then run your ground wire across the other 4 wires to see how the motor reacts. you should see it micro-step in one direction if you are hitting them right. If it doesn't only go in one direction, swap 2 wires at a time till you get it going right.

Hope this helps.

I think the inside is jiggling back and forth, but on the outside nothing is moving.. You can however feel something moving (or at least trying to) on the inside. I tried the method of connecting it directly to the supply like you said, but nothing moved on the outside (and i don't think so on the inside either).

I already returned this motor because I thought it was broken. I got this new one, but the problem still occurs so I must be doing something wrong. I just don't have enough knowledge about this to figure it out.

I noticed that when I measure the resitance on each pair of wires, I can only get a good measurement for not even a half second. After that the resistance just shows zero as if I'm not measuring anything anymore. It does this on all (connected) pairs of wires.

On my other stepper I can measure as long as I want so maybe this is causing the problem?

You need to connect Arduinos ground to the ground on the ULN2003.

I don't know if this is the problem, but they should be connected.

MikMo beat me to it. Connect the ground from the Arduino to the ground of the +12V.

Good luck!

Thanks, I will remember that for next time, but it didn't solve the problem I am facing now.

Like I said, I already tried moving the motor by connecting it directly to the supply without the Arduino. This didn't work either. Maybe I'm using the wrong supply or something?

The supply:

  • 9Vdc (but gives a measurement of about 12v when connected with the load)
  • 300mA
  • 2.7VA

The motor: - 12Vdc - 60mA

Ps: The outside shaft is really hard to move by hand, some people told me this is normal but I have my doubts?

Is it the geared motor they had on the web site? Maybe something wrong with the gears? Can they be taken off to check if motor itself works?

Yes I do think it is a geared motor (MOTS2 on the website). Is this anything different from a not geared motor to connect or program?

I don't think there is something wrong with the gears. I already sent a previous motor back to the company because I thought it was just broken. They said the gave me a new one so..

Did you try with a shorter delaytime ?

Right now your loop will take 2 seconds to execute and with a reduction ratio of 85 your motor would be turning VERY VERY slowly.

Hi Niels,

In the Velleman website, they didn’t mention clearly if there’s any center tab wires. What is reading between A1 and A2 wires?

Do you get only half of the value when measuring between the GND wire and A1 or A2?

Joseph

I tried a shorter delaytime (20ms). I do feel the motor going (or trying to go) faster on the inside, but still nothing happens on the outside.

The measurement are ok I think: - A1 - A2: 408ohm - B1 - B2: 408ohm - A1 - GND: 205ohm - GND - A2: 205ohm - B1 - GND: 205ohm - GND - B2: 205ohm

Try this code. It should try all possible wire combinations to see if any of them work. You can watch the serial monitor to see which combo it’s trying. When it hits the right one, the stepper should turn about 1/2 a complete revolution, assuming 48 steps/rev and gearing 85:1. It doesn’t know when it gets it right, so you have to watch it.

Alas, code is untested since I don’t have the circuit in front of me.

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

void setup() {
 pinMode(motorPin1, OUTPUT);
 pinMode(motorPin2, OUTPUT);
 pinMode(motorPin3, OUTPUT);
 pinMode(motorPin4, OUTPUT);
 serial.begin(9600);            //setup communication with computer
}

void loop() {
  // Try all possible combinations of wires
  motorPin1 =  8; motorPin2 =  9; motorPin3 = 10; motorPin4 = 11; rotate();
  motorPin1 =  8; motorPin2 =  9; motorPin3 = 11; motorPin4 = 10; rotate();
  motorPin1 =  8; motorPin2 = 10; motorPin3 =  9; motorPin4 = 11; rotate();
  motorPin1 =  8; motorPin2 = 10; motorPin3 = 11; motorPin4 =  9; rotate();
  motorPin1 =  8; motorPin2 = 11; motorPin3 =  9; motorPin4 = 10; rotate();
  motorPin1 =  8; motorPin2 = 11; motorPin3 = 10; motorPin4 =  9; rotate();
  motorPin1 =  9; motorPin2 =  8; motorPin3 = 10; motorPin4 = 11; rotate();
  motorPin1 =  9; motorPin2 =  8; motorPin3 = 11; motorPin4 = 10; rotate();
  motorPin1 =  9; motorPin2 = 10; motorPin3 =  8; motorPin4 = 11; rotate();
  motorPin1 =  9; motorPin2 = 10; motorPin3 = 11; motorPin4 =  8; rotate();
  motorPin1 =  9; motorPin2 = 11; motorPin3 =  8; motorPin4 = 10; rotate();
  motorPin1 =  9; motorPin2 = 11; motorPin3 = 10; motorPin4 =  8; rotate();
  motorPin1 = 10; motorPin2 =  8; motorPin3 =  9; motorPin4 = 11; rotate();
  motorPin1 = 10; motorPin2 =  8; motorPin3 = 11; motorPin4 =  9; rotate();
  motorPin1 = 10; motorPin2 =  9; motorPin3 =  8; motorPin4 = 11; rotate();
  motorPin1 = 10; motorPin2 =  9; motorPin3 = 11; motorPin4 =  8; rotate();
  motorPin1 = 10; motorPin2 = 11; motorPin3 =  8; motorPin4 =  9; rotate();
  motorPin1 = 10; motorPin2 = 11; motorPin3 =  9; motorPin4 =  8; rotate();
  motorPin1 = 11; motorPin2 =  8; motorPin3 =  9; motorPin4 = 10; rotate();
  motorPin1 = 11; motorPin2 =  8; motorPin3 = 10; motorPin4 =  9; rotate();
  motorPin1 = 11; motorPin2 =  9; motorPin3 =  8; motorPin4 = 10; rotate();
  motorPin1 = 11; motorPin2 =  9; motorPin3 = 10; motorPin4 =  8; rotate();
  motorPin1 = 11; motorPin2 = 10; motorPin3 =  8; motorPin4 =  9; rotate();
  motorPin1 = 11; motorPin2 = 10; motorPin3 =  9; motorPin4 =  8; rotate();

}

//
// Spin stepper enough to know if it's working
//
rotate()
{
  int i;
  
  serial.print("motorPins=");                   //look at screen when stepper works
  serial.print(motorPin1);serial.print(",");    //to see what order pins should be in
  serial.print(motorPin2);serial.print(",");
  serial.print(motorPin3);serial.print(",");
  serial.print(motorPin4);serial.println(",");
 
 for(i=1;1020;i++)                // if 96 steps/revolution, and gearing 85:1,
 {                                // then this should turn it about 1/2 a complete
                                  // revolution
   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);
 }
}

Edit: change comma to semicolon

for(i=1,1020,i++)

Shouldn’t this be:

for(i=1; i<=1020; i++)

Hello Niels,

When you are sure about the wirings of your stepper, and which ones are the center tap, the driving sequence below should work:

Winding 1a 1000100010001000100010001
Winding 1b 0010001000100010001000100
Winding 2a 0100010001000100010001000
Winding 2b 0001000100010001000100010
time —>

also, you can try out the stepper library from Arduino:

Cheers
Joseph

Thank you guys so much! It works. I tried the script kitep gave and it worked. Now I think the actual cause was like MikMo said, a too long delay time. In the script of Kitep there is a 10m delay which i thought was really too fast before I saw the script (I min. tried at 20ms). The motor probably moved but indeed REALLY REALLY slow (sry that I didn't notice it, I never thought it could be this slow).

Just a last quick question, is there a limit of delaytime to make sure I don't harm the motor or anything else?

For other people who might like to try kitep's script, here is the same version but with a capital S in serial and the revision by PaulS:

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

void setup() { pinMode(motorPin1, OUTPUT); pinMode(motorPin2, OUTPUT); pinMode(motorPin3, OUTPUT); pinMode(motorPin4, OUTPUT); Serial.begin(9600); //setup communication with computer }

void loop() { // Try all possible combinations of wires motorPin1 = 8; motorPin2 = 9; motorPin3 = 10; motorPin4 = 11; rotate(); motorPin1 = 8; motorPin2 = 9; motorPin3 = 11; motorPin4 = 10; rotate(); motorPin1 = 8; motorPin2 = 10; motorPin3 = 9; motorPin4 = 11; rotate(); motorPin1 = 8; motorPin2 = 10; motorPin3 = 11; motorPin4 = 9; rotate(); motorPin1 = 8; motorPin2 = 11; motorPin3 = 9; motorPin4 = 10; rotate(); motorPin1 = 8; motorPin2 = 11; motorPin3 = 10; motorPin4 = 9; rotate(); motorPin1 = 9; motorPin2 = 8; motorPin3 = 10; motorPin4 = 11; rotate(); motorPin1 = 9; motorPin2 = 8; motorPin3 = 11; motorPin4 = 10; rotate(); motorPin1 = 9; motorPin2 = 10; motorPin3 = 8; motorPin4 = 11; rotate(); motorPin1 = 9; motorPin2 = 10; motorPin3 = 11; motorPin4 = 8; rotate(); motorPin1 = 9; motorPin2 = 11; motorPin3 = 8; motorPin4 = 10; rotate(); motorPin1 = 9; motorPin2 = 11; motorPin3 = 10; motorPin4 = 8; rotate(); motorPin1 = 10; motorPin2 = 8; motorPin3 = 9; motorPin4 = 11; rotate(); motorPin1 = 10; motorPin2 = 8; motorPin3 = 11; motorPin4 = 9; rotate(); motorPin1 = 10; motorPin2 = 9; motorPin3 = 8; motorPin4 = 11; rotate(); motorPin1 = 10; motorPin2 = 9; motorPin3 = 11; motorPin4 = 8; rotate(); motorPin1 = 10; motorPin2 = 11; motorPin3 = 8; motorPin4 = 9; rotate(); motorPin1 = 10; motorPin2 = 11; motorPin3 = 9; motorPin4 = 8; rotate(); motorPin1 = 11; motorPin2 = 8; motorPin3 = 9; motorPin4 = 10; rotate(); motorPin1 = 11; motorPin2 = 8; motorPin3 = 10; motorPin4 = 9; rotate(); motorPin1 = 11; motorPin2 = 9; motorPin3 = 8; motorPin4 = 10; rotate(); motorPin1 = 11; motorPin2 = 9; motorPin3 = 10; motorPin4 = 8; rotate(); motorPin1 = 11; motorPin2 = 10; motorPin3 = 8; motorPin4 = 9; rotate(); motorPin1 = 11; motorPin2 = 10; motorPin3 = 9; motorPin4 = 8; rotate();

}

// // Spin stepper enough to know if it's working // void rotate() { int i;

Serial.print("motorPins="); //look at screen when stepper works Serial.print(motorPin1);Serial.print(","); //to see what order pins should be in Serial.print(motorPin2);Serial.print(","); Serial.print(motorPin3);Serial.print(","); Serial.print(motorPin4);Serial.println(",");

for(i=1;1020;i++) // if 96 steps/revolution, and gearing 85:1, { // then this should turn it about 1/2 a complete // revolution 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); } }