Difference between revisions of "Stepper Motor 5V 4-Phase 5-Wire & ULN2003 Driver Board for Arduino"

From Geeetech Wiki
Jump to: navigation, search
(Note)
Line 1: Line 1:
 
==Stepper Introduction==
 
==Stepper Introduction==
 +
[[File:Stepper motor.jpg|300px]] [[File:Stepper motor 1.jpg|300px]]
  
 
A stepper motor is an electromechanical device which converts electrical pulses into
 
A stepper motor is an electromechanical device which converts electrical pulses into
Line 22: Line 23:
 
# The motors response to digital input pulses provides open-loop control, making the motor simpler and less costly to control.
 
# The motors response to digital input pulses provides open-loop control, making the motor simpler and less costly to control.
 
# It is possible to achieve very low speed synchronous rotation with a load that is directly coupled to the shaft.
 
# It is possible to achieve very low speed synchronous rotation with a load that is directly coupled to the shaft.
# A wide range of rotational speeds can be realized as the speed is proportional to the frequency of the input  
+
# A wide range of rotational speeds can be realized as the speed is proportional to the frequency of the input pulses.
 
 
pulses.
 
  
 
==Stepper motor 28BYJ-48 Parameters==
 
==Stepper motor 28BYJ-48 Parameters==
Line 46: Line 45:
 
*Noise  <35dB(120Hz,No load,10cm)
 
*Noise  <35dB(120Hz,No load,10cm)
 
   
 
   
 +
==Interfacing circuits==
 +
[[File:Stepper wiring.jpg]]
  
==Interfacing circuits==
 
 
The bipolar stepper motor usually has four wires coming out of it. Unlike unipolar steppers, bipolar steppers have no common center connection. They have two independent sets of coils instead. You can distinguish them from unipolar steppers by measuring the resistance between the wires. You should find two pairs of wires with equal resistance. If you’ve got the leads of your meter connected to two wires that are not connected (i.e. not attached to the same coil), you should see infinite resistance (or no continuity).
 
The bipolar stepper motor usually has four wires coming out of it. Unlike unipolar steppers, bipolar steppers have no common center connection. They have two independent sets of coils instead. You can distinguish them from unipolar steppers by measuring the resistance between the wires. You should find two pairs of wires with equal resistance. If you’ve got the leads of your meter connected to two wires that are not connected (i.e. not attached to the same coil), you should see infinite resistance (or no continuity).
 +
 +
[[File:ULN2003.jpg|300px]]
  
 
The simplest way of interfacing a unipolar stepper to Arduino is to use a breakout for ULN2003A transistor array chip. The ULN2003A contains seven darlington transistor drivers and is somewhat like having seven TIP120 transistors all in one package. The ULN2003A can pass up to 500 mA per channel and has an internal voltage drop of about 1V when on. It also contains internal clamp diodes to dissipate voltage spikes when driving inductive loads.To control the stepper, apply voltage to each of the coils in a specific sequence.  
 
The simplest way of interfacing a unipolar stepper to Arduino is to use a breakout for ULN2003A transistor array chip. The ULN2003A contains seven darlington transistor drivers and is somewhat like having seven TIP120 transistors all in one package. The ULN2003A can pass up to 500 mA per channel and has an internal voltage drop of about 1V when on. It also contains internal clamp diodes to dissipate voltage spikes when driving inductive loads.To control the stepper, apply voltage to each of the coils in a specific sequence.  
Line 54: Line 56:
 
The sequence would go like this:
 
The sequence would go like this:
  
 +
[[File:Stepper sequence.jpg]]
 
Here are schematics showing how to interface a unipolar stepper motor to four controller pins using a ULN2003A, and showing how to interface using four TIP120's.  
 
Here are schematics showing how to interface a unipolar stepper motor to four controller pins using a ULN2003A, and showing how to interface using four TIP120's.  
 +
 +
[[File:Stepper schematic.jpg|600px]]
 +
 +
[[File:Stepper and ULN2003.jpg|600px]]
 +
  
 
==Example code==
 
==Example code==
 
===Code===
 
===Code===
 
+
#include <Stepper.h>
 +
// change this to the number of steps on your motor
 +
#define STEPS 100
 +
// create an instance of the stepper class, specifying
 +
