Interaction Design WikiElectrical Engineering

Stepper Motor Drivers

Schrittmotorentreiber (DE version)

A stepper motor is special type of motor based on individually controllable coils. By applying voltage to these coils, the motor can be moved one step to the left or right. The advantage of a stepper motor compared to a conventional motor is the precise control of the individual steps as well as higher torque. Stepper motors are typical found in printers, CD-ROM drives, CNC machines, 3D printers etc.

The accuracy of the motor is specified in the data sheets with degrees (°) per step and thus defines how many steps a motor needs for a complete revolution or other angles (e.g. 45° or 180°). Since we can program the precise number of steps, and we know the angle of each step, we can know the exact angle of the motor at all times. However, if the motor and/or Arduino is turned off or if the axel is physical forced miss steps, then we loose the position. Most applications solve this problem with an end-stop to find the start position, or use an additional rotatory encoder to read the angle. 


A basic distinction is made between unipolar and bipolar stepper motors. We will just look at bipolar motors, specifically the SM-42BYG011-25.

Bipolar steppers


A bipolar stepper is usually connected via four cables. Just like most conventional motors, steppers require a higher voltage and current than we can provide with the Arduino. The information about the required voltage can be found in the data sheet. The motors we use require 12V. In order to control a bipolar stepper, the individual coils are switched in a specific sequence.


Pololu A4988

The Pololu A4988 is a breakout board for the Allegro A4988 stepper driver (Data-sheet). It makes controlling stepper motors pretty easy because it can be controlled with just two pins on the Arduino. These two pins are STEP and DIR. As the names might suggest, a transition  from logical LOW to logical HIGH on the STEP pin will step the motor and a logical HIGH or LOW on the DIR pin will change the direction of the stepper.

Beispiel

1x Arduino
1x Pololu A4988 (Website)
1x Stepper Motor (Data-sheet

Stepper Example Expand source
#define STEP_PIN 8
#define DIR_PIN 9
void setup() 
{
  pinMode(STEP_PIN, OUTPUT);
  pinMode(DIR_PIN, OUTPUT);
}
void loop() 
{
  digitalWrite(DIR_PIN, HIGH);
  
  for(int i=0; i<200; i++)
  {
    digitalWrite(STEP_PIN, HIGH);
    delay(10);
    digitalWrite(STEP_PIN, LOW);
    delay(10);
  }
  
  digitalWrite(DIR_PIN, LOW);
  
  for(int i=0; i<200; i++)
  {
    digitalWrite(STEP_PIN, HIGH);
    delay(10);
    digitalWrite(STEP_PIN, LOW);
    delay(10);
  }
}


Further Information

Stepper Motors – Wikipedia Page