Need some help, I'm not sure where to look, can't get stepper motor to run properly. I uploaded a short video of the motor running, in case someone recognizes the symptoms, here
Rotor has no power besides running strange.
I'm using BIGTREETECH TMC2209-V1.2
My code:
#include <TMCStepper.h> // TMCstepper - https://github.com/teemuatlut/TMCStepper
#include <SimpleTimer.h>
#include <SoftwareSerial.h> // Software serial for the UART to TMC2209 - https://www.arduino.cc/en/Reference/softwareSerial
#define EN_PIN 2 // Enable
#define ENABLE_9V_PIN 3 // Enable 9 Volt for camera (GATE)
#define DIAG_PAN_PIN 4 // Diagnostic pin from stepper driver
#define DIAG_TILT_PIN 5 // Diagnostic pin from stepper driver
#define RC_0 9
#define RC_1 10
#define RC_2 11
#define RC_3 12
#define SW_TX 15
#define SW_RX 14
#define R_SENSE 0.11f
#define STALL_VALUE 100 // [0..255]
#define CAMERA_TIMEOUT 60*60*1000
#define DRIVER_ADDR_PAN 0b00 // TMC2209 Driver address according to MS1 and MS2
#define DRIVER_ADDR_TILT 0b01 // TMC2209 Driver address according to MS1 and MS2
SoftwareSerial SoftSerial(SW_RX, SW_TX);
TMC2209Stepper TMC_Driver_pan(&SoftSerial, R_SENSE, DRIVER_ADDR_PAN);
TMC2209Stepper TMC_Driver_tilt(&SoftSerial, R_SENSE, DRIVER_ADDR_TILT);
bool dir_pan = false;
bool dir_tilt = false;
void setup() {
_delay_ms(5000);
// put your setup code here, to run once:
Serial.begin(19200);
SoftSerial.begin(19200);
TMC_Driver_pan.beginSerial(19200);
delay(100);
pinMode(EN_PIN, OUTPUT);
digitalWrite(EN_PIN, LOW); // Enable driver in hardware
delay(500);
pinMode(ENABLE_9V_PIN, OUTPUT);
digitalWrite(ENABLE_9V_PIN, LOW); // Turn off camera / 9V
pinMode(DIAG_PAN_PIN, INPUT);
pinMode(DIAG_TILT_PIN, INPUT);
TMC_Driver_pan.begin(); // UART: Init SW UART (if selected) with default 115200 baudrate
TMC_Driver_pan.toff(5); // Enables driver in software
TMC_Driver_pan.rms_current(1000); // Set motor RMS current
TMC_Driver_pan.microsteps(16); // Set microsteps
TMC_Driver_pan.en_spreadCycle(false);
TMC_Driver_pan.pwm_autoscale(true); // Needed for stealthChop
TMC_Driver_pan.intpol(true);
}
void loop() {
// put your main code here, to run repeatedly:
TMC_Driver_pan.VACTUAL(1000);
delay(5000);
}
I don't accept their cookies, so no.
What is the resistance of the coils? Any voltage told?
Lately members have been trying to use hybrid steppers and they don't match Your current controlling driver. Trouble hits them...
If you turn up the volume, you can hear it doesn't run smoothly, it skips, rotor has no power, can easily stop it with just pushing my finger on it. Tried countless of different settings.
I listened at full volume, still looks okey. The code tells about 16 microsteps.
What is the current set to? It ought to be at least 1.5 Amp.
I could think about testing to use full step and check the torque.
Regarding skipping steps, run the motor exactly one rew and stop/pause. Add a ving to the shaft.
I have used the motors with another driver, which worked well but was too noisy. I can say with certainty that the motor is not running well, but I will do what you suggested. I have used several current settings, most recently 1.65A. It's gonna have to wait till tomorrow. Thanks.
I have uploaded a new video here
I have tried different permutations for the wires to the motor coils but it runs "best" with the original wiring so I assume that's the correct configuration. I was very careful when I connected the motors to the drivers.
I also connected step/dir to my microcontroller but that runs worse than using VACTUAL over UART.
Current code:
...
TMC_Driver_pan.begin(); // UART: Init SW UART (if selected) with default 115200 baudrate
TMC_Driver_pan.pdn_disable(true); // Use PDN/UART pin for communication
TMC_Driver_pan.toff(5); // Enables driver in software
TMC_Driver_pan.rms_current(500); // Set motor RMS current
TMC_Driver_pan.microsteps(16); // Set microsteps
TMC_Driver_pan.en_spreadCycle(false);
TMC_Driver_pan.pwm_autoscale(true); // Needed for stealthChop
TMC_Driver_pan.intpol(true);
TMC_Driver_pan.I_scale_analog(false); // Use internal voltage reference
TMC_Driver_tilt.begin(); // UART: Init SW UART (if selected) with default 115200 baudrate
TMC_Driver_tilt.pdn_disable(true); // Use PDN/UART pin for communication
TMC_Driver_tilt.toff(5); // Enables driver in software
TMC_Driver_tilt.rms_current(500); // Set motor RMS current
TMC_Driver_tilt.microsteps(16); // Set microsteps
TMC_Driver_tilt.en_spreadCycle(false);
TMC_Driver_tilt.pwm_autoscale(true); // Needed for stealthChop
TMC_Driver_tilt.intpol(true);
TMC_Driver_tilt.I_scale_analog(false); // Use internal voltage reference
digitalWrite(EN_PIN, LOW); // Enable driver in hardware
delay(500);
}
void loop() {
// put your main code here, to run repeatedly:
/*
digitalWrite(STEP_PIN_1, LOW);
delay(10);
digitalWrite(STEP_PIN_1, HIGH);
delay(10);*/
TMC_Driver_pan.VACTUAL(1000);
TMC_Driver_tilt.VACTUAL(1000);
delay(5000);
}
Note: Current setting doesn't really change anything for the better, 500mA should be plenty for unloaded shaft.
Help greatly appreciated. I have ordered DRV8825 as a backup plan, but I would really like the TMC2209 to work since they are silent, which is important for my application.
That video clearly shows something's wrong like the jerky turning.
Stepper or driver acting badly?
Do You have another stepper You can swap in for a test?
I once got a stepper having one of its 4 wires broken inside. It behaved erratic.
Doesn't tell anything useful.
Hope You have identified the pairs for the coils.... Did You shift the polarity of just one coil?
Exactly what did that contain? Always power off when changing connections.
Not knowing that controller the guess is You must make it clear, step/dir running or VACTUAL... Never both at the same time.
Step/dir ought to be the most straight forward ans less difficult way.
You run 2 different coms through one SoftSerial. That can't be good.
Both motors are behaving the same way. Not just polarity, but every combination. What I meant is that I was careful in a way that I was sure the connections were correct.
I don't have a spare motor lying around unfortunately. Yes, I only use step/dir or VACTUAL.
You run 2 different coms through one SoftSerial. That can't be good.
Well I use one UART line, with different address for the drivers, it seems to work. Could this be a tuning issue? BTW, the motor windings are 5 ohm acc. to my multimeter, not 1.68 as per the datasheet, now I'm unsure if that's the right datasheet. But anyway, these motors ran fine with A4988.
Software serial runs on one Tx and one Rx defined as pins 15 and 14. Talking to 2 different UARTs...... it looks impossible to me. How are those Tx and Rx connected to pins 14 and 15?
Done during total power down I hope. Else..... serious trouble to expect.
That's interesting. Other members have been facing trouble running similar "high ohm" motors using exactly the same driver.
The A4988, or 8225, are quite different drivers but I can't point out any peculiar important fact that differs.
Software serial runs on one Tx and one Rx defined as pins 15 and 14. Talking to 2 different UARTs...... it looks impossible to me. How are those Tx and Rx connected to pins 14 and 15?
The rx is connected directly to driver's uart pin, while tx is connected to a 1 kohm resistor which in turn is connected to the uart pin, as per the datasheet.
My experience has been with a TMC2208 running in step/dir mode and and it was pretty quiet. If the motor was running fine with the A4988 but was too noisy, you may want to try the 2208 in step/dir instead of the 2209 in UART mode.