Regarding TB6600 microstep driver and the AccelStepper library.

Hello, I was experimenting with a Nema 23 motor and a TB6600 microstepper driver along with the "Bounce" example from the AccelStepper library. I had wired up my components as shown here (scroll down a bit until you reach "Arduino and Stepper Motor Hookup" section). The only difference is that I'm not using a push button and a potentiometer, and also I hooked up the DIR- to pin 3 and PUL- to pin 5. I didn't connect the enable pins because I was following the example in the dronebotworkshop website. The gentleman suggested in the website that I didn't need to hook up the enable pins so that they are kept floating. I followed the instructions in the website exactly.

Upon turning on my power supply however, the motor won't rotate whatsoever. What could be the reason for this?

Thank you for any guidance :slight_smile:

nashsth:
(scroll down a bit until you reach "Arduino and Stepper Motor Hookup" section). The only difference is that I'm not using a push button and a potentiometer, and also I hooked up the DIR- to pin 3 and PUL- to pin 5.

Sorry but that's no help.

Just make a simple pencil drawing showing exactly how YOU have connected everything and post a photo of the drawing. The business of making the drawing may even throw up something you have missed.

I didn't connect the enable pins because I was following the example in the dronebotworkshop website. The gentleman suggested in the website that I didn't need to hook up the enable pins so that they are kept floating.

Maybe he was wrong. It would only take a few minutes to try it with the enable pin set HIGH or LOW.

If those ideas don't help then post your program.

In the meantime these links may be useful
Stepper Motor Basics
Simple Stepper Code

...R

Here is rough drawing of my setup: Imgur: The magic of the Internet

Here's the code:

// Bounce.pde
// -*- mode: C++ -*-
//
// Make a single stepper bounce from one limit to another
//
// Copyright (C) 2012 Mike McCauley
// $Id: Random.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $

#include <AccelStepper.h>

// Define a stepper and the pins it will use
AccelStepper stepper(1,3,4); // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
int EnPin = 2;

void setup()
{  
  // Change these to suit your stepper if you want
  pinMode(EnPin, OUTPUT);
  stepper.setMaxSpeed(100);
  stepper.setAcceleration(20);
  stepper.moveTo(500);
  digitalWrite(EnPin,HIGH);
}

void loop()
{
    // If at the end of travel go to the other end
    if (stepper.distanceToGo() == 0)
      stepper.moveTo(-stepper.currentPosition());

    stepper.run();
}

Image from Reply #2. See this Simple Image Guide

...R

It would be great if I didn't have to turn my laptop on its side to read the diagram.

As far as I can see the diagram says Enable is connected to 2, Pulse (or step) is connected to 4 and Direction is connected to 1.

Your program has

AccelStepper stepper(1,3,4)

which means that step is connected to 3 and direction is connected to 4

And you should not use Pin1 as that is needed for Serial and for uploading programs.

Your diagram has no GND connection to the stepper driver.

Try the example code in my link. It does not need any library. Make sure that the pin numbers match your own connections.

...R

Thank you for your response. I actually had connected the power supply ground to the arduino ground via a breadboard (which I neglected to draw; apologies for that -- I wanted to avoid cluttering the picture). This way, everything would be referenced to the same ground. My "3" happened to look like a "1" in the figure so I apologize for that as well. To clarify, pin 4 is connected to the PUL- pin, and Pin 3 is connected to the DIR- pin. Finally, pin 2 is connected to the EN- pin.

You were right that I mixed up the syntax for creating an AccelStep motor instant. In the website I linked, the gentleman stated that the way to create a stepper motor instance was to write AccelStepper mystepper(1,direction,step) whereas the actual code, according to this website is AccelStepper mystepper(1,step,direction)

Upon making the changes, my motor worked as expected.

Finally, the "1" in mystepper(1, step, direction) doesn't refer to a physical pin in the arduino -- instead, the "1" refers to the fact that I'm using a dedicated driver to drive my motor, and that the proper way to interface the AccelStep library with the driver is to use "1".

Thank you for your help! I will be sure to play around with your example code as well.

Thanks for the update. Good to hear it is working.

...R

nashsth:
Finally, the "1" in mystepper(1, step, direction) doesn't refer to a physical pin in the arduino -- instead, the "1" refers to the fact that I'm using a dedicated driver to drive my motor, and that the proper way to interface the AccelStep library with the driver is to use "1".

No, use the defined constant the library supplies for you:

AccelStepper mystepper (AccelStepper::DRIVER, step, direction) ;

MarkT:
No, use the defined constant the library supplies for you:

AccelStepper mystepper (AccelStepper::DRIVER, step, direction) ;

That is certainly the best way to use the library.

But, to avoid any confusion in the mind of the OP, the defined constant AccelStepper::DRIVER produces the value 1 which is why AccelStepper mystepper (1, step, direction) ; works

...R