Hi, I am revamping a project and want to make sure my wiring and code look correct because the motor is not running. I want to run a Nema 17 stepper motor an arduino uno and a TMC2208 driver to run it. i added a potentimeter to control the speed of the motor.
#include <AccelStepper.h>
// Define the stepper motor and the pins that is connected to
AccelStepper stepper1(1, 2, 5); // (Type of driver: with 2 pins, STEP, DIR)
void setup() {
// Set maximum speed value for the stepper
stepper1.setMaxSpeed(1000);
}
void loop() {
stepper1.setSpeed((analogRead(A0)));
// Step the motor with a constant speed previously set by setSpeed();
stepper1.runSpeed();
}
switch away from using pin 1. Pins 0 and 1 are used for uploading you sketch, and for input and output using the serial monitor.
Never mind, I see after some "research" that the 1 is the type of interface. So now I get to complain about your not-schematic diagram, as it is unclear if you are using pins 2 and 5.
And verify the only thing that might still be wrong, which is exactly the four wires from the controller to the motor.
Also, the servo object comment says 2 pins, but the call has three.
Is that a sketch that worked before and now does not?
I apologise for the confusion. I am using pins 2 and 5. i ran the same code without calling 1 and it did not work. i also re-arranged the wiring from the motor to this configuration: M1B: red, M1A: blue, M2A: green, M2B: black. No i have not tested this sketch before i found in a tutorial. is it possible that the TMC2208 has been fried?
Nema17 is a size. What are the specifications on the motor current?
What is the brand and part number of the stepper?
If its a 1A per phase motor, you can verify that the motor will run unloaded by setting the pot as follows.
Very gently turn the pot to full ccw. The flat side of the pot should be facing the short edge of the driver board. Turn the pot 1/4 turn so the flat edge is facing the long side of the the board.
Motor Data Sheet
Since i wasnt able to directly link the data sheet here is some information before purchasing and the data sheet is linked at the bottom.