SD02B Stepper Driver Features UART Interface

By: SC Lim, RH2T Mag Volume 5, Jun 2010

Here’s a quick tutorial on interfacing SD02B stepper motor driver to a computer using UC00A USB to UART converter through UART communication.


Most of the stepper drivers in the market receive pulse signal from a controller to manipulate the stepper motor. However, besides pulse signal input, SD02B stepper motor driver also provides UART interface for user to send commands, saving the controller’s processing resources to work on the other tasks because the driver will take care of the stepping automatically.


SD02B stepper motor driver

System Setup

Figure below shows the hardware setup for this tutorial. UC00A USB to UART converter is used here not only because it’s handy, but most importantly, it is unable to be connected to a normal laptop as laptops nowadays does not have built in serial port! At any normal situation, UC00A fits the job nicely unless you are using a PC, an older laptop or a business models like Dell Latitude E5500 which has a serial port.

Since we won’t be using the signal input pins (Enable, Direction and Pulse pins) of the stepper motor driver, we only need to connect the power input pins to the power source. A 12V/2A adaptor is used for the power supply because the stepper motor we’re going to use is only rated at 0.5A per phase. The jumper for voltage selector is placed at Vmotor. More information on various alternatives to supply the driver and motor is discussed in SD02B’s user manual.

SD02B Computer Hardware setup for the system: Laptop (or Computer), SD02B, UC00A and stepper motor.

After setting up the hardware, we need the device driver for UC00A so that our computer is able to recognize UC00A as USB to UART converter in order to create a virtual COM Port in the hardware list. The installation steps are discussed in Driver Installation Guide. Both driver and installation guide are provided in UC00A product page at Cytron website:

SD02B UART Protocol

The one special feature SD02B possesses is the UART protocol. This allows user to send commands to SD02B through UART communication, which is absent in most stepper motor drivers. The summary of the commands is given in the table below. There are four types of commands – one byte, two bytes, three bytes and four byte. Some of the commands return one byte or two bytes value to the controller. You may look at the Send/Receive column for the data direction. The appropriate data to be sent or receive can be found in Data (8-bit) column. For detailed description of each command, please refer to SD02B user manual, chapter 7.3 (SD02B UART Protocol).


SD02B UART Protocol

Sample Graphical User Interface (GUI)

A sample GUI written in VB.NET with Visual Basic Express Edition 2008 is free for download at SD02B product page. This GUI shows how to control SD02B using a computer. The executable file for this GUI is placed at this path: <download directory>\..\SD02B\GUI\SD02B GUI\bin\Debug\SD02B GUI.exe. Double click on the icon will open a window shown in the figure below. You may need to install .NET Framework, downloadable at Microsoft’s website, to run the GUI correctly.


SD02B Graphical User Interface version 1.1

If you wish to look into the source code, you may open the file named SD02B GUI.vbproj at <download directory>\..\SD02B\GUI\SD02B GUI\. Visual Basic Express Edition 2008 is also free for download at Microsoft’s website.

Using SD02B GUI

First, select the correct COM port for UC00A that we’ve plugged into the computer. For my case, it’s COM9. If you’re using a PC’s serial port, you should select COM1. This GUI will refresh the COM port list once you click on the drop down box arrow. Only the currently available COM ports are shown. By default, the GUI will configure the COM port for 9600 baud, 8N1 and no flow control, as specified in the VB.NET program.


Select the correct COM port

After selecting the corresponding COM port, click CONNECT button to establish the connection with UC00A USB to UART converter. If you see the button changes from CONNECT to DISCONNECT, you are on the right track, the selected COM port is now connected. Now you can change the baud rate of the communication by changing it to other values in the second drop down box and click Set New Baudrate. When we change the baud rate with the GUI, it actually sends a command to the SD02B to select new baud rate and change the baud rate of the virtual serial COM port at the same time. However, please note that the baud rate of SD02B will reset to default value (9600) once reset button on the driver is pressed or powered off.


CONNECT button pressed

Once connected, we are able to control the SD02B using the GUI now. Click ON button will send ‘O’ to SD02B and turn on the driver. The motor won’t start rotating at the moment but it’s in brake state until we click GO button. CW and CCW are used to change the rotation direction of the stepper motor. The direction may differ depending on the connection of the stepper motor coils to the driver. If it’s rotating in the other way round, the sequence of the stepper motor connection needs to be reversed.



ON clicked GO clicked

