Stepping Motor Control (Unipolar type)

1) Summary

Here is an Unipolar type stepping motor driver library and its sample program.

Main features are followings;
(1) This library is only for "Unipolar type", not for "Bipolar type"
(2) Use 4 ports as output port -> mbed DigitalOut
(3) 4 drive lines are controled by so called "Full step drive (two phases on)"
(4) Change each phase by timer interrupt -> mbed Ticker
(5) Motion control is "Oepn loop" and no detection for "Step-out"
(6) Acceleration and deceleration pattern is a very simple trapezoidal curve

2) Picture

/media/uploads/kenjiArai/stepper0.png /media/uploads/kenjiArai/stepper1.png

3) Hardware Circuit

Stepping Motor: I'm using Copal Electronics SPG27-1702.
http://akizukidenshi.com/catalog/g/gP-05708/
Driver IC: TD62003AP
http://akizukidenshi.com/catalog/g/gI-05486/

/media/uploads/kenjiArai/stepper_circuit.png

4) Software function

4-1) Trapezoidal pattern

Please define two basic parameters.
(1) TIMEBASE -> define micro-seconds data for motor speed
(2) pls_width[10] array data -> Trapezoidal pattern

a sample program

#include "mbed.h"
#include "stepper.h"

STEPPER     sm_r(D5, D4, D3, D2);
STEPPER     sm_l(D9, D8, D7, D6);

#define TIMEBASE	18000

uint8_t pls_width[MT_SLOP_STEP] = {5, 4, 3, 2, 1, 1, 1, 1, 1, 1 };

int main() {
    sm_r.set_max_speed(TIMEBASE);
    sm_l.set_max_speed(TIMEBASE);
    while (true) {
	sm_r.move(100);
	sm_l.move(-100);
        wait(20);
	sm_r.move(-100);
	sm_l.move(100);
        wait(20);
    }
}

5) Tested board

I have tested the program following mbed boards.

  • mbed ST Nucleo L152RE
  • mbed ST Nucleo F401RE
  • mbed LPC1114FN28

6) Software

Import programNucleoL152_stepper_w_lib

Unipolar Stepping motor drive sample program

Import librarystepper

Stepper Motor Driver library for Uni-polar type


Please log in to post comments.