// the number of steps of the motor and the pins it's
 +
// attached to
 +
Stepper stepper(STEPS, 8, 9, 10, 11);
 +
// the previous reading from the analog input
 +
int previous = 0;
 +
void setup()
 +
{
 +
  // set the speed of the motor to 30 RPMs
 +
  stepper.setSpeed(30);
 +
}
 +
void loop()
 +
{
 +
  // get the sensor value
 +
  int val = analogRead(0);
 +
  // move a number of steps equal to the change in the
 +
  // sensor reading
 +
  stepper.step(val - previous);
 +
  // remember the previous value of the sensor
 +
  previous = val;
 +
}
  
 
===Stepper library===
 
===Stepper library===
Line 66: Line 97:
  
 
Arduino Example Code Notes :
 
Arduino Example Code Notes :
#The example code assumes that the stepper is being controlled by Arduino pins 8, 9, 10 and 11, but you can use any  
+
#The example code assumes that the stepper is being controlled by Arduino pins 8, 9, 10 and 11, but you can use any set of four pins.  
 
+
#The "#define STEPS 100" line defines the number of steps per rev. A 3.75 deg motor has 96 steps/rev while a 7.2 deg motor has 48 steps/rev.  
set of four pins.  
 
#The "#define STEPS 100" line defines the number of steps per rev. A 3.75 deg motor has 96 steps/rev while a 7.2  
 
 
 
deg motor has 48 steps/rev.  
 
 
#The "Stepper stepper(STEPS, 8, 9, 10, 11)" line is where you enter the four pins used to control the stepper.  
 
#The "Stepper stepper(STEPS, 8, 9, 10, 11)" line is where you enter the four pins used to control the stepper.  
 
#The "stepper.setSpeed(x)" command sets the motor speed to x rpm.  
 
#The "stepper.setSpeed(x)" command sets the motor speed to x rpm.  
#The "stepper.step(x)" command turns the motor x steps at the speed last set in the stepper.setSpeed() command. The  
+
#The "stepper.step(x)" command turns the motor x steps at the speed last set in the stepper.setSpeed() command. The motor turns one direction for postive x and the reverse direction for negative x.
 +
 
 +
==Document==
 +
