Simple stepper motor help, please.

Hi All,

I am still working on my little stepper motor project and am in need of some advice please.

I have bought these components and am struggling to get even the simplest of motion in the motor.

driver

motor1

motor2

power supply

in 12v, 10 amp.

I am using an uno to drive these with pul +5 conectted to 8 and -5 connected to ground

dir +5 connected to 9 and -5 connected to ground.

using this simple code:

#include <AccelStepper.h>


// Define a stepper and the pins it will use

AccelStepper stepper(1, 9, 8);


int pos = 3600;


void setup()

{  

 stepper.setMaxSpeed(3000);

 stepper.setAcceleration(1000);

}


void loop()

{

 if (stepper.distanceToGo() == 0)

 {

   delay(500);

   pos = -pos;

   stepper.moveTo(pos);

 }

 stepper.run();

}

I should be getting something I think but not getting anything at all! I don't know where I am going wrong so any suggestions would be a great help.

Thanks very much for reading this, sorry I couldn't figure out how to put the code in a "code box".

Craig

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

It will make it easier to read your code and understand your circuit.

Thanks.. Tom... :slight_smile:

Hi Tom, thanks for the help with code tags!

I knew they were there but just couldn't find them.....

I will post a quick pic of circuit directly, thanks for the advice and hellp.

Craig

This Simple Stepper Code may be useful for testing. It does not need any library.

...R
Stepper Motor Basics

Thank you Robin2,

I have read that one before starting this project but will go back and try and find my problem.

Here is a basic circuit drawing, maybe this will help?!?

Thanks,

Craig

I have not used this specific stepper driver, but I have used ones similar.

First, on the drivers I use, the + terminal on the dir, step, and enable pins are connected to +5V and the signals to drive go to the - terminal. Most I have seen have an internal pull up resistor in the optocouplers, so you pull them down to command, not up.

Second, if all of the dip switches on the micro stepping side are turned off, the unit is in Standby and will not move. Make sure the switch settings are correct.

Hi Nathan,

Dip switches are set right, have now got some drive from the nema 23 but the 17 is being weird, will rotate for a pass the just jitters for the second run. if I run it again it changes and runs fine....odd right?

Also the 17 has no torque to it, it just stops with almost no pressure.......

I will try conecting it the way you suggested and see how it goes!

Thanks,

Craig

I suspect it won't matter whether you connect dir + to 5v or dir - to GND but you may need to enable the driver and I don't know which way that should be connected.

...R

Ruitmexi:
Hi Nathan,

Dip switches are set right, have now got some drive from the nema 23 but the 17 is being weird, will rotate for a pass the just jitters for the second run. if I run it again it changes and runs fine....odd right?

Also the 17 has no torque to it, it just stops with almost no pressure.......

I will try conecting it the way you suggested and see how it goes!

Thanks,

Craig

You have set the current correctly for each motor?
You have connected the windings correctly for each motor?
You aren't trying to accelerate the motors to high speed with only 12V supply?
You have enabled the drive (EN+/- may need driving to enable, check any documentation).
You are using microstepping, not full steps? Without a full (mechanical) load full step settings are very prone
to resonance issues, microstepping less so.

Looking at your schematics: I don't know your driver, but you should, as @MarkT said, "enable" your driver.
Depending on your driver either connect ENABLE of your driver to GND or +5V.

If that (one of them) gets your stepper run, you could then control the stepper by connecting the enable-Pin of the controller to a free Arduino pin (declare that pin as OUTPUT) and control it by the sketch code - provided you don't need torque while the stepper has stopped.