Stepper motor and driver query

Hi All,

I have a little project with an Arduino and stepper that I use for astronomy. I use this exact set up on multiple devices and many others use the exact set up successfully too.

Now, i’m currently assisting a gentlemen in the states to set it up but i’m having some issues and hoping the forum can assist.

some info about his set up.
sketch: my sketch no issues on 12+ other projects.
Wiring: from video calls i’ve had with him everything is wired correctly.
Arduino Uno - temporary for his first prototype.
stepper: TB6600
motor:

  • Motor Type: Bipolar Stepper
  • Step Angle: 0.035 deg.
  • Holding Torque: 4Nm
  • Rated Current/phase: 1.68A
  • Phase Resistance: 1.65ohms
    power supply to driver :12V

Issue:
Motor vibrates but does not turn, but it is the testing that’s interesting. please see below different combinations and results.

tb6600 set to 2 amps and 32 micro steps and motor connected

  • motor does not turn
  • voltage measured at power input is showing 8.6 volts instead of 12 volts.

tb6600 set to 2 amps and 32 micro steps but the motor is disconnected

  • voltage measured at power input is correct 12 volts.

tb6600 set to 0.5 amps and 32 micro steps and motor connected

  • voltage measured at power input is correct 12 volts.

is there a reason the voltage drops when the motor is connected at 2 amps also happens at 1.5 amps, should this be happening? Also interesting to note voltage stays correct when tb6600 set to 0.5 amps.

The stepper has to step extremely slow so we did some further testing at the extremely slow speed and higher speed to see if there was a difference.
slow speed: 1 step every 22471 micro seconds
fast speed: 1 step every 224 microseconds.

tb6600 set to 0.5 amps and 32 micro steps motor running at slow speed.

  • motor vibrates but doe not turn

tb6600 set to 0.5 amps and 32 micro steps motor running at FAST speed.
-Motor turns fine!

So in summary we can get the motor to turn fine when TB6600 set to 0.5 amps and 32 micro steps running at FAST speed. There is no other combination of amps or microsteps that makes the motor turn.

I hope this information is enough.

In summary, why is the voltage dropping to 8.6 when tb6600 is set to 1.5 amps or higher and motor connected, is this normal?

why will the motor only turn when set to 0.5 amps and a quicker speed?

thanks for your help.

Hi Gregory,

I’d get some photos of his setup, as it’s hard enough diagnosing someone’s project over the internet, let alone through someone else.

This indicates your power supply is not up to the task, and is “collapsing” when subjected to load above its maximum rating, you didn’t mention it’s current capacity so I’m guessing here, it could be something else if that’s up to spec.

Have you looked at the output of your step and direction pins under an oscilloscope or logic analyzer? That might reveal some strange signal issue in the setup.

The 22ms interval here makes me think you’re hitting some kind of resonance in the motion of the project, again hard to tell without photos, but there’s a chance you’re actually asking more of the motor by starting and stopping this quickly than to just keep moving at a constant speed. I’d try more current once you’ve confirmed your supply can deliver more than that.

Keen to get to the bottom of this one!

Hey James,

Ok so the gentlemen is in his late 70s so a little hard to get all the info and photos but we’ve had some success!

So the power supply was the initial issue. He thought it was 2 amps but after i saw a photo of power supply it was 200milliamps! tried a new power supply and we are up and running.

How ever we now have another issue. The motor is running at a factor of 10 slower than what it should be. I’m pretty confident my maths is right as I’ve used this several times before including on my own.

Running it at 32 micro steps | 200 step motor | 50.9 gear box
1 rotation should equal = 3220050.9 = 32,576 micro steps per rotation.
732,000,000 / 32,576 = 22471 rounded up the nearest micro second.
so 1 step per 22471 microseconds = 1 rotation per 732,000,000 microseconds or 12 mins and 12 seconds.

Although above is what we need, currently I’ve changed it to 1 rotation per 5 seconds for easier assessment if its working or not and its rotating at 1 rotation ever 50 seconds!
5,000,000 / 32,576 = 1 step every 153 microseconds.

What could make a stepper move a factor of 10 slower? i was thinking skipped steps but note sure it would be so consistent?

My sketch that works on several other devices:

int button = 12;       // the number of the input pin, push buttons for restart
int Buzzer = 11;       // the number of the output pin buzzer, not in use
int ms1 = 2;
int ms2 = 3;
int ms3 = 4;
int state = LOW;      // the current state of the output pin
int reading;           // the current reading from the input pin
int previous = LOW;    // the previous reading from the input pin
#define dirPin 8
#define stepPin 7
#define stepsPerRevolution 20000
// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0;         // the last time the output pin was toggled
long debounce = 2000;   // the debounce time, increase if the output flickers
unsigned long endTime;
boolean itAlreadyHappened = true;  
unsigned long delay_Micros = 153; // This controls the speed of the platform, delay between each step. 
unsigned long next_Micros = 0;

void setup()
{
  pinMode(button, INPUT);
  pinMode(Buzzer, OUTPUT);
  // Declare pins as output:
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
 
  pinMode(ms1, OUTPUT);
  pinMode(ms2, OUTPUT);
  pinMode(ms3, INPUT);
  digitalWrite(ms1, LOW);
  digitalWrite(ms2, LOW);

  // Next (first) step should occur delay_Micros from now
  next_Micros = micros() + delay_Micros;
  // Set the spinning direction clockwise (tracking direction)Terry changed LOW to HIGH
  digitalWrite(dirPin, HIGH);
}

void loop()
{
  reading = digitalRead(button);
  // If the input just went from LOW and HIGH and we've waited long enough
  // to ignore any noise on the circuit, toggle the output pin and remember
  // the time
  if (reading == HIGH && previous == LOW && millis() - time > debounce) {
    if (state == HIGH)
      state = LOW;
    else
      state = HIGH;
    time = millis();
    
  }
if (state==LOW) {

if (itAlreadyHappened == false)
  {
  
   
    digitalWrite(dirPin, LOW); // Enables motor to speed up in normal tracking direction to clear push button eliminating multiple reads.
    for(int x = 0; x < 12000; x++) {
      digitalWrite(stepPin, HIGH);
      delayMicroseconds(70);
      digitalWrite(stepPin, LOW);
      delayMicroseconds(70);
    }
     // Reset our target time for the next "tracking" step
    next_Micros = micros() + delay_Micros;
   
    itAlreadyHappened = true;}
   
  
   
   
   // Handle normal tracking steps
    // These lines result in 1 step:
    if (micros() >= next_Micros) {
      next_Micros += delay_Micros;
      digitalWrite(stepPin, HIGH);
      delayMicroseconds(10);
      digitalWrite(stepPin, LOW);
    }
  }
 
  else {
    // Set the spinning direction in reverse to reset platform and return to start position.
    // this actualy runs first when arduino powered on.
  digitalWrite(dirPin, HIGH);
 
 
    // These four lines result in 1 step:
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(50);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(50);
 

 
   itAlreadyHappened = false;
   
  }
}

1 Like

Hi Gregory,

I tried the maths on my side and got an answer 10x larger, so perhaps that’s where the problem is:

(200 steps/rev) * (32 micro steps per step) * (50.9 revs of the motor per rev of the gearbox output)
200 * 32 * 50.9
=325,760

Does that look right to you?

i’m an idiot james. I recalculated for his circumstances and as you pointed out I am out by a factor of 10 and i obviously didn’t recheck the maths properly!!

James, im sorry about the last bit but, the first part regarding the power supply was very helpful thank you!

1 Like

Hi Gregory
A factor of 10. That would suggest incorrect position of a decimal point somewhere or clock speed but James beat me to it.

I think there is one other thing worth mentioning. This concerns step accuracy. I don’t know what flavour Arduino is concerned but some time ago I had occasion to do some measurements on an Arduino UNO R3. Results and description here.

Arduino UNO R3 some limitations

This concerns the accuracy of the “digitalWrite” command. In summary the UNO has a built in error of about 4µSec. Apparently this comes about due to some housekeeping by Arduino before executing the command. This is not too bad at higher delays but when you get down to 10µSec this is 40% so it might be a good idea to measure your rotational speed again with a tachometer. This error can be reduced greatly (confirmed by measurement) by replacing the digitalWrite commands with “digitalWritefast” which bypasses the housekeeping. There are some links in that post to the sources of info.

Other Arduino models might be different. I don’t know.
Cheers Bob

2 Likes

Hi Gregory,

Not a problem at all! Sometimes you just need a second set of eyes to go over it on their end, that’s what we’re for :slight_smile:

1 Like