*[http://www.geeetech.com/Documents/Stepper%20motor%20basic.pdf Stepper motor basic]
 +
*[http://www.geeetech.com/Documents/Stepper%20motor%20datasheet.pdf Stepper Motor Datasheet]
 +
*[http://www.geeetech.com/Documents/ULN2003%20datasheet.pdf ULN2003 Datasheet]
  
motor turns one direction for postive x and the reverse direction for negative x.
+
==Reference Materials==
  
==Document==
 
[Stepper Motor Datasheet]
 
[ULN2003 Datasheet]
 
[Arduino Stepper library]
 
  
 
==How to buy==
 
==How to buy==
Click here to buy [5V 4-Phase 5-Wire Stepper Motor] and [Stepper Motor Driver Board ULN2003 for Arduino]
+
Click here to buy [http://www.geeetech.com/5v-4phase-5wire-stepper-motor-p-368.html 5V 4-Phase 5-Wire Stepper Motor] and [http://www.geeetech.com/stepper-motor-driver-board-uln2003-for-arduino-p-428.html Stepper Motor Driver Board ULN2003 for Arduino]

Revision as of 09:54, 31 May 2012

Stepper Introduction

Stepper motor.jpg Stepper motor 1.jpg

A stepper motor is an electromechanical device which converts electrical pulses into discrete mechanical movements. The shaft or spindle of a stepper motor rotates in discrete step increments when electrical command pulses are applied to it in the proper sequence. The motors rotation has several direct relationships to these applied input pulses. The sequence of the applied pulses is directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the frequency of the input pulses and the length of rotation is directly related to the number of input pulses applied.One of the most significant advantages of a stepper motor is its ability to be accurately controlled in an open loop system. Open loop control means no feedback information about position is needed. This type of control eliminates the need for expensive sensing and feedback devices such as optical encoders. Your position is known simply by keeping track of the input step pulses.

Features

  1. The rotation angle of the motor is proportional to the input pulse.
  2. The motor has full torque at standstill(if the windings are energized)
  3. Precise positioning and repeatability of movement since good stepper motors have an accuracy of
  4. – 5% of a step and this error is non cumulative from one step to the next.
  5. Excellent response to starting/stopping/reversing.
  6. Very reliable since there are no contact brushes in the motor. Therefore the life of the motor is simply dependant on the life of the bearing.
  7. The motors response to digital input pulses provides open-loop control, making the motor simpler and less costly to control.
  8. It is possible to achieve very low speed synchronous rotation with a load that is directly coupled to the shaft.
  9. A wide range of rotational speeds can be realized as the speed is proportional to the frequency of the input pulses.

Stepper motor 28BYJ-48 Parameters

  • Model : 28BYJ-48
  • Rated voltage : 5VDC
  • Number of Phase : 4
  • Speed Variation Ratio : 1/64
  • Stride Angle : 5.625° /64
  • Frequency : 100Hz
  • DC resistance : 50Ω±7%(25℃)
  • Idle In-traction Frequency : > 600Hz
  • Idle Out-traction Frequency : > 1000Hz
  • In-traction Torque >34.3mN.m(120Hz)
  • Self-positioning Torque >34.3mN.m
  • Friction torque : 600-1200 gf.cm
  • Pull in torque : 300 gf.cm
  • Insulated resistance >10MΩ(500V)
  • Insulated electricity power :600VAC/1mA/1s
  • Insulation grade :A
  • Rise in Temperature <40K(120Hz)
  • Noise <35dB(120Hz,No load,10cm)

Interfacing circuits

Stepper wiring.jpg

The bipolar stepper motor usually has four wires coming out of it. Unlike unipolar steppers, bipolar steppers have no common center connection. They have two independent sets of coils instead. You can distinguish them from unipolar steppers by measuring the resistance between the wires. You should find two pairs of wires with equal resistance. If you’ve got the leads of your meter connected to two wires that are not connected (i.e. not attached to the same coil), you should see infinite resistance (or no continuity).

ULN2003.jpg

The simplest way of interfacing a unipolar stepper to Arduino is to use a breakout for ULN2003A transistor array chip. The ULN2003A contains seven darlington transistor drivers and is somewhat like having seven TIP120 transistors all in one package. The ULN2003A can pass up to 500 mA per channel and has an internal voltage drop of about 1V when on. It also contains internal clamp diodes to dissipate voltage spikes when driving inductive loads.To control the stepper, apply voltage to each of the coils in a specific sequence.

The sequence would go like this:

Stepper sequence.jpg Here are schematics showing how to interface a unipolar stepper motor to four controller pins using a ULN2003A, and showing how to interface using four TIP120's.

Stepper schematic.jpg

Stepper and ULN2003.jpg


Example code

Code

#include <Stepper.h>
// change this to the number of steps on your motor
#define STEPS 100
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 8, 9, 10, 11);
// the previous reading from the analog input
int previous = 0;
void setup()
{
 // set the speed of the motor to 30 RPMs
 stepper.setSpeed(30);
}
void loop()
{
 // get the sensor value
 int val = analogRead(0);
 // move a number of steps equal to the change in the
 // sensor reading
 stepper.step(val - previous);
 // remember the previous value of the sensor
 previous = val;
}

Stepper library

The Arduino programming environment comes with a function library for controlling a stepper motor. To use the library, in the Arduino Editor from the top menu bar: Sketch > Import Library > Stepper. Copy the example code below into an Arduino program.

Arduino Example Code Notes :

  1. The example code assumes that the stepper is being controlled by Arduino pins 8, 9, 10 and 11, but you can use any set of four pins.
  2. The "#define STEPS 100" line defines the number of steps per rev. A 3.75 deg motor has 96 steps/rev while a 7.2 deg motor has 48 steps/rev.
  3. The "Stepper stepper(STEPS, 8, 9, 10, 11)" line is where you enter the four pins used to control the stepper.
  4. The "stepper.setSpeed(x)" command sets the motor speed to x rpm.
  5. The "stepper.step(x)" command turns the motor x steps at the speed last set in the stepper.setSpeed() command. The motor turns one direction for postive x and the reverse direction for negative x.

Document

Reference Materials

How to buy

Click here to buy 5V 4-Phase 5-Wire Stepper Motor and Stepper Motor Driver Board ULN2003 for Arduino