Sticky Motor driven Slide Action

I am having a problem with my stepper motor not being able to get my slide started. You can see the issue in a Youtube video here: http://www.youtube.com/watch?v=roX1TNX05Vo

I have a 1205 Stepper Motor with a 1202 A4983 Stepper Motor Driver powered by a 1.0A 12V adjustable voltage wall wart. The slide offers very little resistance. I weighed it on a cheap scale and it came in at about 3 oz. I have a plastic rack and pinion that was designed for furniture. The rack is attached to an aluminum slide rail with a Teflon type insert that it slide on so it glides quite will. The drag will not stop the gear from turning the motor and the rack from sliding when the power is off and the assembly is turn at 45 degrees downward.

Should this code have something in it so that the motor can accelerate first or something else? Is there any other code that would be better too use?

The code that I use is listed below. I adapted it from something that I got from your site here:
https://forum.pololu.com/download/file.php?id=487

void lowerTheBoom()
{
int j;

    digitalWrite(enablePin, LOW);                  // set the enablePin low so that we can now use our stepper driver.
    delayMicroseconds(2); // wait a few microseconds for the enable to take effect (That isn't in the spec sheet I just added it for sanity.)

    for(j=0; j<=lowerTheBoomSteps; j++) 
      {
      digitalWrite(stepPin, LOW);
      delayMicroseconds(2);
      digitalWrite(stepPin, HIGH);
      delayMicroseconds(1000);
      }
    digitalWrite(enablePin, LOW);
    
}

Hello.

I suggest you build some acceleration into your code. Also, have you set the current limit to give you the maximum current your stepper motor can handle? If this doesn’t totally fix your problem, my next suggestion would be to try a more powerful power supply.

- Ben

How do you do that?

Do what, set the current limit or implement acceleration?

I put in the acceleration code and that works but I need more power. How do I set the current limit to give you the maximum current? What is the maxim that the 1205 Stepper Motor with a 1202 A4983 Stepper Motor Driver?

You can find that information on the respective product pages:

pololu.com/catalog/product/1202
pololu.com/catalog/product/1205

If something is unclear in the documentation, please ask.

- Ben

I’m sorry. I don’t know anything about this stuff and it was almost all Greek to me. That was a second time through. I would only guess that I should up the voltage and subdivide the steps but I don’t have a clew. …and that jumping, letters? It all sound very well laid out and logical but I don’t get it.

I’m afraid that if you give me advice, it may go over may head as well but what do I do to get more toque without burning something out?

I don’t understand what this means.

You should be able to easily find the rated current for your stepper motor from the page I linked to. It is 670 mA per coil. This is the maximum current limit you should set on your driver. The procedure for setting the driver’s current limit is covered on the driver product page I linked to under the section called “Current limiting”. I’m not sure what you don’t understand; if you ask specific questions, it will help me understand what to clarify.

- Ben

I guess my first question would be, when you use quarter steps, do you get less speed but more torque?

Microstepping is simply a way to increase your step resolution by decreasing your step size. It does not appreciably affect the maximum torque or speed of the motor. Note that for a given step rate, stepper motor running in quarter-step mode will move at 1/4 the speed of a stepper motor running in full-step mode, but you can just increase the step rate by a factor of 4 in the quarter-step case to get back to full speed.

- Ben

Ok, I have read the Current Limit section about 5 times now and I’m sorry but I still don’t get it. I have never taken those classes.

From what I can gather, the pot helps to prevent too much current from getting to the motor. I hope that I am not exceeding the maximum value now by using 1A, no matter how I have the pot set.

Would it help me to change to a 2A power supply or is there a way to increase the torque with the 1A unit that I have now? I guess that if I did go with a more powerful power supply, I would then need to tune the limiter. Is that right?

I don’t really know how to rephrase it for you if you can’t give me some indication of what about the current description is confusing. Saying you haven’t taken “those classes” really doesn’t help, and it’s hard for me to believe that you cannot narrow down what you don’t understand.

Setting the current limit to an arbitrary value is not a good approach. You could be over-limiting your current, which means you’re not getting full current. Do you own a multimeter? If not, your first step should be to purchase one. You can then measure the current limit reference voltage and set the pot to the correct position.

Torque is directly related to current, so if you want more torque, you need to maximize your current (without exceeding what the stepper motor can tolerate). This means using a power supply that can deliver the current you need. You also should consider using a higher voltage; the current will ramp up faster through the stepper motor coils if the voltage is higher, leading to a higher average current at high step rates and allowing for faster rotation/more torque at high speed.

- Ben

I just don’t understand the electronic buzz words. This is the way that I read just about every line in the three paragraphs:

Yes I do have a multi-meter. I bought it to find the hot side of wire combinations.

