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 the stepper motor to rotate at a certain angular degree

Required Reading Materials

Background Information

In this Laboratory, you will write 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 (Full-Step)

  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 (Half-Step)

  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 (Full-Step)

  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

  1. Create a new folder under the EE3450 folder, named it as Lab06_StepperMotor. Then start the Keil μVisio and create a new project, save the project inside the Lab06_StepperMotor folder.
  2. Copy-paste the following code to your main.c file.
  3. Modify the Setup_GPIO() function based on the Pin Configuration Table to configure the GPIO Pins..

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. You have to calculate the steps for 120 degrees from the data table of the stepper motor at the top of this lab.

There are three ways to implement the stepper motor control:

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.