Bipolar Stepper Motors don't always turn correctly


hey guys,

   so i'm using 2 four-wire bipolar stepper motors 2 a4988 drivers , arduino nano. these motors act left , right motor @ of robot, swivel wheel @ front. arduino connected hc-06 bluetooth module, hope control motors with. i've written code robot:
code: [select]
#include <stepper.h>
#include <softwareserial.h>

char a;
const int stepl = 3;
const int dirl = 4;
const int stepr = 5;
const int dirr = 6;
const int tx = 9;
const int rx = 10;

stepper lm(200,stepl,dirl);
stepper rm(200,stepr,dirr);
softwareserial bt(tx,rx);

void setup() {
  bt.begin(9600);
  bt.println("start");
  lm.setspeed(120);
  rm.setspeed(120);
}

void loop() {
  if (bt.available()) {
    = (bt.read());
    if (a == 'd') { //backward
      while (a != 'd') {
        = (bt.read());
        lm.step(2);
        rm.step(-2);
      }
    }
    if (a == 'e') { //forward
      while (a != 'e') {
        = (bt.read());
        lm.step(-2);
        rm.step(2);
      }
    }
    if (a == 'b') { //right
      while (a != 'b') {
        = (bt.read());
        lm.step(2);
      }
    }
    if (a == 'c') { //left
      while (a != 'c') {
        = (bt.read());
        rm.step(-2);
      }
    }
  }
}

   this code should allow me send bluetooth commands phone arduino start , stop stepper motors. however, robot's motors 'twitch' when send command, rather running. if notice in void setup(), set speed both motors. when value around 60, robot runs near perfectly. however, increase value robot's movement continues worsen , worsen until robot twitches in place.
   when robot twitching, if give robot push in direction it's trying go, starts moving in direction smoothly. also, if lift robot off ground, wheels start moving correctly.
   my guess motors don't have enough power move, adjusted current limit on drivers correct amount. perhaps looking @ wrong manual? or have overlooked major flaw in circuit design? appreciated. thank you!

quote
my guess motors don't have enough power move, adjusted current limit on drivers correct amount.
that first thought, too. didn't mention powering stepper motors. stepper motors need lot of current. extremely used batteries.


Arduino Forum > Topics > Robotics (Moderator: fabioc84) > Bipolar Stepper Motors don't always turn correctly


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts