[code]#define stepPin 3 #define dirPin 2 #define enablePin 4
void setup()
{
// We set the enable pin to be an output
pinMode(enablePin, OUTPUT);
// then we set it HIGH so that the board is disabled until we
// get into a known state.
digitalWrite(enablePin, HIGH);
Serial.begin(9600);
Serial.println(“Starting stepper exerciser.”);
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop()
{
int j;
// 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<=10000; j++) {
digitalWrite(stepPin, LOW);
delayMicroseconds(2);
digitalWrite(stepPin, HIGH);
delayMicroseconds(1000);
}
}[/code]
Running the code, stepper shaft become stiff but not moving at all. A small intensity noise is coming from inside as similar as is rotating but only noise. DRV cooler is enough hot but still I can keep my finger on top for 3-4 seconds.
I’ve done current adjustment according instructions from above guide.I’m not sure if connection between two GND is necessary (Arduino and power GNDs; small green wire ). Powering done with 12V, 2A DC adapter.
Thank you if somebody can help me.
Pololu link from my first post contains three pdf files.Inside PololuPres_V3.pdf is explaining how to adjust the current to 0.7*rated current = 0.7 * 1.5 = 1.05A .I did like this and my test was with this setting. I don’t know an other method to adjust the current.
Thanks for the information and for posting a clear picture of your connections. It looks like you currently have the driver in half-step mode. When you set the current limit using the method specified in that guide, did you have the stepper motor driver in full-step mode?
Instead of setting the current limit by measuring the current in the coils, we generally recommend setting it using the VREF voltage. Detailed instructions for setting the current limit using the VREF voltage method are given in this video.
By the way, in your code it looks like you are trying to step the motor a little fast. You might try slowing down the step rate to step every couple of milliseconds, and setting your delay using the normal delay() command, which is in milliseconds.
Thank you Grant.
I managed to make stepper to move following that video by proper adjustment the of current and by reducing wiring to minimum.
Stepper is moving but is a very chaotic movement.Steps forward,backward or no step in the same loop.
For example using code below, stepper is doing sometimes one revolution CW sometimes not.Even if it is a full revolution the steps are alternating forward/backward.And not all the times is a full revolution. Sometime is more sometime less.
In the second part of the code, when the rotation suppose to be in opposite direction, stepper is nothing doing.
Using micro-stepping movement seems to improve but is far from a smooth one.
[code]int directionPin = 8;
int stepPin = 9;
int j;
void setup() {
Initially I’ve set current to 1.5 A (Vref = 0.75V) but after seeing how is moving I was playing with current limiting potentiometer on full range.
I’ll try to find a better/bigger power source than my 12V 2A adapter.
Regards,
LE.
I solved the problem. Doing so many attempts I forgot to connect the two GND each other(power and Arduino). Now stepper is working fine.
Thank you for your help Jim and Grant.