The new revision of stepper driver: SD02C
We have revised and improved the SD02B, it is now SD02C, with new features and easier to use 🙂
Let’s look at the new SD02C. It can support up to 1.8A (peak) per phase, 1A (continuous) per phase. Now the driver comes with a 4-way DIP switch to configure the micro-stepping: 1, 2, 4 or 8 micro stepping. Wide voltage range, from 6V to 20VDC. To make life easier, it comes with 6-way header pins for UC00A/UC00C/FTDI interface for UART (Serial) control, from the computer or other controllers. You can still control the driver using the conventional method which is through the EN (Enable), Pulse(Step) and DIR (Direction). To check out more, please visit the product page of SD02C.
Most of the stepper drivers in the market receive pulse signal from a controller to manipulate the stepper motor. However, besides pulse signal input, SD02C also offers UART/Serial 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. In this article, we will show you the control of stepper motor with SD02C via the computer from GUI (Graphic User Interface)
The 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 do not have a built-in serial port! At any normal situation, UC00A fits the job nicely unless you are using a PC, an older laptop or 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 in this tutorial. For more information please refer to SD02C’s user manual.
Hardware setup: Laptop (or Computer), SD02C, UC00A
Hardware setup: SD02C 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 the Driver Installation Guide. Both driver and installation guide are provided in UC00A product page at Cytron website: www.cytron.io.
SD02C UART Protocol
The one special feature SD02C possesses is the UART protocol. This allows user to send commands to SD02C 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 SD02C user manual
Using SD02C GUI
A. COM Port
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.
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 Baud rate. When we change the baud rate with the GUI, it actually sends a command to the SD02C to select the 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 SD02C will reset to the default value (9600) once reset button on the driver is pressed or powered off
B. Control Panel
Once connected, we are able to control the SD02C using the GUI. Click ON button will send ‘O’ to SD02C 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.
C. Set Speed
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 SD02C stepper motor driver. This driving mode ensures smaller step size and smoother stepping for the motor. We can also select another stepping mode which are ½ micro-stepping, 1/4 micro-stepping, 1/8 micro-stepping or no micro-stepping. After the selection, just click Micro-Stepping button to send the command to SD02C At 1/2 micro-stepping mode, select a lower speed (~2), then change the stepping modes one-by-one in order to experience the differences of each mode.
D. Set Acceleration
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 the desired rate until the final speed is reached. If the final speed is greater than the initial speed, the motor will accelerate. On the other hand, if the initial speed is greater than the final speed, the motor will decelerate.
E. Track Encoder and Request Encoder
Another useful feature of the SD02C 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 SD02C memory, click Track to set the desired step value to break 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 the value that I have set, this 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.
The last column is Status. The value shown here tells the current status of SD02C 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 SD02C by sending ‘C’ to it. The meaning of the value received is discussed in SD02C’s user manual.
Last but not least, click on the Cytron logo at the bottom right of the GUI to go to Cytron’s website. Please have a look, you may find the information and guidance you want over there. If you have any inquiry, please do post it in our technical forum