Steppin’ on out

Preamble

OK, so once I cleared my initial confusion between stepper motors and servos, I ended up having to look into stepper motors – as well as servos, which are covered in the servo expedition. They is also another blog on the different topic of geared d.c motors, so you may wish to check that out as well.

Video Tutorials

First off is a video, #4 5v stepper motors from eBay… as cheap as chips… 28BYJ-48 + ULN2003 Driver, about five cheap stepper motors, and the ULN2003 driver boards, from eBay, and a useful piece of Arduino code.

The code
#define IN1  8
#define IN2  9
#define IN3  10
#define IN4  11
int Steps = 4096; //4096 or 768
int cstep = 0;

void setup()
{
  Serial.begin(9600);
  pinMode(IN1, OUTPUT); 
  pinMode(IN2, OUTPUT); 
  pinMode(IN3, OUTPUT); 
  pinMode(IN4, OUTPUT); 
}

void loop()
{
  for(int x=0;x<Steps;x++)
  {
  step1();
  //delay(1);
  delayMicroseconds(900);
  }
  Serial.println("Boom!!");
  delay(1000);
  
}

void step1()
{
  //stepp
  switch(cstep)
  {
   case 0:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, HIGH);
   break; 
   case 1:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, HIGH);
     digitalWrite(IN4, HIGH);
   break; 
   case 2:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, HIGH);
     digitalWrite(IN4, LOW);
   break; 
   case 3:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, HIGH);
     digitalWrite(IN3, HIGH);
     digitalWrite(IN4, LOW);
   break; 
   case 4:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, HIGH);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
   break; 
   case 5:
     digitalWrite(IN1, HIGH); 
     digitalWrite(IN2, HIGH);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
   break; 
     case 6:
     digitalWrite(IN1, HIGH); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
   break; 
   case 7:
     digitalWrite(IN1, HIGH); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, HIGH);
   break; 
   default:
     digitalWrite(IN1, LOW); 
     digitalWrite(IN2, LOW);
     digitalWrite(IN3, LOW);
     digitalWrite(IN4, LOW);
   break; 
  }
   
   cstep=cstep+1;
   if(cstep==8)
     {cstep=0;}
}

However, this is not a particularly good tutorial, instead it shows common noobie errors. The main issue is that an external power supply is required to power the motors. There is also a brief blog, 28BYJ-48 Stepper motors + ULN2003 Drivers.

A useful tutorial from Adafruit, states the following:

What are stepper motors good for?

  • Positioning – Since steppers move in precise repeatable steps, they excel in applications requiring precise positioning such as 3D printers, CNC, Camera platforms and X,Y Plotters. Some disk drives also use stepper motors to position the read/write head.
  • Speed Control – Precise increments of movement also allow for excellent control of rotational speed for process automation and robotics.
  • Low Speed Torque – Precise increments of movement also allow for excellent control of rotational speed for process automation and robotics.

What are their limitations?

  • Low Efficiency – Unlike DC motors, stepper motor current consumption is independent of load. They draw the most current when they are doing no work at all. Because of this, they tend to run hot.
  • Limited High Speed Torque – In general, stepper motors have less torque at high speeds than at low speeds. Some steppers are optimized for better high-speed performance, but they need to be paired with an appropriate driver to achieve that performance.
  • No Feedback – Unlike servo motors, most steppers do not have integral feedback for position. Although great precision can be achieved running ‘open loop’. Limit switches or ‘home’ detectors are typically required for safety and/or to establish a reference position.

A video intro: Stepper and DC Motor Control With Arduino – Let’s Make It – Episode 36 – Tech-Zen.tv – Alixa.tv

This video from BrainyBits, Controlling Stepper Motors with a PIC Microcontroller, uses the EasyDriver, which are a quid on eBay. The stepper motor is a 4 wire bipolar type

Stepper Motor types

There are many different types of stepper motors, but they fall into various types of categories:

  • Unipolar or;
  • Bipolar

Also, the number of wires that are used to control them differ as well, with common types being:

  • 4 wire
  • 5 wire, or;
  • 6 wire

Popular stepper motors include the 28BYJ-48

28BYJ-48 stepper motor
28BYJ-48 stepper motor

and the Nema types

Nema type stepper motor
Nema type stepper motor

EasyDriver

Specification: 

The EasyDriver is a simple to use stepper motor driver, compatible with anything that can output a digital 0 to 5V pulse (or 0 to 3.3V pulse if you solder SJ2 closed on the EasyDriver). EasyDriver requires a 7V to 30V supply to power the motor and can power any voltage of stepper motor. The EasyDriver has an on board voltage regulator for the digital interface that can be set to 5V or 3.3V. Connect a 4-wire stepper motor and a microcontroller and you’ve got precision motor control! EasyDriver drives bi-polar motors, and motors wired as bi-polar. I.e. 4, 6, or 8 wire stepper motors. On this version (v4.4) we fixed the silk error on the min/max adjustment.

Features:

  • A3967 microstepping driver;
  • MS1 and MS2 pins broken out to change microstepping resolution to full, half, quarter and eighth steps (defaults to eighth);
  • Compatible with 4, 6, and 8 wire stepper motors of any voltage;
  • Adjustable current control from 150mA/phase to 750mA/phase;
  • Power supply range from 7V to 30V. The higher the voltage, the higher the torque at high speeds.
  • Board Size: 47mm x 20mm/1.85″ x 0.78″ (Approx.)
  • Pin Header Size: 51mm x 11mm/2.0″ x 0.43″ (Approx.)

Demo Video: http://v.youku.com/v_show/id_XNTc0MDUxNjY0.html

Notice:
Don’t connect or disconnect a motor while the driver is energized. This will cause permanent damage to the A3967 IC.

ULN2003

Another popular stepper motor controller is the ULN2003, which is, basically, a Darlington array.

ULN2003 Schematic
ULN2003 Schematic

These are often used in conjunction with the 5 wire Unipolar 28BYJ-48 Stepper motor. Five of these along with the controllers are around £7.20 on eBay.

Here is a very good, and in depth, Microsoft tutorial, that goes into the phases as well as wave drive (simple but low torque), full step (more torque) and half step (greater precision, medium torque) methods.

Another video, looking at the internals

And yet another disassembly video, which explains that the 28BYJ-48 is commonly used for ventilator louvres. It also recommends that the ULN2003 using the DIP Darlington array is a better choice, should the array ever suffer a mishap, it can be easily replaced..

PIC

As an aside, if you are into PICs and assembler then this video is most interesting. Using a PIC12F675 and a Nema 8/11/14/17/23 4 wire Bipolar type stepper.

Other videos

This video, Stepper motor 28BYJ-48 torque test, shows how to measure the torque of a stepper motor, uses a rod of a known length, and a known weight. One could just use a rod and a set of electronic kitchen scales

A very informative video, 28BYJ-48 Stepper Motor and ULN2003 Driver Intro, from a Microsoft engineer. This video explains the internals (greas and coils) of the stepper.

One more tutorial, this one is from GreatScott

3 thoughts on “Steppin’ on out”

Leave a comment