Stepper motor driver adjust

i told you this isn't arduino compiler, its a codevision compiler

why witdrawn, i use arduino board and my question is not about coding its about he motor and the driver

Hi,
Well the code it produced will not work in an Arduino environment.

Try this code, it compiles but is not tested.


int stepPin = 6;
int dirPin = 7;
bool dirState = true;
int steps = 100;

void setup() {
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
}

void loop() {
  if (dirState == true)  // check direction and change
  {
    dirState = false;
  }
  else
  {
    dirState = true;
  }
  digitalWrite(dirPin, dirState);
  for (int i = 0; i < steps; i = i + 1) // pulse clock to driver 100mS steps
  {
    digitalWrite(stepPin, HIGH);
    delay(100);
    digitalWrite(stepPin, LOW);
    delay(100);
  }

}

Tom... :grinning: :+1: :coffee: :australia:
PS, You should have told us the code did not compile at THE FIRST POST.
POST #2 ASKED FOR YOUR CODE...

Hi,
The reason the motor is getting warm is because you have the driver ENABLED, it is putting current through your stepper, and waiting for pulses to turn it.
Steppers shaft, when not being signaled, is basically locked in position, this is most of the time an advantage.
That is one reason for a "Current Limit" parameter.
To stop the current, you need to take control of the ENABLE input of the driver.

Tom... :grinning: :coffee: :coffee: :coffee: :coffee: :coffee: :australia:

my normal case i left Enable unconnected as mentioned in datasheet, i have already tried to enable the driver and disable it but the motor also got hot

Hi,
Did you run my code?
Lets see if your driver and stepper work.

Do you have a DMM?

Tom... :grinning: :coffee: :coffee: :coffee: :australia:

I disabled the driver at stationary position the motor isn't hot now. there is now only one problem the motor tics when start to move, tic tic

Hi,

Using what code?

Tom... :grinning: :+1: :coffee: :australia:

using my code, idon't have arduino environment

Hi,
Are you running your code in the real world, or on a simulation?
The code you supplied me will not run in the Arduino environment and I have no knowledge of the environment you are using.

Is there a reason you have not used the Adruino IDE?

Tom... :grinning: :+1: :coffee: :australia:

yes i use real components, i dont' use arduino as i didnt' giet used to it. and you can upload codevision code to arduino board

Hi,
Have you been able to successfully load ANY code to the UNO with codevision compiler??

Tom... :grinning: :coffee: :coffee: :coffee: :coffee: :coffee: :australia:
PS, You may need to find a codevision forum.

yes , this code is working using this method. codevision3.12

ok, if the problem with the code i will find codvision forum but i still not sure why there is a tic

Hi,
What step rate have you got in your code?
How much time between steps?
Try bigger steps, like 200ms.
Have you tried swapping the brown and white wires over, just in case the stepper phasing is different.
Have you used a DMM to check that the stepper coils are continuous and independent of each other?

Tom.... :grinning: :+1: :coffee: :australia:

I increased the delay time to 30ms, the motor is slow and there is no tics. but what is scientific explanation? what if i want to increase speed on the motor

You were apparently trying to run the motor too fast. Try starting slowly and accelerate by decreasing the step delay. You may need to do so in several increments.

There is an accelstepper library that can manage that for you.