Author Topic: Controlling 8.6Volt, 1Amp stepper motor.  (Read 5255 times)

0 Members and 1 Guest are viewing this topic.

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Controlling 8.6Volt, 1Amp stepper motor.
« on: January 01, 2009, 02:51:16 AM »
I wish you a happy new year.
I am trying to control a stepper motor accoriding to this tutorial.
http://electronics-diy.com/electronics/stepper_motors.php
Few days ago, I used a motor which draws 2A current and I failed to control the motor using darlington ULN2003 chips.
And, this time, I changed a motor which has a speficiation as below.

*Motor Specification
Voltage : 8.6V
Current : 1.0A/Phase
Resistance : 8.6ohm/Phase
Inductance : 18mH/Phase
Holding torque : 13.5kgf

It draws 1A at 8.6V but I failed again.
The motor only buzzes just like the situation with 2amp stepper.
Could please someone advise me what seems to be wrong?
Actually, I had difficulty figuring out the order of wires from new stepper motor because the color of the wires is different.
Could you check below links?
I just taken some pictures. The resolution is not so good because I took a picture with flash.
http://www.flickr.com/photos/23525729@N06/3153050213/
http://www.flickr.com/photos/23525729@N06/3153889026/
http://www.flickr.com/photos/23525729@N06/3153051475/
http://www.flickr.com/photos/23525729@N06/3153887080/
http://www.flickr.com/photos/23525729@N06/3153886648/
http://www.flickr.com/photos/23525729@N06/3153870934/sizes/o/
i am not sure where each pins should be fixed to ULN2003 pins because, the color of the wires are different from the drawing.
Please check this drawing.
http://www.flickr.com/photos/23525729@N06/3153889026/
It specifies the color of each wires, but the new motor I have has different wire colors.
There is black and blue but the rest of the 4 wires are totally different compare to the previous stepper motor I controlled successfully.
Please see below links.
This is a picture of previous stepper motor i controlled successfully.
http://www.flickr.com/photos/23525729@N06/3155532330/
And, this is the new one which I have a problem with.
http://www.flickr.com/photos/23525729@N06/3154695313/
So, as a matter of fact, i don't know how i should put those wires on ULN2003.
I tried to put all kinds of way by exchanging each wires but there are so many configuration possibilities... 
The seller of stepper motor is on a holiday throughout this week, so I can't call him for an answer either.
I tried to slow down the number of stepps per second by reducing the number of steps in the software and I successfully controlled it with my previous motor.
but, I feel nothing from the new one when i connect it to ULN2003.
Any word of advise would be highly appreciated.

P.S.
The drawing is as same as the previous motor.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #1 on: January 01, 2009, 01:50:19 PM »
Hi,

Your new motor links doesn't add up, the pic with the winding schematic shows colors: Black, yellow, green, red, white and blue, while the photo shows: Black, red white, yellow, blue and orange (or pink, hard to tell the last one).

The winding schematics White(S) and Yellow(S) should connect to +V, the Red(T) wire in the tutorial.
Black(S) to Black(T)
Green(S) to Brown(T)
Red(S) to Yellow(T)
Blue(S) to Orange(T)

You have to find out which color on your actual motor is which color in the schematic. If you've got an Ohm meter, it is fairly easy, since you just need to find which is the center tap (the one with half the resistance of the end to end value) and which are the "ends" of each set - if you get the "ends" the wrong way round, it will just reverse the direction of rotation.

In the motor from the tutorial, the two centre taps are just connected internally.


Btw. do not let the motor keep power on if it does not turn, or the windings could melt (depending on the wire diameter etc.).
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #2 on: January 01, 2009, 07:42:16 PM »
Yes!!! Now, the motor shaft is spinning.
Thank you very much for advising me.
Currently, although the motor is spinning, it buzzes in the middle of stepping.
My motor's stepping degree is 1.8 so one full revolution is 200 steps.
I tested with full 200 steps.
When I do this, the motor buzzes for a second and this kind of buzzing action happends whenever the motor tries to start and in the middle of its spinning.
It looks like something is grabbing the shaft to prevent it from being rotated.
I supply 8~9VDC power(using adapter) to ULN2003 at the moment.
Does it something to do with supplying voltage?
I mean, is my motor vibrating because ULN2003 needs more power?
According to this tutorial http://electronics-diy.com/electronics/stepper_motors.php
the supply voltage is 12~24V.
Then, should I supply such high voltage regardless of my motor's operating voltage(8.6V for new motor)?
My first stepper motor which has a specification as below was controlled easily whether I use 1.5V batteries or adapter.
*voltage : 4V
*current : 0.95A
*resistance : 4.2ohm
*inductance : 3.3mh
*holding torque : 1.6kgf

