I'm working on project using an Arduino Nano, TMC2208 driver and this stepper motor: https://www.oyostepper.com/images/upload/File/8HS15-0304S.pdf. I'm finding that the stepper starts rotating fine, but at a certain position stops moving and starts clicking. Before I crank up the VREF, I wanted to check with this group to see if I've done anything else stupid. I don't want to burn anything out by blindly cranking up the VREF.
The spot where it stops turning is the same no matter what. Without power, the spindle spins freely. I am not adding any load to the spindle yet, so it shouldn't be having a harder time moving something at any place in the revolution.
The wiring I'm using looks like this:
The code I'm using looks like the following:
#include "SimpleStepper.h"
void SimpleStepper::init() {
pinMode(_enablePin, OUTPUT);
pinMode(_directionPin, OUTPUT);
pinMode(_stepPin, OUTPUT);
digitalWrite(_directionPin, Direction::CW);
digitalWrite(_stepPin, LOW);
setEnabled(true);
}
void SimpleStepper::setDirection(Direction direction) {
digitalWrite(_directionPin, direction);
}
void SimpleStepper::setEnabled(bool enabled) {
digitalWrite(_enablePin, enabled ? LOW : HIGH);
}
void SimpleStepper::step() {
digitalWrite(_stepPin, HIGH);
delay(5);
digitalWrite(_stepPin, LOW);
}
#include <Arduino.h>
#include "SimpleStepper.h"
/*
https://fabacademy.org/2022/labs/kannai/Instruction/tips/stepper_TMC2208/
RMS Current = MAX CURRENT / 1.41
VREF = ((RMS Current x 2.5) / 1.77)
RMS Current = 0.3 / 1.41 = 0.212765957
VREF = (0.212765957 x 2.5) / 1.77) = 0.531914894 / 1.77 = 0.300516889
*/
#define EN_PIN 4
#define DIR_PIN 8
#define STEP_PIN 7
#define STEPS_PER_REVOLUTION 200
SimpleStepper stepper(EN_PIN, DIR_PIN, STEP_PIN);
void rotateFullRevolution() {
for (int i = 0; i < STEPS_PER_REVOLUTION; i++) {
stepper.step();
delay(100);
}
}
/**
* @brief Standard Arduino setup routine. Called once.
*/
void setup() {
Serial.begin(9600);
stepper.init();
stepper.setEnabled(true);
}
/**
* @brief Standard Arduino method called repeatedly
*/
void loop() {
stepper.setDirection(Direction::CW);
rotateFullRevolution();
stepper.setDirection(Direction::CCW);
rotateFullRevolution();
}
Thanks for any pointers!
Craig
