Stepper Speed Issue

I have an Uno R3 running into a Pololu TIC 249 to control a NEMA 11 stepper motor. I am only moving it a small amount with variable speed from a pot.

My question is: I can run the TIC by itself and can get all kinds of speed from the stepper. When I connect the Uno up to it I cannot get any speed, and if I set the value too low the motor won't start like it did with the TIC stand alone. With the TIC by itself I could go really fast and it never stalled when starting.

Is my code not working right? This has me baffled.

int steppin = 12;
int dirpin = 11;
int stepdelay;
const int stepPin = 12;
const int dirPin = 11;

void setup() {
  // put your setup code here, to run once:
pinMode(steppin,OUTPUT);
pinMode(dirpin,OUTPUT);
digitalWrite(dirpin,HIGH); // direction pin either HIGH or LOW to move in either direction

}

void loop() {
  // put your main code here, to run repeatedly:
int val = analogRead(A0);
stepdelay = map(val,0,1023,900,200);
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
  for(int x = 0; x < 5375; x++) {
digitalWrite(steppin,HIGH);
delayMicroseconds(stepdelay);
digitalWrite(steppin,LOW);
delayMicroseconds(stepdelay);
}
digitalWrite(dirPin,LOW); //Changes the direction of rotation
  for(int x = 0; x < 5450; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(stepdelay);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(stepdelay);
  }

  }

That may be because the TIC uses acceleration to get to speed and your code does not. Try with the AccelStepper library that uses acceleration.

1 Like

AccelStepper will help with the acceleration, but the 50,000 steps/sec the TIC advertises outclasses the 4000 steps/sec top speed AccelStepper advertises:

AccelStepper: AccelStepper Class Reference.

You could of course let the TIC do the stepping, and just control it via any of the high-level interfaces.
That way, you’re not bothered whether your code is fast enough.

Sounds interesting @lastchancename , so, I am a noob, tell me more please!

Just yesterday I have run onto the TIC Ardunio Stepper Motor Control Library and it looks interesting. I haven't gotten into it yet but it appears that it can do the commands that the TIC Control Center software does but from Ardunio.

You can use the serial or other interfaces to ‘tell’ the controller where to go - instead of you punching the Dir & Step pins to do the job.

It keeps internal track of speed, current position and the target position. Effectively a standalone controller inside the TIC.

Since you bought it, you may as well use it.

The Features and Specs panel of the datasheet seems to meet your other requirements,

Yes, I was planning on using the I2C interface. I was just going through the TIC Ardunio Stepper Library and it looks really good.

The TIC 249 is a pretty slick little board.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.