So, I am confussed.....

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #3 on: January 01, 2009, 08:01:58 PM »
Hi,


Do you use ramp up and ramp down algorithms?
If not, it is quite common to loose steps.

Further, you need more power (especially more current here, to "fill up" the larger inductance) than for the "old" motor, since it eats more.

Perhaps a ramp up will get you through, but more power should be in your mind.


Btw. do you use single step, power step or what?
« Last Edit: January 01, 2009, 08:08:14 PM by Soeren »
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #4 on: January 01, 2009, 08:17:43 PM »
Do you use ramp up and ramp down algorithms?
If not, it is quite common to loose steps.
Further, you need more power (especially more current here, to "fill up" the larger inductance) than for the "old" motor, since it eats more.
Perhaps a ramp up will get you through, but more power should be in your mind.
Btw. do you use single step, power step or what?

hi, Soeren
Actually, i don't know much about ramp up/down algorithm.
So, I need to supply more amp to get through. Could you tell me how much current will be suitable in this case?
I use arduino for the control and I use this code to accomplish my desired purpose.
Code: [Select]
#include <Stepper.h>
#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define motorSteps 200  // change this depending on the number of steps per revolution of your motor
#define ledPin 13 
Stepper myStepper(motorSteps, motorPin1, motorPin2, motorPin3, motorPin4);

int beamSensor = 2;
int val = 0;
                                                                                                                                                                                                                                                           void setup() {
 
myStepper.setSpeed(60); // set the motor speed at 60RPM
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
blink(3);
}

                                           
void loop() {
  val = analogRead(beamSensor);
  if (val < 100) {
 
  Serial.println("Forward");

  myStepper.step(200);
  delay(500);
  } 
}
  // Blink the reset LED:
void blink(int howManyTimes) {
  int i;
  for (i=0; i< howManyTimes; i++) {
    digitalWrite(ledPin, HIGH);
    delay(200);
    digitalWrite(ledPin, LOW);
    delay(200);
  }

}

My desired control is that whenever the beam sensor is desturbed, the stepper steps for designated amount.
Coudl you teach me how to ramp up?
« Last Edit: January 01, 2009, 08:23:49 PM by dsesmg »

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #5 on: January 03, 2009, 01:01:47 AM »
Hi, I have been keep testing the motors.
In case I reduce the speed of the motor, the motor spins fine. No buzzing at all.
But, that is the case when I set the speed at 30rpm and 100steps(which is the half of full revolution of my motors).
So, this is too slow and short stepping for my application.
I need to increase the speed as well as the number of stepping.
Could you advise me how much voltage and current should I supply to ULN2003 chips in order use the motors with increased speed and steps?

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #6 on: January 04, 2009, 10:28:40 AM »
Hi,

