Close

Stepper Motor to Drive Wheels

A project log for Roamer, the Self Charging Companion Robot

Roamer is a self-charging, switch free, capacitor powered, wandering robot companion.

mike-rigsbyMike Rigsby 08/28/2021 at 16:370 Comments

Now I'm trying a thin Nema 17 stepper motor to replace the geared dc wheel driver motor--it works!

I'm driving the motor with an Arduino motor shield--motor pin 1 to B-; motor pin 4 to B+; motor pin 6 to A-; motor pin 3 to A+.

Code (stepper motor short) follows:

int delaylength=10;
int volt=220;

void setup() {
  pinMode(12,OUTPUT);
  pinMode(13,OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(8,OUTPUT);

}

void loop() {

  //round 1
  digitalWrite(9,LOW);
  digitalWrite(8,HIGH);

  digitalWrite(12,HIGH);
  analogWrite(3,volt);

  delay(delaylength);
 

  digitalWrite(9,HIGH);
  digitalWrite(8,LOW);

  digitalWrite(13,LOW);
  analogWrite(11,volt);

  delay(delaylength);

 digitalWrite(9,LOW);
  digitalWrite(8,HIGH);

  digitalWrite(12,LOW);
  analogWrite(3,volt);

  delay(delaylength);

  digitalWrite(9,HIGH);
  digitalWrite(8,LOW);

  digitalWrite(13,HIGH);
  analogWrite(11,volt);

  delay(delaylength); 

//end round 1

}

I supplied 10 volts dc with one amp capacity to the motor shield power input.

Discussions