Hi there, I have been trying to build a stepper motor with a driver board that I have never tried.
I am using TMC2208. Currently I cannot make the motor work. My circuitry is the following:
A1:red of NEMA 17
A2: green of NEMA 17
B1: blue of NEMA 17
B2 : black of NEMA 17
STEP: pin 8 arduino
EN_PIN: pin 9 arduino
VM: + of external power battery (9V)
GND: - of external power battery (9V)
The code is down below
#define EN_PIN 9 // LOW: Driver enabled. HIGH: Driver disabled
#define STEP_PIN 8 // Step on rising edge
#include <TMC2208Stepper.h> // Include library
TMC2208Stepper driver = TMC2208Stepper(&Serial); // Create driver and use
// HardwareSerial0 for communication
void setup() {
Serial.begin(9600); // Init used serial port
while(!Serial); // Wait for port to be ready
// Prepare pins
pinMode(EN_PIN, OUTPUT);
pinMode(STEP_PIN, OUTPUT);
driver.pdn_disable(1); // Use PDN/UART pin for communication
driver.I_scale_analog(0); // Adjust current from the registers
driver.rms_current(500); // Set driver current 500mA
driver.toff(0x2); // Enable driver
digitalWrite(13, LOW); // Enable driver
}
void loop() {
digitalWrite(STEP_PIN, !digitalRead(STEP_PIN)); // Step
delay(10);
}
I would be happy if somebody can help on how I can make the motor work here. Thanks in advance
One thing that I see it your photo is that there is no connection between Vio on the driver and the Uno nor is there a connection between ground on the driver and ground on the Uno. Those are required connections.
And I think that I would connect the dir pin. If not to a GPIO pin then to Vcc or ground. I do not know what happens if that pin is allowed to float. Is there an internal pullup or pulldown? Unless you know for sure, it is unsafe to assume.
So I am trying to build the circuit above (in the link) now. I recently connected the ground of the TMC2208 to the ground of the arduino UNO. I also connected the VIO of TMC2208 to 5V of the arduino UNO. The Vmot, and GND (the other one) is connected to the external battery. I will use the DIR pin as well now. I am not sure if I am suppose to use the ENABLE PIN here.
I am quite confused with this driver board mainly because in the driver boards that I used previously there were H-bridges that I had to use. So for instance, there would be IN1, IN2, OUT1, OUT2 for the first H-bridge. Here, this seems to be different. Maybe, I am doing the connections for 1A, 1B, 2A, 2B wrong . Is it the case that 1A, 2A is for the first coil, and 2A, 2B for the second coil ?