DVR8825 assistance please

Hello all, I’m trying to run a stepper with the DVR8825. Below is my environment…

Arduino Uno
Stepper Motor: Bipolar 200 st/rev, 2.8V, 1.7A/phase(Pololu item #2267)
I have followed the directions to set the current limit by setting the voltage to 850mv.

The motor runs really well with this code…

int dirPin = 8; int stepperPin = 7; void setup() { TWBR = ((F_CPU /400000l) - 16) / 2; // Change the i2c clock to 400KHz //AFMS.begin(1000); // OR with a different frequency, say 1KHz pinMode(dirPin, OUTPUT); pinMode(stepperPin, OUTPUT); } void step(boolean dir,int steps){ digitalWrite(dirPin,dir); delay(50); for(int i=0;i<steps;i++){ digitalWrite(stepperPin, HIGH); delayMicroseconds(400); digitalWrite(stepperPin, LOW); delayMicroseconds(400); } } void loop(){ step(true,2000); delay(500); step(false,2000); delay(500); }

But it’s too slow for my application. I’ve tried tweaking this code but with little success So I next decided to use AccelStepper. With this code(below) my motor is capable of moving sufficiently. But it stalls, whines, skips etc. I have tweaked this code to death trying to make it work. Afresh set of eyes to look this over is much appreciated…

[code]//This is an example of how you would control 1 stepper

#include <AccelStepper.h>

int motorSpeed = 9600; //maximum steps per second (about 3rps / at 16 microsteps)
int motorAccel = 80000; //steps/second/second to accelerate

int motorDirPin = 8; //digital pin 8
int motorStepPin = 7; //digital pin 7

//set up the accelStepper intance
//the “1” tells it we are using a driver
AccelStepper stepper(1, motorStepPin, motorDirPin);

void setup(){
TWBR = ((F_CPU /400000l) - 16) / 2; // Change the i2c clock to 400KHz
//AFMS.begin(1000); // OR with a different frequency, say 1KHz

stepper.moveTo(4000); //move 32000 steps (should be 10 rev)

void loop(){

//if stepper is at desired location
if (stepper.distanceToGo() == 0){
//go the other way the same amount of steps
//so if current position is 400 steps out, go position -400

//these must be called as often as possible to ensure smooth operation
//any delay will cause jerky motion;



Does the AccelStepper library code work at slower speeds or acceleration rates? What happens when you try to make your initial code faster? What voltage are you using to power the stepper motor? Do you have a load on the motor?

This forum post has some useful tips for getting your stepper motor to run at faster speeds.


Thanks for your reply. Got it working. I was powering the motor with a breadboard connection. Changed it to a direct connection and it is functioning well now.