In case I reduce the speed of the motor, the motor spins fine. No buzzing at all.
But, that is the case when I set the speed at 30rpm and 100steps(which is the half of full revolution of my motors).
So, this is too slow and short stepping for my application.
I need to increase the speed as well as the number of stepping.
Yes, you need to ramp up the speed (and possibly to ramp down in the end to not loose steps, if you need precision).
I have never worked with the arduino so I cannot tell you exactly how to do it (but I guess you shouldn't do your programming in the header files, never the less).
You have to do something like (pseudo code)
Code: [Select]
PauseVal = MaxDelayNeeded
Do
  take a single step
  Pause(PauseVal)
  Decrement PauseVal (with the value needed to get a ramp up time about 20% longer than where you loose steps)
Loop Until MinimumPauseValReached
That way the motor inertia will be overcome "little by little".

Could you advise me how much voltage and current should I supply to ULN2003 chips in order use the motors with increased speed and steps?
Your motor dictates the voltage (a 10% overvoltage shouldn't hurt when running, but powered standstill is another matter completely).
Measure how much the voltage drops with each step (a 'scope is the best tool here) and add current capacity until it only drops a small amount (eg. less than a Volt). Whether your driver (the ULN2003) can handle the needed current, you have to check in the datasheet.

First off, use a ramp up routine though, as it might solve your issue without any hardware changes.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #7 on: January 04, 2009, 01:39:56 PM »
In your case, 60 RPM means 200 steps/second. That means it takes 5 milisecods for one step. This is a little too fast for starting the robot to move, because of inertia. You need a smaller speed that will increase in time until it reaches the max speed, then continue at that speed until just before it reaches the desired number of steps, then you stop the motor. Because of the inertia, it will go a few more steps. This is something that you will need to determine, at what RPM how many steps it overshoots, then substract that from the desired number of steps needed. Remember that at slow speeds or for a small number of steps it will not overshoot.

The Stepper function will wait until the motor stops moving before it continues to the next line of code. So, for one step it will wait 5ms. To ramp up, we will add a delay that will be decreased after each step. You need to determine the number of steps needed until it reaches the max speed.

Quote
for (int i=1; i<50; i++) {
   myStepper.Step(1);
   delay(50-i);
}
myStepper.Steps(150);


Check out the uBotino robot controller!

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #8 on: January 05, 2009, 02:46:27 AM »
Code: [Select]
PauseVal = MaxDelayNeeded
Do
  take a single step
  Pause(PauseVal)
  Decrement PauseVal (with the value needed to get a ramp up time about 20% longer than where you loose steps)
Loop Until MinimumPauseValReached
That way the motor inertia will be overcome "little by little".

First off, use a ramp up routine though, as it might solve your issue without any hardware changes.
Thanks so much for advising me.
Actually, It is my first time to look at such code.
I googled and searched wikipedia to find out how to use this code, but i am not quite sure how to this code to ramp up.
Could you tell me how to use this code or introduce me a link to a relevent source?
Thank you very much.
« Last Edit: January 05, 2009, 02:48:00 AM by dsesmg »

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #9 on: January 05, 2009, 03:00:00 AM »
The Stepper function will wait until the motor stops moving before it continues to the next line of code. So, for one step it will wait 5ms. To ramp up, we will add a delay that will be decreased after each step. You need to determine the number of steps needed until it reaches the max speed.

Quote
for (int i=1; i<50; i++) {
   myStepper.Step(1);
   delay(50-i);
}
myStepper.Steps(150);
Thank you very much for letting me know that.
I am trying to incorporate your code to my previous schetch.
But, I am having compiling problem at the moment.
Code: [Select]
#include <Stepper.h>
#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define motorSteps 200  // change this depending on the number of steps per revolution of your motor
#define ledPin 13 
Stepper myStepper(motorSteps, motorPin1, motorPin2, motorPin3, motorPin4);

int beamSensor = 2;
int val = 0;
void setup() {
 
myStepper.setSpeed(60); // set the motor speed at 60RPM
Serial.begin(9600);
pinMode(ledPin, OUTPUT);

}

                                           
void loop() {
  val = analogRead(beamSensor);
  if (val < 100) {
 
  Serial.println("Forward");

  myStepper.step(200);
  delay(500);
  } 
}
for (int i=1; i<50; i++) {
   myStepper.Step(1);
   delay(50-i);
}
myStepper.Steps(150);

Could you please correct me if I am not following your point?
Thank you very much.
« Last Edit: January 05, 2009, 03:02:28 AM by dsesmg »

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #10 on: January 05, 2009, 07:22:52 AM »
Replace the lines in your code:

Quote
myStepper.steps(200);
delay(500);

with the code I gave you. It will send 200 steps, but the first 50 steps will be accelerated to the top speed. And erase it below the last "}" of the void loop() function... that's what creates the compilation error.
Check out the uBotino robot controller!

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #11 on: January 05, 2009, 10:21:32 PM »
Thank you.
I am still having trouble getting the sketch compiled. :-[
Could you take a look at this code?
Code: [Select]
#include <Stepper.h>
#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define motorSteps 200  // change this depending on the number of steps per revolution of your motor
#define ledPin 13 
Stepper myStepper(motorSteps, motorPin1, motorPin2, motorPin3, motorPin4);

int beamSensor = 2;
int val = 0;
                                                                                                                                                                              void setup() {
 
myStepper.setSpeed(60); // set the motor speed at 60RPM
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}

                                           
void loop() {
  val = analogRead(beamSensor);
  if (val < 100) {
 
  Serial.println("Forward");

myStepper.steps(200);
delay(500);
  } 

for (int i=1; i<50; i++) {
   myStepper.Step(1);
   delay(50-i);
}
myStepper.Steps(150);
 
}

Could you advise me how to correct this sketch?

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #12 on: January 06, 2009, 02:02:43 AM »
This will do...

Code: [Select]
#include <Stepper.h>
#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define motorSteps 200  // change this depending on the number of steps per revolution of your motor
#define ledPin 13 
Stepper myStepper(motorSteps, motorPin1, motorPin2, motorPin3, motorPin4);

int beamSensor = 2;
int val = 0;
                                                                                                                                                                              void setup() {
 
myStepper.setSpeed(60); // set the motor speed at 60RPM
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}

                                           
void loop() {
  val = analogRead(beamSensor);
  if (val < 100) {
 
     Serial.println("Forward");

     for (int i=1; i<50; i++) {
        myStepper.Step(1);
        delay(50-i);
     }
     myStepper.Steps(150);
 
  } else {
  //turn around...
 
  }

}

If you look at the code, after if {} ends I added a else {} statement. After you add another stepper motor, run them both Forward inside the IF and ane forward and one in reverse inside the ELSE.
Check out the uBotino robot controller!

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #13 on: January 06, 2009, 02:28:18 AM »
HI, thanks so much.
OK.. so I use two stepper motors.
I will try to do that. But I am still in the middle of correcting the sketch as I am untable to complile the code.
I'll try my best.
Code: [Select]
#include <Stepper.h>
#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define motorSteps 200  // change this depending on the number of steps per revolution of your motor
#define ledPin 13 
Stepper myStepper(motorSteps, motorPin1, motorPin2, motorPin3, motorPin4);

int beamSensor = 2;
int val = 0;
                                                                                                                 void setup() {
 

myStepper.setSpeed(60); // set the motor speed at 60RPM
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}

                                           
void loop() {
  val = analogRead(beamSensor);
  if (val < 100) {
 
     Serial.println("Forward");

     for (int i=1; i<50; i++) {
        myStepper.Step(1);
        delay(50-i);
     }
     myStepper.Steps(150);
 
  } else {
  //turn around...
 
  }

}

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #14 on: January 06, 2009, 07:33:25 AM »
Change this line:

Quote
int beamSensor 2;

with this:

Quote
#define beamSensor 2

The first line sets beamSensor as a integer variable that you need to replace with an alias, same as you did with motorPin. Remember, after #define you don't put ;
Check out the uBotino robot controller!

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #15 on: January 06, 2009, 07:54:27 PM »
I'm sorry. I must be missing out something.
The compiler keep says,
Code: [Select]
In function 'void loop()':
error: 'class Stepper' has no member named 'Step
when I modified the code like this.
Code: [Select]
#include <Stepper.h>
#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define motorSteps 200
#define ledPin 13 
Stepper myStepper(motorSteps, motorPin1, motorPin2, motorPin3, motorPin4);

#define beamSensor 2
int val = 0;
void setup() {
 
myStepper.setSpeed(60);
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}

                                           
void loop() {
 val = analogRead(beamSensor);
  if (val < 100) {
 
     Serial.println("Forward");

     for (int i=1; i<50; i++) {
        myStepper.Step(1);
        delay(50-i);
     }
     myStepper.Steps(150);
 
  } else {
  //turn around...
 
  }

}

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #16 on: January 06, 2009, 08:21:25 PM »
That's my fault... Search for the word step and add an "s" to make the plural that the class understands... Stupid typo... If you look carefully when you get an error message, you may find the error yourself!
Check out the uBotino robot controller!

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #17 on: January 06, 2009, 11:30:11 PM »
Thank you very much.
 I will continue to try to modify the sketch until I get the code compiled.
I just modified it according to your advise, and I am still encountering the same compiler error.
I will try everything I can.

Code: [Select]
#include <Stepper.h>
#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define motorSteps 200
#define ledPin 13 
Stepper myStepper(motorSteps, motorPin1, motorPin2, motorPin3, motorPin4);

#define beamSensor 2
int val = 0;

void setup() {
 
myStepper.setSpeed(60);
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}

                                           
void loop() {
 val = analogRead(beamSensor);
  if (val < 100) {
 
     Serial.println("Forward");

     for (int i=1; i<50; i++) {
        myStepper.Steps(1);
        delay(50-i);
     }
     myStepper.Steps(150);
 
  } else {
  //turn around...
 
  }

}

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #18 on: January 07, 2009, 07:04:37 AM »
It seems that the function wants the Steps to be written as singular, with lower letters. As soon as I corrected it, the word turned to a different colour, so this is a good way to detect errors. The code below compiled properly:

Quote
#include <Stepper.h>
#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define motorSteps 200
#define ledPin 13 
Stepper myStepper(motorSteps, motorPin1, motorPin2, motorPin3, motorPin4);

#define beamSensor 2
int val = 0;

void setup() {
 
myStepper.setSpeed(60);
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}

                                           
void loop() {
 val = analogRead(beamSensor);
  if (val < 100) {
 
     Serial.println("Forward");

     for (int i=1; i<50; i++) {
        myStepper.step(1);
        delay(50-i);
     }
     myStepper.step(150);
 
  } else {
  //turn around...
 
  }

}
Check out the uBotino robot controller!

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #19 on: January 08, 2009, 06:37:05 AM »
Thank you so much for helping me out!
It is compiled smooth as slink. :)
What I can see right now is that the shaft of the motor buzzes(for 50 steps) at the start and then spins(for 150 steps).
I think I need to supply higher voltage and current then I supply right now.
As you know, I am using 1.5~14VDC, 600mA adapter at the moment.
I don't think it is easy to find some type of adapter that the amperage is adjustable.
I have a computer monitor's adapter(12VDC, 3A) at my warehouse.
Will it be ok to use such adapter to power ULN2003 chips to control my stepper motor?

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #20 on: January 08, 2009, 07:03:15 AM »
The adapter is good. You may be right, the stepper may need more power to run good.

So you are saying that the stepper's shaft does not spin at all for any of the 50 steps we are trying to ramp up? Try to install a handle on the stepper's shaft, like the hands of the clock, just to see how many steps it spins. Then try to play with the values of the delay or just change the line "myStepper.step(1);" to "myStepper.step(i);" and see how is that working.
Check out the uBotino robot controller!

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #21 on: January 08, 2009, 07:30:48 AM »
Hi, How are you.
No, the motor's shaft does not spin at all during the 50steps.
According to your modification, I changed the code from "myStepper.step(1);" to "myStepper.step(i);"
When I do it, the shaft actually spins a little(almost like a buzz) for 50steps and then spins for 150steps but it spins in a very shaky manner. Almost it looks as if it is spinned(for 1step)and then spinned back(for 1step) and it goes on like this for the remaining 150 steps.
I did changed the delay from 50 to 100.
The motor's shaft doesn't spin at all for any of the 50 steps.
Do I need to power the chips with more current at this point?
I am thinking of using the computer moniter's adapter(12VDC, 3A) that I told you.
But, I am worried that I would fry the chips again. :'(
Do you have any suggestions?

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #22 on: January 08, 2009, 07:38:26 AM »
Almost it looks as if it is spinned(for 1step)and then spinned back(for 1step) and it goes on like this for the remaining 150 steps.
Do you have any suggestions?

I think the stepper's wires are not wired properly. They are not in the proper sequence, that's why it goes a step forward and then backward. Try to switch in software the pin numbers, one pair at a time, until the motor spins correctly. Instead of having Pin1 8, Pin2 9, try Pin1 9, Pin2 8. Do not change all of them. If a change does not work, set it back to where it was, then try another pair.
Check out the uBotino robot controller!

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #23 on: January 09, 2009, 06:57:02 AM »
Hi, I just tested this sketch.
Code: [Select]
#include <Stepper.h>
#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define motorSteps 200
#define ledPin 13 
Stepper myStepper(motorSteps, motorPin1, motorPin2, motorPin3, motorPin4);

#define beamSensor 2
int val = 0;

void setup() {
 
myStepper.setSpeed(60);
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}

                                           
void loop() {
 val = analogRead(beamSensor);
  if (val < 100) {
 
     Serial.println("Forward");

     for (int i=1; i<50; i++) {
        myStepper.step(1);
        delay(50-i);
     }
     myStepper.step(150);
 
  } else {
  //turn around...
 
  }

}
And I switched
Code: [Select]
#define motorPin1 8
#define motorPin2 9
to,
Code: [Select]
#define motorPin1 9
#define motorPin2 8
When I did it, the shaft spins in clockwise.(Before, the shaft was spinning counterclockwise).
The shaft only slowly spins during the 50steps and then it buzzes during the entire 150steps.
I also switched
Code: [Select]
#define motorPin3 10
#define motorPin4 11
to,
Code: [Select]
#define motorPin3 11
#define motorPin4 10
and it shows me the same result. The sfaft spins(50steps) in clockwise motion and buzzes.
I only changed each two code groups according to your advise to see how it's changing.
Will it be OK for me to use 12VDC, 3A adapter to power the ULN2003 chips at this point?


Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #24 on: January 10, 2009, 12:48:19 AM »
I believe the problem is that your stepper does not go the sequence 1-2-3-4 but 1-3-2-4. So try to switch not 8 with 9 but 8 with 10 or maybe 9 with 11.

The easiest way would be to get a multimeter, set it on resistance or continuity, and check between the common wire to each of the signal wires to determine the pairs. Then connect one pair at 8 and 9 and try the second pair at 10 and 11. If the motor spins ok, that's it. If not, then reverse the last pair. Now it should work fine.

You may want to read this: http://www.tigoe.net/pcomp/code/category/code/arduinowiring/51
« Last Edit: January 10, 2009, 12:52:37 AM by Ro-Bot-X »
Check out the uBotino robot controller!

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #25 on: January 10, 2009, 07:31:00 AM »
Hi!
Thank you for your reply.
I received the real schematic of my stepper motor from the motor seller.
The previous shcematic is not for my motor. The seller provided the wrong one.
This is the real one.
http://www.flickr.com/photos/23525729@N06/3184823242/
According to your advise, I am checking the wires to sort out the pairs.
I am using a multimeter. I set it for continuity test and I've checked that red(com), black, brown colors are one pair,
and blue(com), yellow, orange colors are one pair.
I have been trying the test in this order.
Brown wire to pin 8, Black wire to pin 9, Yellow wire to pin 10, and Orange wire to pin 11.
But, my motor buzzes during all the 150 steps, and spins during all the 50 steps.
As you mentioned, I tried to switch 8 with 10 and tested and also switched 9 with 11.
When I do it, even the 50 steps are stucked(not even a few steps) just like the 150 steps.
But, I will keep trying this and that.

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #26 on: January 10, 2009, 12:07:49 PM »
Try to switch orange with yellow and see how that is working. Switching 8 with 10 makes no sense anymore, since they are on different pairs. I don't have  ULN2003 so I can replicate your experiment. All I have are H-Bridges and bipolar steppers.
Check out the uBotino robot controller!

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #27 on: January 10, 2009, 09:48:40 PM »
Hi, I just tried it.
When I switch the yellow and orange, the shaft of the motor spinned in clockwise.
But, this time, I could noticed that the shaft of the motor slightly spinned(unevenly though) during the 150 steps and spinned smoothly during the 50 steps.
 :)

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #28 on: January 10, 2009, 11:07:52 PM »
Ok. Now change the speed (RPM) to a lower value, say 10. If it works fine, double it, and so on, until the motor acts jerkly, then lower it a bit. Try to find the perfect value that works reliable. That would be the max speed you can run that motor. Now for the first 50 steps, does the motor increases speed or not?
Check out the uBotino robot controller!

Offline dsesmgTopic starter

  • Robot Overlord
  • ****
  • Posts: 128
  • Helpful? 0
Re: Controlling 8.6Volt, 1Amp stepper motor.
« Reply #29 on: January 11, 2009, 04:45:19 AM »
Hi,
I tested it and It seems that 30RPM is the maximum speed of my motor.
If I increase the rpm more than 30, the motor jerks.
Thanks to you, I know the maximum rpm of my motor, now.
I am very glad. :)
The speed of the motor slows down for 50 steps and increases for the 150 steps.
I can cleary see the difference.

 


Get Your Ad Here