Interfacing arduino <AccelStepper.h> library with driver for stepper motor


#1

welcome to my post

i am not getting that how i can get info about interfacing of my driver board with arduino mega.This board is using STK672-080 driver.4 Motors are being used and are unipolar.This driver board has 4 inputs
1-CLK
2-DIR
3-ENA
4-GND
signal from arduino will be received at these inputs.same driver and arduino has been used to drive single motor using simple stepper motor library.
Now i want to use <AccelStepper.h> library for driving 4 seperate motors with separate similar driver card for each motor.I think i have option of using <AccelStepper.h> library only.
one simple code of stepper with this multi stepper library is given below

// MultiStepper.pde
// -- mode: C++ --
//
// Shows how to multiple simultaneous steppers
// Runs one stepper forwards and backwards, accelerating and decelerating
// at the limits. Runs other steppers at the same time
//
// Copyright © 2009 Mike McCauley
// Id: HRFMessage.h,v 1.1 2009/08/15 05:32:58 mikem Exp mikem

#include <AccelStepper.h>

// Define some steppers and the pins the will use
AccelStepper stepper1; // Defaults to 4 pins on 2, 3, 4, 5
AccelStepper stepper2(4, 6, 7, 8, 9);
AccelStepper stepper3(2, 10, 11);

void setup()
{
stepper1.setMaxSpeed(200.0);
stepper1.setAcceleration(100.0);
stepper1.moveTo(24);

stepper2.setMaxSpeed(300.0);
stepper2.setAcceleration(100.0);
stepper2.moveTo(1000000);

stepper3.setMaxSpeed(300.0);
stepper3.setAcceleration(100.0);
stepper3.moveTo(1000000);
}

void loop()
{
// Change direction at the limits
if (stepper1.distanceToGo() == 0)
stepper1.moveTo(-stepper1.currentPosition());
stepper1.run();
stepper2.run();
stepper3.run();
}

the point is which pins of arduino i have to attach with my driver input pins named as below
1-CLK
2-DIR
3-ENA
4-GND

Thnx in advance for responce


#2

I believe AccelStepper.h is specifically for driving stepper motors directly- it generates a stepper waveform on the 4 pins given that energises the coils in sequence to rotate the rotor one way or another.

The driver, by comparison, works in a completely different way. Without actually looking it up I’d guess that it steps a motor with every pulse of the “clock” (clk) pin. The dir pin controls the step direction and the en (enable) pin determines if the driver will respond to signals on the other pins.

You can share the clock, enable and direction pins between multiple stepper drivers depending on whether you want to control them individually or in groups.

You’ll have to find some new code to drive them though, since AcccelStepper is probably for direct drive only.


#3

Thnx for responce

So that means arduino will directly provide the current for driving all four steppers at different speed and acceleration…is that possible for arduino to provide high current drive signal of motor


#4

The drivers should be providing the current in this case- the Arduino will only provide control signals. It really shouldn’t be used to drive steppers directly.