Tiva Lab 06: Stepper Motor Interface

Objective

  • Learn how to interface a stepper motor with a microcontroller
  • Learn how to drive a stepper motor
  • Learn how to calculate the number of steps for stepper motor to rotate at certain angular degree

Required Reading Materials

Background Information

In this Laboratory, you will write a firmware for generating digital TTL signals that can be used to provide the stepping sequence for a four-phase unipolar stepper motor in full-step mode.

Stepper Motor: 28BYJ-48

stepper motor controller uln2003 s

The 28BYJ-48 is a 5 Volt heared stepper motor. The detailed specs of the 28BYJ-48 stepper motor as shown as belows:

Motor Type Unipolar stepper motor
Connection Type 5 wire connection (to the motor controller): Blue, Pink, Yellow, Orange, Red
Voltage 5 Volts DC
Number of Phase 4
Operating Frequency (PPS) 100Hz
Step Mode Half-Step Mode : 8 step control signal sequence (recommended)
Full-Step Mode: 4 step control signal sequence
Step Angle Half-Step Mode: 5.625º per step / 64 steps per one revolution of the internal motor shaft.
Full-Step Mode: 11.25º per step / 32 steps per one revolution of the internal motor shaft
Gear ratio Manufacturer specifies: 64:1
Experimental result: 63.68395:1
Full revolution = steps per motor rotation x gear ratio
For half-step: 64 step per motor rotation x 63.68395 gear ratio ≒ 4076 steps per full revolution
Step Angle (1-2 phase) 5.625º / 64

Step Sequence

The 28BYJ-48 is an Unipolar Stepper Motor. It has 4 coils of wire that are powered in a sequence to make the magnetic motor shaft spin. When using the full-step method, 2 of the 4 coils are powered at each step. For the half-step mode, the first step is to power coil 1,  then coil 1 and 2 together, then coil 2 only, and so on.. With 4 ciols, the half-step mode has 8 different signals. The following tabls show the steps for half- and full-step mode.

WAVE DRIVE: 1-Phase at a Time

  A
IN4
B
IN3
C
IN2
D
IN1
Step 1 X      
Step 2   X    
Step 3     X  
Step 4       X

Simplest, but least used.

HALF STEP: 1 or 2 Phase at a Time

  A
IN4
B
IN3
C
IN2
D
IN1
Step 1 X      
Step 2 X X    
Step 3   X    
Step 4   X X  
Step 5     X  
Step 6     X X
Step 7       X
Step 8 X     X

Smallest step angle. Medium torque.

FULL STEP: 2 Phases at a Time

  A
IN4
B
IN3
C
IN2
D
IN1
Step 1 X X    
Step 2   X X  
Step 3     X X
Step 4 X     X

Strongest torque.

 

 

 

In this lab, you need to complete the firmware code to control a stepper motor.

Required Component List

Stepper Motor x 1
ULN2003 Stepper Motor Driver Module x 1
breadboard power s Power Supply Module x 1
breadboard s Breadboard x 1

Circuit/Schematic Diagram

The stepper motor used in this lab is the 28BYJ-48, with gear reduction, hence provides relatively good torque but slow rotation. The ULN2003A is a Darlington high current transistor array, which is used to drive the 5v stepper motor. The following diagrams are schematic of the internal coils of this stepper motor and how each coil connects to the ULN2003A for each Tiva LaunchPad board. It is crucial that these coils are connected to the right output of the ULN2003A, to ensure correct sequencing.

Procedure

Configurations

Write down the following configuration information into your lab report.

Lab Experiments

Write a firmware code by using FULL STEP (2-Phases at a Time) to control the stepper motor rotates 120 degrees from left to right by sending sequence data from an array, which stores full step encoded values.

Questions

  1. A 10° per step stepper motor is given 60 steps clockwise (CW) and 15 steps in counter clockwise (CCW). Assuming it started at 0°, calculate the final position in degree.
  2. Redesign the stepper motor controller using full-step method and add SW1 into the system. The repeating sequence step1, step2, step3, step4,… moves it clockwise (CW) and the repeating sequence step4, step3, step2, step1, … moves it counter clockwise (CCW). The delay between writes determines the speed of the motor. Assume a constant speed of the motor with time between writes of 50ms (using timer_waitMillis() hardware delay function). If user presses SW1, then stepper motor moves to CCW, otherwise it is CW. Design a Moore State Machine with four states that takes a single input SW1 (0: CCW; 1: CW) and four outputs.
    1. Give the State Graph for the stepper motor.
    2. Complete the code below by adding state #define and FSM array entries and the FSM loop

Exercises