What you said makes sense. Yes, I might have go to a higher amperage or higher voltage.

I will read this a few more times and see if I can try to run some tests.

You can see from the diagram on the stepper motor product page that the stepper motor has two coils, one between A and C and another between B and D. You can set the current limit by measuring the current flowing through one of these two coils (e.g. by connecting your multimeter in series with one of the stepper motor wires while set to measure current).

The stepper motor driver has a step pin, and it advances the stepper motor by one step every time it receives a pulse on this pin. When configuring the current limit, you should not be sending pulses to the driver’s step pin (you should be holding it steadily high or low).

- Ben

I improved the acceleration code. I also tuned the current limit pot on the controller board more closely.

With that, I got it to work. I haven’t aligned all of the parts like the angles of the motor mount and the alignment of the slide guides but with that, it should work better.

It does appear to have the power but at the low end, it is still right at the edge, just barely starting. It does bind a little, on start up once in a while, usually the first time I run the program. I think that with more tuning of the code, I can get it to be smoother.

As you can see, there isn’t much of a margin of error. I don’t know if I should buy a power supply with 2A’s or just use a wall wart with a higher voltage and then re-tune the limiting pot.

I’m glad to hear it’s working better for you. I suggest you try a power supply that can deliver more current at a higher voltage. You will not need to re-adjust the current limit if it is set properly right now as the current limit is not a function of the motor voltage (it is a function of the logic voltage, but this should stay constant even if you change your motor voltage).

- Ben

I guess that my next question is, will this code turn the power to the motor off so that it can cool?
digitalWrite(enablePin, LOW);

Also, then this code is used, will the driver board be off as well so that it can cool or do I need to actually switch off the power to it. If it doesn’t turn off, will it be hurt by staying on all the time?

The pin is actually “not enable” and it is pulled low by default, which enables the motor driver. If you want to disable the motor driver, you can drive the pin high:

digitalWrite(enablePin, HIGH);

From the datasheet:

Driving the enable pin high will prevent current from flowing to the stepper motor, which will let it and the driver cool. Note that when disabled, the stepper motor will no longer have any holding torque beyond internal friction. Even when disabled, the internal logic of the driver will be active (this will not hurt anything) and will continue to update the driver state based on the other translator inputs, even though the stepper motor driver outputs will not be active.

- Ben

Yesterday, I tuned the pot without the meter because I didn’t know what I should be looking for.

Tonight, I was able to put a meter on the 1A and 2A pins. When I disconnect the Step pin, I get 0.45 when the meter is set to RX10. If I disconnect the Step and the Dir pins, I get 0.40.

When they are both connected I get what is on the video. The readings are somewhat erratic. The nettle basically started with no power, then jumps to 0.40, then 4.0 and back to zero …or it will jump from 4.0 to 25 or 30 instead of zero. (That is where the video starts) I don’t know why it finishes by going to either zero or 25.

This is the code that I am using. I haven’t changed the last digitalWrite from high to low.

void loop()
{
int j;
int decelerate = 5000;
// set the enablePin low so that we can now use our stepper driver.
digitalWrite(enablePin, LOW);
// wait a few microseconds for the enable to take effect
// (That isn't in the spec sheet I just added it for sanity.)
delayMicroseconds(2);
// we set the direction pin in an arbitrary direction.
digitalWrite(dirPin, HIGH);

for(j=0; j<=700; j++) {
   digitalWrite(stepPin, LOW);
   delayMicroseconds(2);
   digitalWrite(stepPin, HIGH);
   delayMicroseconds(decelerate); 
      if(decelerate >= 1024)
      {
      decelerate = (decelerate - (decelerate/199));
      }

}
delay(5000);
digitalWrite(enablePin, HIGH);
delay(5000);
}

You don’t seem to be following my instructions for configuring the current limit. I wrote in an earlier post:

Disconnecting the step input is not the same as holding it steadily high or low. When it’s disconnected, the pin is floating and the device can randomly step. Also, I cannot see how you have your multimeter connected (and you didn’t provide any units for your measurements), so I cannot draw any conclusions from your video.

I suggest you disconnect your Arduino from the stepper motor driver and measure the current flowing through one of your stepper motor coils while the STEP and DIR pins are connected directly ground. Your current limit will equal this measured current divided by 0.7, and you can adjust it to your desired limit by turning the pot.

Alternatively, you can measure the Vref voltage directly on the driver pin labeled REF. A voltage of approximately 270 mV on this pin corresponds to a current limit (per coil) of 670 mA. This is probably the easiest way to set the driver’s current limit as you don’t even need to have a stepper motor connected. All you need is to power the board and hold the STEP and DIR pins fixed low or high.

- Ben