I have a PM55L stepper motor connected to a TMC2160 controller, driven by Arduino uno.
I used the code below to drive it. It runs in both directions, but the motor gets very hot, very fast. What could the problem be?
I am fairly new to arduino and coding and have a fair knowledge of electronics. I set the controller dip switches as follows M0-0, M1-0,M2-0,M3-0,M4-0,M5-1,M6-1
Code for Stepper.
int dirpin = 8;
int steppin = 9;
int enable = 7;
void setup() {
// put your setup code here, to run once:
pinMode(dirpin, OUTPUT);
pinMode(steppin, OUTPUT);
digitalWrite(enable, HIGH);
}
void loop() {
// put your main code here, to run repeatedly:
int i;
digitalWrite(dirpin, HIGH); //Set the direction
delay(100);
for (i=0;i<4000;i++) {
digitalWrite(steppin, LOW);
delayMicroseconds(400);
digitalWrite(steppin, HIGH);
delayMicroseconds(400);
}
digitalWrite(dirpin, LOW);
delay(100);
for (i=0;i<4000;i++) {
digitalWrite(steppin, LOW);
delayMicroseconds(400);
digitalWrite(steppin, HIGH);
delayMicroseconds(400);
}
}