Cytron SD02C User manual

SD02C
2A Stepper Motor Driver
User’s Manual
V1.0
APRIL 2016

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
Index
1. Introduction and Overview 3
1.0 Introduction of SD02C 3
1.1 System Overview 4
1.2 General Description 5
2. Packing List 6
3. Product Specification and Limitations 7
4. Board Layout 9
4.1 Dimension 10
5. Installation (hardware) 11
5.1 Connecting Driver to a Stepper Motor 11
5.2 Connecting to microcontroller using Signal Input Pin 13
5.3 Connecting to switches (without microcontroller) 14
5.4 Connecting to microcontroller through UART 15
5.4.1 Connecting SD02C to controller 15
5.4.2 Connecting SD02C to computer 17
5.5 Enable and Disable the driver 20
6. Installation (software) 21
6.1 Sample Program for Computer 21
6.2 Sample Program for dsPIC30F4013 24
7. Getting Started 25
7.1 Using SD02C with computer 25
7.2 Using SD02C with microcontroller 27
7.3 Using SD02C with Arduino 29
7.4 SD02C UART Protocol 30
8. Warranty 37
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
INTRODUCTION AND OVERVIEW
1.0 Introduction of SD02C
SD02C is the enhanced version from SD02A and SD02B. SD02C is designed to drive unipolar or
bipolar stepper motor. The board incorporates most of the components of the typical applications.
With minimum interface, the board is ready to Plug and Play. Simply add in power, this driver is
ready to drive unipolar or bipolar stepper motor. SD02C will actually drive stepper motor in
bipolar method. However, since unipolar stepper motor can also be used as bi-polar stepper motor,
thus this driver can be used to drive both unipolar and bipolar stepper motor. This stepper motor
driver has been designed with capabilities and features of:
●New! Now comes with UC00A/UART interface for easier communication between the
user’s circuit (or PC) and SD02C. By using the new UART control, user can
○On/Off, Run/Brake and change motor’s rotation direction
○Set motor speed
○Request for encoder value
○Track an encoder value and brake the motor
○Set new baud rate for the driver
★Not familiar with UART communication? Fret not, sample source code for
UART control is provided for dsPIC30F4013 (C language), Arduino and
VB.net!
●Support up to 2A (peak) and 1A(continuous) per phase.
●Smoother stepper motor rotation with 2, 4 and 8 micro-stepping.
●Able to drive stepper motor from 6V to 20V.
●Single power input for both motor and on board controller.
●5V logic level compatible inputs.
●Detect up to 1KHz pulses at PULSE input pin.
However, the maximum speed a stepper motor can step is also depending on the
motor's performance. For stepper motors available in Cytron store, the max
stepping speed can be up to 2-4kHz without load (free run).
●Enable/Disable pin for low power consumption mode.
●UART baud rate are saved in the non-volatile memory
memory (Factory default is baud rate = 9600).
Dimension: 7.4 cm x 6.6 cm
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
1.1 System Overview
SD02C is the enhanced version from SD02B. One of the additional features for SD02C
compare to SD02B is the onboard microstepping mode and UC00A interface for easiest uart
communication or connect directly to SKXBee. UART is provided in SD02C for easier
communication between user’s circuit (microcontroller/Arduino) and SD02C.
By using UART function on SD02C, user is able to have more extensive control of the motor
driver and stepper motor. User can leave most part of the motor control algorithm to SD02C and
let it takes care of the encoder supervisory job. It saves much software resources on the host.
For example by sending some commands, SD02C is able to accelerate the stepper motor from the
specified initial speed to final speed at desired acceleration rate. While the stepper motor is
accelerating, the host may take care of other routines. In order to know the stepper motor has been
accelerated to the final speed, the host can send another command to check the status of SD02C.
Besides, host can brake the stepper motor at the desired step by just sending a command together
with a 16-bit encoder value (send in two 8-bit values) to SD02C and let it counts the steps for you.
Besides that, the UART baud rate is stored in the non-volatile flash memory. This setting only
need to be configured once and will remain the same even though the power has been turned off.
Please refer to section 7.4, SD02C UART Protocol for the UART commands and descriptions.
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
1.2 General Description
Driving stepper motor is common necessity in most robotic project. A stepper motor is a
brushless, synchronous electric motor that can drive a full rotation into a large number of steps.
Stepper motor is ideally suit for precision control. This motor can operate in
forward/reverse with controllable speed stepper driver. There are various kinds of stepper motor,
some example are variable reluctant stepper motor, permanent magnet stepper motor,
bipolar/unipolar stepper motor, bifilar stepper motor and hybrid stepper motor. For more
description of stepper motor, user is advice to refer to Wikipedia at:
http://en.wikipedia.org/wiki/Stepper_motor. This driver, SD02C is design to drive bipolar
stepper motor.
SD02C is designed to drive stepper in 1, 2, 4 or 8 micro steps. This will offer smoother rotation of
the stepper motor. Of course, the step angle will depend on the specification of stepper motor
being drive. As an example, if the stepper motor being drive is 1.8° per step and use 1/8
micro-stepping, the smallest step (1 pulse) is 0.225°. This will offer much better resolution
(°/step).
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
2. PACKING LIST
Please check the parts and components according to the packing list. If there are any parts
missing, please contact us at [email protected] immediately.
SD02C comes with:
• 1 x SD02C board with every component is soldered properly and tested before board
is shipped.
• User’s Manual and sample source codes (in VB.net and C language) can be
downloaded from http://www.cytron.com.my/p-sd02c.
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
3. PRODUCT SPECIFICATION AND LIMITATIONS
Power Input Pins Function Description
Label
Definition
Function
VM
Motor Supply
Voltage
VM is one of SD02C power sources. VM will supplies power
to both stepper motor and SD02C circuit. Although SD02C
provides protection against wrong polarity for this input,
user must ensure the voltage and polarity of connection are
correct before providing the power so that SD02C can function
correctly.
GND
System Ground
Common ground for both logic operation and stepper motor
power source.
*If power is connect correctly, the PWR LED should light up.
Signal Input Pins Function Description
Label
Definition
Function
DIR
Stepper Motor
Rotating
Direction
Input Pin
Input for stepper motor to rotate CW (clockwise) or CCW
(counterclockwise). This pin is TTL/CMOS logic (5V and
0V). The direction is depends on the connection sequence
of stepper motor wires to SD02C. For example:
DIR = 0V CW
DIR = 5V CCW
EN
Stepper Driver
Enable Pin
Input pin to enable SD02C. This pin is TTL/CMOS logic
(5V and 0V). 5V will enable the motor driver further hold
the shaft of stepper motor while 0V will disable the motor
driver and release the shaft of the stepper motor. By
default, the driver is disabled for power saving.
PULSE
Stepping Pulse
Input Pin
Input to drive the stepper motor. This pin is
TTL/CMOS logic (5V and 0V). Each pulse (logic
change from 0 to 1) will drive the stepper motor 1step.
SD02C has 2/4/8 micro stepping.
GND
System Ground
Common ground for both logic operation and stepper motor
power source.
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
UART/UC00A Pins Function Description
Label
Definition
Function
DTR
SD02C RESET
Pin via 0.1uF
capacitor
Connected to Reset pin via 0.1uF capacitor. Suitable to act
as software reset of SD02C.
TX
SD02C UART
Transmit Pin
This is SD02C’s UART transmit pin. It should be
interfaced to 5V logic UART. It should be connected
to host’s receive pin.
RX
SD02C UART
Receive Pin
This is SD02C’s UART receive pin. It should be
interfaced to 5V logic UART. It should be connected
to host’s transmit pin.
VSEL
System 5V
Connected to 5V board. Suitable to power up SKXBee.
CTS
NC
Not connected to any pin.
GND
System Ground
Common ground for both logic operation and also
stepper power source.
Absolute Maximum Rating
No
Parameter
Max
Typical
Min
Unit
1
Output Current per phase, Iphase
1.8*
1
-
A
2
Case Operating Temperature, TC
70
-
0
°C
3
Storage Temperature, TSTG
80
-
0
°C
* For momentary peak current. Driving at this condition may trigger overheat or over-current cut-off.
No
Parameter
Max
Typical
Min
Unit
4
VM Voltage
20
-
6
V
5
VM Current
2.53
-
0.11
A
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
4.BOARD LAYOUT
Label
Function
Label
Function
A
Micro stepping selector
F
Push button to reset SD02C
B
Connector to stepper motor
G
Push button to test SD02C
C
Stepper motor coil power indicator
(4 LEDs)
H
Small green LED as VCC indicator
D
Manufacturing test point
I
Voltage input
E
UART communication
J
Connector to Host (Signal)
A – A DIP switch used to select Micro stepping for SD02C.
B – A 6 ways connector for user to connect particular stepper motor. Please skru the
wire properly by referring to chapter 5, Hardware Installation.
C – 4 red LEDs acting as indicator for stepper motor coil. These LEDs will indicate
which coil is being powered at a moment
.
D – Manufacturing test point for SD02C. The header pin is not soldered since it is meant
for production test point. Please DO NOT connect or shorted any of these pins.
E – UART communication between SD02C and microcontroller circuit or PC’s Serial
Communication Interface (SCI).
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
F – A push button acting as reset button to SD02C. If this button is pressed, SD02C will
be reset to initial stage. Please DO NOT pressed this button during operation
.
G – A push button to activate self test on SD02C. When it is pressed and hold, SD02C will
start to drive stepper motor. If power supply is connected and this button is pressed,
LEDs at C will illuminate sequentially.
H – A small green LED to indicate status of power. If power is connected and voltage,
this LED will light ON.
I – Voltage input for the power source.
J – A 2510 4 ways connector to host. Please refer to chapter 5, Hardware installation
for details.
4.1 DIMENSION
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
5. INSTALLATION (HARDWARE)
5.1 Connecting Driver to a Stepper Motor
Most unipolar stepper motor comes with 5 or 6 wires. As shown in the following left figure, there
will be 2 wires (1 and 2) which act as the common terminal for coil a and coil b. If these 2 wires (1
and 2) are not used, it will become bipolar stepper motor as shown in figure on the right.
Before connection can be made, please determine the correct wiring for stepper motor. In
general, 2-phase stepper motors can have 4, 5 or 6-wire leads, not including any (optional)
encoder lines. The best solution is to obtain the pin out from the motor manufacturer. If user does
not have access to the pin out, then the following procedure will help in determine wiring of the
2-phases stepper motor. Some stepper motors have a motor case ground that can be tied to the
ground of the system. It is usually a black wire, and it will add one additional wire to the overall
count (4 coil wires + 1 casing ground = 5 wires total).
1. • If the stepper has four coil wires:
a. Each of the two phases (X and Y) should have the same resistance when
measured with a multi-meter. When measuring the resistance across one wire
from each of the two phases (between X and Y), the resistance should be
infinite because the circuit is open. Locate the two pairs of wires that represent the
two phases, and both pairs of wires will have similar internal resistance.
b. Connect each phase to SD02C and ignore the polarity (+/-), for now. User has a
50% chance of guessing right.
c. Press Test button on SD02C to rotate the motor. It should rotate in CCW
(counterclockwise) by looking at the motor shaft. If the motor rotates in the wrong
direction, switch either phase X and !X or Y and !Y (effectively reversing
directions).
2. If the stepper has six coil wires, then each phase has a center tap wire:
a. The center tap wire should have half the internal resistance of the full phase.The
easiest option is to use a multimeter to find the two pairs of wires that have the
maximum resistance.
b. Connect each phase to the SD02C, and ignore the polarity (+/-) for now. User has
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
a 50% chance of guessing right.
c. Press Test button on SD02C. The stepper motor should rotate in CCW
(counterclockwise) by looking at the motor shaft. If it is in the opposite
direction, switch either phase X and !X or Y and !Y (effectively reversing
directions). Press Test button on SD02C. The stepper motor should rotate in
CCW (counterclockwise) by looking at the motor shaft. If it is in the
opposite direction, switch either phase X and !X or Y and !Y (effectively
reversing directions).
d. In case the stepper come with five coil wires, then each phase share the same
common wire.
SD02C will only drive 2 coils which are 1a to 1b and 2a to 2b. Following pictures show typical
connection from SD02C to Unipolar and Bipolar stepper motors.
Unipolar stepper motor connection.
Bipolar stepper motor connection.
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
5.2 Connecting to Microcontroller using Signal Input Pin
Typical application would require a microcontroller to generate pulses and control the
direction. Following figure shows an example of SD02C connected to microcontroller. The above
example shows that the PULSE pin is being connected to RC2 of PIC16F877A.
This pin has the function to generate pulses using Compare mode. Please refer to source code of
PR7 from Cytron Technologies website for details of using Compare mode. Please note that if
you are using PR7 to control SD02C, SD02C should use VM from 12V or another power supply.
Please refer to chapter 3 (Product Specification and Limitations) for details. The link to PR7
DIY Project is:
http://www.cytron.com.my/p-pr7
Direction and EN pin can be connected to any digital I/O of PIC16F877A. However, both these
pins must be configured as output from the controller.
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
5.3 Connecting to Switches (without microcontroller)
User may also use switches to generate pulses and control the direction of stepper motor.
Here is an example of SD02C connected to switches.
Above figure shows the sample connection using switches to control SD02C and drive a stepper
motor. S1 act as pulses generator, S2 will control the direction of stepper motor while S3 will
disable SD02C if pressed.
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
5.4 Connecting to Microcontroller through UART
A new feature for SD02C is the UART interface for easier communication between a host (user’s
circuit or PC) and SD02C. By using the UART control, user can on/off, run/brake and change
motor rotation direction in a simple commands. Beside that user can request for encoder value,
tracks the encoder value and brakes the motor at desired steps count, accelerate the motor
from a specified initial speed to a final speed at desired acceleration rate. Here is an example
connection of SD02C to Microchip PIC16F877A AND ARDUINO UNO/CT-UNO through
UART.
5.4.1 Connecting SD02C to Microcontroller
For microcontroller to interface with SD02C, only 3 connections are needed. They are TTL
UART (Universal Asynchronous Receiver and Transmitter) transmit (TX) and receive (RX)
pins, together with the system ground (Gnd).
Sample connection CT-UNO using SOFTWARE SERIAL.
Sample connection SK40C using SERIAL/UART.
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
a. Sample schematic on above shows a PIC16F877A and CT-UNO interface to
SD02C. No restriction to what type or brand of microcontroller can be used, as
long as it has UART Peripheral.
b. User needs to connect the RX and TX pin to microcontroller. These two pins should
be cross connected to microcontroller. In other words, RX on SD02C should be
connected to microcontroller’s transmitter pin (TX), while TX on SD02C should be
connected to microcontroller’s receiver pin (RX). For details connection, please refer
to sample schematic above.
c. To begin, connect VM and GND to power supply at a voltage according to the
specification of the stepper motor used and make sure the voltage is within the
voltage range of SD02C VM. Please refer to section 3, Product Specification and
Limitations for details.
d. Power up the microcontroller board and SD02C. Once the power is supplied to
SD02C, the SMD green LED should light ON
e. The hardware interface for SD02C to microcontroller is ready! However, in order to
control stepper motor from microcontroller, user is required to write a program for the
microcontroller to send commands through its UART according to SD02C UART
protocol.
f. User may refer to dsPIC30F4013 sample program provided to control two SD02C (thus,
two stepper motors) through two hardware UART using Microchip MPLAB C30 C
Compiler Libraries.
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
5.4.2 Connecting SD02C to Computer
Another concern in controlling stepper motor using a computer is the hard work needed to get
started. However, with SD02C, interfacing with a computer is as easy as 1 2 3. Normally, user
will need to develop a RS232 level shifter for communication to serial port. This generates
extra work. Furthermore, laptop and computer nowadays have phase-out the serial port and
replaced it with USB. With these reasons, an USB to UART converter, UC00A, have been
developed by Cytron Technologies. Simply plug SD02C to UC00A and USB port of computer
(PC or Laptop), install the driver (for the first time only) and it will create a virtual COM port in
your computer and is ready to communicate with SD02C.
User may refer to UC00A User’s Manual for hardware and software installation. So, no extra
work is needed to control SD02C using a computer. And, of cause, you may connect more than
one UC00A to your computer and control more than one SD02C at the same time.
A Graphical User’s Interface (GUI) comes together with the source code is provided for user to
implement stepper motor control using a computer.
a. To begin, connect VM and GND to power source. Please refer to chapter 3, Product
Specification and Limitations, for details. Figure below shows that SD02C is connected to
a 11.1V(3 cells) LIPO battery thru VM as the power source.
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
b. Connect SD02C to a stepper motor.
c. To interface with a computer, simply connect UC00A 6-pin connector to SD02C and
the USB end to PC as shown in the following figure. Please note that the TX and RX
pins between SD02C and UC00A are cross-connected.
sample connection if using UC00A.
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
Sample connection if using SKXbee.
d. Please refer to documents named “USB Driver Installation Guide” included in
UC00A package for driver installation.
e. After plugged in UC00A to computer and installed the driver, user is ready to test the
functionality of SD02C using SD02C GUI.
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved

ROBOT . HEAD to TOE
Product User’s Manual – SD02C
5.5 Enable and Disable the driver
Current consumed by the stepper motor may raises to over 2A at certain conditions. It is
depending on the stepper motor's ratings, stepping speed, micro-stepping mode and at which step
the motor brakes. As stated in the Absolute Maximum Rating in chapter 3 (Product Specification
and Limitations), the typical current per phase is rated at around 1A. Running at any value above
1A continuously may cause the driver to be overheated and automatically cut-off the circuit for
protection. Hence it is more advisable to turn off the motor, instead of leaving it in braking
condition (“stall state”).
For controlling SD02C using signal input pins, providing a low logic (0V) to EN pin allows user
to “shut off” the driver and get into power saving mode. When stepper motor is idle, it can be in
“stall state” (provide torque and draw current) or “off state” (free, do not draw current). By
default, this pin is connected to ground.
For controlling SD02C through UART, the ‘OFF’ command will do the same job. Just send an ‘F’
to SD02C and it will turn off the motor and get into power saving mode. Please refer to section
7.3, SD02C UART Protocol for details.
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved
Table of contents