# Stepper motor circuit

#### AlexB1001

Joined Nov 19, 2020
4
I hope this is the right subforum to post this question.
A little background first. None of us have much of a background in electronics, we are mainly dealing with mechanical issues. We have a telescope observatory and are trying to automate the rotation of the dome to sync with the telescope. To that end to start the project we purchased a high torque stepper motor ( https://www.tindie.com/products/stepperonline/nema-17-stepper-motor-48mm-length-w-511-gearbox/ ) along with the TB6600 driver and Arduino Uno.
The following was the connections we used:
A 12V 5A power supply was used. The corresponding wires of the stepper were connected to the TB6600.
From the TB6600 EMA+, DIR+,PUL+ to Arduino 5V
PUL- to Arduino 8
DIR- to Arduino 9
The DIP switches are set to ON ON OFF / ON OFF OFF
Then we used a simple code to try rotating the stepper one full rotation.
With a step angle of .035 degrees one full rotation should be equal to 10,286 steps.
This is the code:

Code:
/*
Stepper Motor Control - one revolution
This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 9 of the Arduino.
The motor should revolve one revolution in one direction, then
one revolution in the other direction.

*/

#include <Stepper.h>

const int stepsPerRevolution = 10286;  // change this to fit the number of steps per revolution

// initialize the stepper library on pins 8, 9:
Stepper myStepper(stepsPerRevolution, 8, 9);

void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(15);
// initialize the serial port:
Serial.begin(9600);
}

void loop() {
// step one revolution  in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);

// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}
The result is that the stepper motor only rotates approximately 1/4 turn in each direction and not a full turn.
What are we doing wrong?
Again I apologize for the non professional nomenclature but electronics is not our strong suit.

#### shortbus

Joined Sep 30, 2009
8,441
How fast are you trying to step? I did see that you did the math on the number of steps, something many miss. Stepper motors are prone to loosing their place when asked to step a high load too fast. You don't say how heavy your dome is, but even for something pretty light I never would have chosen a NEMA17 motor, it is one of the least powerful of the NEMA series of motors.

#### AlbertHall

Joined Jun 4, 2014
11,129
This might be because of the micro-stepping settings. Below is from the manual:

#### panic mode

Joined Oct 10, 2011
1,877
usually stepper motors do 200 steps per revolution. according to link gear ratio is 50.9:1 so 200*50.9 = 10180.
bit this could be off if anything was rounded. for example 360deg/10180 steps = 0.035363457xxxxxx

anyway, this difference is too small to account for observed 1/4 of the travel or 75% difference. other things to check are
1. PSU (not enough current?) but this is ok
2. driver unable to supply enough current but this is not true (4A possible which is more than motor can hande)
3. too high speed (acceleration really). i guess this is not the issue either.
4. too high load? maybe motor is undersized? but i am guessing you are running it without load connected yet so this should be no issue.
5. wrong number of steps - also not an issue, 10286 is in the ballpark
6. motor driver is not just a stupid driver but can also do micro-stepping. this is likely the case....

#### AlexB1001

Joined Nov 19, 2020
4
How fast are you trying to step? I did see that you did the math on the number of steps, something many miss. Stepper motors are prone to loosing their place when asked to step a high load too fast. You don't say how heavy your dome is, but even for something pretty light I never would have chosen a NEMA17 motor, it is one of the least powerful of the NEMA series of motors.
We measured the torque required to turn the dome at 3.5Nm and this stepper has a max torque of 4Nm so the thinking was it should suffice. The speed is not that critical as the required rotation is extremely slow.
What would be your recommendation for a stepper motor.
Our test involved no load on the motor.

#### AlexB1001

Joined Nov 19, 2020
4
This might be because of the micro-stepping settings. Below is from the manual:

View attachment 222796
I'm not certain I read this chart correctly, The switches were set to 1-200 ON ON OFF which I assumed meant there was no microstepping. If I set it to 4-800 ON OFF OFF wouldn't it mean that the microsteps would increase and the rotation would further decrease by 1/4 ?

#### AlexB1001

Joined Nov 19, 2020
4
usually stepper motors do 200 steps per revolution. according to link gear ratio is 50.9:1 so 200*50.9 = 10180.
bit this could be off if anything was rounded. for example 360deg/10180 steps = 0.035363457xxxxxx

anyway, this difference is too small to account for observed 1/4 of the travel or 75% difference. other things to check are
1. PSU (not enough current?) but this is ok
2. driver unable to supply enough current but this is not true (4A possible which is more than motor can hande)
3. too high speed (acceleration really). i guess this is not the issue either.
4. too high load? maybe motor is undersized? but i am guessing you are running it without load connected yet so this should be no issue.
5. wrong number of steps - also not an issue, 10286 is in the ballpark
6. motor driver is not just a stupid driver but can also do micro-stepping. this is likely the case....
Would you recommend a different driver?

#### shortbus

Joined Sep 30, 2009
8,441
What would be your recommendation for a stepper motor.
Our test involved no load on the motor.
Most small CNC routers use a NEMA 25, the next step up from what you have. But there is something else wrong if your not getting full rotation with no load.

You choosing a 4Nm motor to move a load calling for 3.5Nm is cutting way to close for normal things. You need a more powerful motor.

#### djsfantasi

Joined Apr 11, 2010
7,561
Have you tested rotation with no load?