SD02C is designed to drive unipolar or bipolar stepper motor, up to 1.8 Amp peak. With SD02C, you just need a minimum interface, the board is ready to be plug and use. Simply add in power and a stepper motor, this driver is ready to drive the motor. The onboard test button will help to verify the connection. Besides accepting the stepper driver conventional control signal (EN, DIR and PULSE), there is an additional control option UART or serial. With the UART interface, it can be controlled from computer via USB to serial bridge such as UC00A. A stepper motor is an electric motor that rotates in discrete step increments. The movement of each step is precise and repeatable. Therefore, the motor’s position can be controlled precisely without any feedback mechanism, as long as the motor is carefully sized to the application. This type of control eliminates the need for expensive sensing and feedback devices such as optical encodes. The position is to know simply by keeping track of the input step pulses. It is one of the most versatile forms of positioning systems. They are typically digitally as part of an open loop system and are simpler and more rugged than closed loop servo system.
In this tutorial, will also use LCD Keypad Shield. It’s come with a 2×16 LCD display and 6 momentary push button. Pins 4,5,6,7,8,9 and 10 are used to interface with the LCD. Just one Analog Pin 0 is used to read the five push button and the other button which is reset is direct connect to Arduino’s reset pin. The used of LCD is to display the Direction, Run, Enable and Pulse while for the buttons is used to configure the stepper motor.
Check Analog value for each button at serial monitor
LCD keypad shield comes with 6 different keys (buttons), which is Up key, Down key, Right key, Left key, Select key and Reset key. Reset key is directly connected to Arduino’s reset pin. Each key generates different analog value for Arduino to detect different button from a single analog pin. The analog value is generated through a 5 stage voltage divider. The disadvantage is, we can only push one button at one time
- Stack LCD keypad shield on top the Arduino UNO / CT-UNO.
- Plug in USB cable at Arduino UNO / CT-UNO to laptop
- Choose board Arduino / Genuino UNO and port
- Compile and upload the code below.
- Open the serial monitor, press any button on LCD keypad Shield and see the value at the serial monitor.
6. Once you get the analog value, insert the value to the sketch. But not to forget, the range must be bigger than the actual value. Here is some example.
Method 1: Arduino Uno connect to SD02C via connector (signal)
Before we start with the tutorial, let me give some information about the new SD02C. The typical method to control stepper motor is Direction, Enable and Pulse, but with SD02C user also can control your stepper motor via UART interface. On this tutorial, we will be able to control the rotation of the motor according to the desired degree.
- Connect CT- Uno to the laptop using USB cable micro B
- Stack CT-Uno / Arduino Uno with Terminal shield.
- On top Terminal shield stack LCD Keypad Shield.
- Connect the terminal shield to SD02C
|Pin 12||DIR (Direction)|
|Pin 13||EN (Enable)|
- After that, connect the stepper motor to SD02C
In this sample code, you can control rotation for a stepper motor according to the given angle. For this type of Stepper Motor, a single move will be 1.8°. But users need to use micro stepping mode 1 to get the right angle. Because to complete a 360 ° rotation, each pulse will move by 1.8 ° degrees. Therefore, the pulse value should be 200 pulses to complete a 360 ° rotation. In other cases, if you use micro stepping mode 2. The value of the angle will be 0.9 ° degrees because the original degree value will be divided by 2. Therefore, to complete a 360 ° rotation need 400 pulse
After uploading the code you should see something like this.
To operate please use the button on the LCD Keypad Shield. These are the function of each button:
Up key: Increase degree (DEGREE)
Down Key: Decrease degree (DEGREE)
Select Key: Enable (En)
Left Key: Run (Run)
Right Key: Direction (Dir)
Method 2 : Arduino Uno connect to SD02C via UART interface
Let’s try another method, this time we will be using UART communication. But first, user needs to connect the RX and TX pin to the microcontroller. These two pins should be cross-connected to the 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 received pin (RX). By using the UART control, user can on/off, run/brake and change motor rotation direction in simple commands.
In this sample code, you will be able to control the pulse of the Stepper Motor. When the pulse increases the motor will rotate faster and vice versa. The micro stepping should be in default which is micro stepping mode 1.
After the uploading proses are done, you should see something like this on your LCD Keypad Shield.
To operate the Stepper Motor, please use the button on the LCD Keypad Shield. These are the function of each button:
Select Key: En (Enable)
Left Key: Run
Right Key: Dir (Direction)
Up Key: Increase the pulse value.
Down Key: Decrease the pulse value.