If you have prior experience with stepper motor, you will find that the rotation speed of the motor is slightly slower. This is due to the micro-stepping driving mode of SD02B stepper motor driver. This driving mode ensures smaller step size and smoother stepping for the motor. We can also select other stepping mode which are 1/5 micro-stepping, 1/2 micro-stepping or no micro-stepping. After the selection, just click Micro-Stepping button to send the command to SD02B. At 1/10 micro-stepping mode, select a lower speed (~10), then change the stepping modes one-by-one in order to experience the differences of each mode.


Micro-Stepping column

To change the speed, you can drag the scroll bar at Set Speed column to set a higher speed value. The max value until the motor vibrate abnormally depends on the micro-stepping mode and motor’s characteristics. Hence, trial and error is often employed to get the exact value for the system. The max value is somewhere around 80 for LINIX 42BYGHD-444 stepper motor in 1/10 micro-stepping mode. Beyond that value, the motor starts to produce loud noise due to excessive vibration. The vibration begins when a frequency exceeds the maximum limit of the motor given to drive the coils.


Set Speed column

Set Acceleration column makes use of the UART protocol that helps user accelerate or decelerate the stepper motor speed easily. What we need to do is specify the initial speed, final speed and the desired acceleration rate, then click Accelerate. The driver will control the stepper motor to rotate at initial speed first and increases the speed at desired rate until the final speed is reached. If the final speed is greater than initial speed, the motor will accelerate. On the other hand, if the initial speed is greater than the final speed, the motor will decelerate.


Set Acceleration column

Another useful feature of the SD02B UART protocol can be seen in Track Encoder and Request Encoder columns. We can set a step value that we want to track in the numerical box, brake the motor, click Reset to clear the current encoder value accumulated in SD02B memory, click Track to set the desired step value to brake the motor and lastly click GO to run the motor. This starts the tracking too. For instance, set 2000 for the track step value and running a 1.8 degrees resolution stepper motor at 1/10 micro-stepping mode. The motor will revolve 1.8 / 10 = 0.18 degrees for each step. One full rotation requires 30 / 0.18 = 2000 steps. This value matches with the value that I have set, thus causes the motor to stop after rotating one full rotation. You can play around with other step value, rotation speed and stepping mode. This helps in understanding more on the overall concept of micro-stepping too.


Track Encoder and Request Encoder columns

The last column is Status. The value shown here tells the current status of SD02B stepper driver. The application comes in handy when it is used on an embedded system. We may send a lot of commands to the driver over time. Therefore, without the Status command, the controller needs to process the commands and remember the current status of the driver after receiving each command. But with the availability of Status command, the controller only needs to request the current status from SD02B by sending ‘C’ to it. The meaning of the value received is discussed in SD02B’s user manual.


Status column and Cytron logo

Last but not least, click on the Cytron logo at the bottom right of the GUI to go to SD02B’s product page in Cytron’s website. Please have a look for you may find the information and guide you want over there. If you have any inquiry, please do post it in our technical forum.


1. SD02B User Manual

2. UC00A User Manual


, , ,

Related Post

feed the fish

Who is going to feed my fish?


Make a Talking Dustbin


Raspberry Pi: GUI with a Remote Desktop Connection


Simple steps to control Stepper Motor using 2Amp Motor Driver Shield and CIKU

10 thoughts on “SD02B Stepper Driver Features UART Interface

  1. Hello,
    Very nice setup. Can you describe the connectors you used to connect to DC and to connect the SD02B to the UC00A ?
    Thx a lot.

  2. hello,

    please is it possible to send the SD02B gui 1.1, there must be a problem with 1;0 it Always stops, never let you close the ftle

    many thanks

  3. Hi, If I plan to use it as my 3 axis CNC router, so I have to use 3 of these board, is there any breakout board needed?
    is it compatible with the software which available on the internet?


  4. Hi, I would like to know how to connect the Driver SD02B with Arduino ??
    From the usual manual only like connect TX, RX, Power and Ground.
    It is good enough to control the stepper with only 4 connections from Arduino to the driver ?

  5. So please correct me if I’m wrong but, when i connect the UC00A to the driver then will I be able to control the motor through LabVIEW function VISA?

  6. Hi, I want to use SD02B interface with Arduino to perform rotation 120 degree for stepper motor.
    Can SD02B do that?

Leave a Reply

Your email address will not be published. Required fields are marked *