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-wire unipolar stepper motor that runs on 5 volts. The detailed specs of the 28BYJ-48 stepper motor are shown below:

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 Phases 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 revolution of the internal motor shaft.
Full-Step Mode: 11.25º per step / 32 steps per revolution of the internal motor shaft
Gear ratio The manufacturer specifies: 64:1
Experimental result: 63.68395:1
Full revolution = steps per motor rotation x gear ratio
For half-step: 64 steps 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 a Unipolar Stepper Motor. It has 4 coils of wire that are powered sequentially 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 coils, the half-step mode has 8 different signals. The following table shows the steps for half- and full-step modes.

WAVE DRIVE: 1-Phase at a Time (Full-Step)

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

Simplest, but least used.

HALF STEP: 1 or 2 Phases at a Time (Half-Step)

A
IN4
B
IN3
C
IN2
D
IN1
Step 0 X
Step 1 X X
Step 2 X
Step 3 X X
Step 4 X
Step 5 X X
Step 6 X
Step 7 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 0 X X
Step 1 X X
Step 2 X X
Step 3 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 Breadboard Power Supply Module x 1
Power Adapter 9V/2A 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 providing relatively good torque but slow rotation. The ULN2003A is a Darlington high current transistor array used to drive the 5v stepper motor. The following diagrams are schematics of the internal coils of this stepper motor and how each coil connects to the ULN2003A for each Tiva LaunchPad board. These coils must be connected to the right output of the ULN2003A to ensure correct sequencing.

EK-TM4C123G LaunchPad - Circuit

StepperMotor 123G s

Device IN4 IN3 IN2 IN1
Port.Pin PC7 PC6 PC5 PC4

Pin Configurations

DevicePort.Pin Signal TypePCTLDirectionDrive Mode

Procedure

  1. Create a new folder under the EE3450 folder and name it Lab06_StepperMotor.
  2. Launch the Keil μVisio and create a new project. Save the project to the project folder you just created in the previous step and set the project name to Lab06_StepperMotor.
  3. Add the Common folder to the include paths which is under the "Options for Target" setting.

Configurations

Example Source Code

Lab Experiments

Write a firmware code to control the stepper motor rotation:

  • When SW1 and SW2 are pressed simultaneously, the stepper motor rotates 90 degrees clockwise
  • When SW1 is pressed, the stepper motor rotates 5 steps clockwise (CW)
  • When SW2 is pressed, the stepper motor rotates 5 steps counterclockwise (CCW)

You will have to calculate the number of steps required to rotate 90 degrees from the stepper motor data sheet 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 counter-clockwise (CCW). Assuming it started at 0°, calculate the final position in degrees.

© 2024 Air Supply Information Center (Air Supply BBS)