How to control my steper nema 17 with driver tb6560 via bluetooh

/*
Stepper Motor Control - one revolution

This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.

The motor should revolve one revolution in one direction, then
one revolution in the other direction.

Created 11 Mar. 2007
Modified 30 Nov. 2009
by Tom Igoe

*/

#include <Stepper.h>

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}

void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);

// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}

Ok, you will get faster help and make more friends if you follow the guidelines put forth in the how to get the most from the forum posts. Please read them. Use the autoformat tool in the IDE to format code then post the code in a block as described in the guidelines.

The posted code is pretty much a copy of the sweep example. Is your question about that?

If not, how can we help you?

The Stepper ibrary is blocking code for slower motors. If you work with steppers very long you will need a library that supports acceleration. MobaTools is my go to. >>

https://forum.arduino.cc/t/step per-motor-basics/275223

Control with Bluetooth isn't much different than controlling through a regular processor.

I have a 2D plotter that gets its commands wireessly. On the PC, I use my usual Gcode sender, bCNC, to send commands with an HC05 module. The commands go into the Uno (grbl controller) via another HC05 Bluetooth module running at 115200 baud. From there it is the same as hardwired.

What exactly are you hooking to pins 8-11? The tb6560 is a step-dir type driver, and though it can work, the stepper library is very inefficient to use with step-dir.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.