Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
This product is a high-torque programmable serial bus servo motor with a 360° high-precision magnetic encoder, enabling angle control within a 360° range, with a maximum speed of up to 106 RPM. It can be controlled programmatically to set any angle as the servo motor's middle position. It can also be switched to operate as a continuous rotation motor (speed closed-loop control) or stepper motor mode. The motor has a built-in acceleration and deceleration function, ensuring smoother motion.
Each servo motor has two interfaces, allowing for multiple motors connected in series. Theoretically, it can simultaneously control 253 bus servo motors, and each one can provide information about its current angle, load, voltage, and mode. It is suitable for robotic projects that require closed-loop control, such as robotic arms, hexapod robots, humanoid robots, and wheeled robots.
Additionally, we offer an open-source 12-degree-of-freedom robotic dog model specifically designed for this type of servo motor. You can download the model and engineering files of this open-source structure from the information section at the bottom.
Generally, we control the ST series servos by compiling and uploading the demo through the Arduino IDE. However, compiling through Arduino requires installing various dependency libraries before use. Therefore, we provide an ESP32 download tool. With this tool, users can download the demo to the driver board without needing to download other dependency libraries or the Arduino IDE software.
https://dl.espressif.com/dl/package_esp32_index.json
Note: If you need to add more than one development board URL, it is not necessary to delete the URL of the ESP32 development board support, you can directly add the other URL to another line, the default display is comma separated URL. For example, if you need to add the URL of the ESP8266 development board, add it directly to another line, it will be displayed as follows:
https://dl.espressif.com/dl/package_esp32_index.json,http://arduino.esp8266.com/stable/package_esp8266com_index.json
C:\Users\username\AppData\Local\Arduino15
The "username" here would vary according to your computer's username, copy the unzipped packages file to the Arduino15 folder.
1. Double-click on ServoDriverST.ino:
2. Click on "Tools" -> "Port", please remember the COM port on your PC, and do not click on this COM port (COM1 is the port on my PC, different computers show different COMs).
3. Connect the serial bus servo with the PC with a USB cable, click on "Tools" -> "Port", and then click on the new COM port (here is COM10):
4. In Arduino IDE, click on "Tools" -> "Board:'ESP32 Dev Module" -> "esp32" -> "ESP32 Dev Module".
5. Click on "Tools", and the other settings as shown below: (it is recommended to set "Huge APP" for "Partition Scheme", and "PSARM" must be enabled).
6. After setting, click to upload, and the demo will be uploaded to the device.
After uploading, "Leaving... Hard resetting via RTS pin..." indicates the successful uploading.
Each demo that controls the servo needs to initialize the servo, and the initialization is done before it can be used.
#include <SCServo.h>
SMS_STS st;
void setup(){
Serial1.begin(1000000); //Serial port initialization, and if using devices like ESP32, custom serial ports can also be selected.
// Serial1.begin(1000000, SERIAL_8N1, RX, TX); // Custom serial ports
st.pSerial = &Serial1;
while(!Serial1) {}
}
Among the servos connected in series, each ID should only correspond to one servo. Otherwise, the servo feedback information cannot be obtained properly.
When changing the servo ID, it is advisable to ensure that the driver board is only connected to one servo. The ID will be permanently stored in the servo.
#include <SCServo.h>
SMS_STS st;
int ID_ChangeFrom = 1; // The original ID of the servo whose ID is to be changed is factory defaulted to 1.
int ID_Changeto = 2; // New ID
void setup(){
Serial1.begin(1000000);
st.pSerial = &Serial1;
while(!Serial1) {}
st.unLockEprom(ID_ChangeFrom); //Unlock EPROM-SAFE
st.writeByte(ID_ChangeFrom, SMS_STS_ID, ID_Changeto);//Change ID
st.LockEprom(ID_Changeto); // Lock EPROM-SAFE
}
void loop(){
}
Used to test whether a particular servo is properly connected.
#include <SCServo.h>
SMS_STS st;
int TEST_ID = 3; // Servo ID to be tested
void setup()
{
Serial.begin(115200);
Serial1.begin(1000000, SERIAL_8N1, RX, TX); // Custom serial ports
st.pSerial = &Serial1;
while(!Serial1) {}
}
void loop()
{
int ID = st.Ping(TEST_ID); //If you ping the servo with that ID and receive no response, it will return -1.
if(ID!=-1){
Serial.print("Servo ID:");
Serial.println(ID, DEC);
delay(100);
}else{
Serial.println("Ping servo ID error!");
delay(2000);
}
}
Can be used to control individual servo rotation.
#include <SCServo.h>
SMS_STS st;
void setup()
{
Serial1.begin(1000000);
st.pSerial = &Serial1;
while(!Serial1) {}
}
void loop()
{
st.WritePos(1, 1000, 1500, 50); //To control the servo with ID 1, rotate it to position 1000 at a speed of 1500, with a start-stop acceleration of 50.
delay(754);//[(P1-P0)/V]*1000+100
st.WritePos(1, 20, 1500, 50); // To control the servo with ID 1, rotate it to position 20 at a speed of 1500, with a start-stop acceleration of 50.
delay(754);//[(P1-P0)/V]*1000+100
}
Can be used to control multiple servos at the same time (rotating to different positions and at different speeds).
#include <SCServo.h>
SMS_STS st;
// the uart used to control servos.
// GPIO 18 - S_RXD, GPIO 19 - S_TXD, as default.
#define S_RXD 18 //Customize the IO of the serial port, if you don't use the custom serial port below Serial1.begin(1000000, SERIAL_8N1, S_RXD, S_TXD); you need to change to Serial1.begin(1000000);.
#define S_TXD 19
byte ID[2];
s16 Position[2];
u16 Speed[2];
byte ACC[2];
void setup()
{
Serial1.begin(1000000, SERIAL_8N1, S_RXD, S_TXD);
st.pSerial = &Serial1;
delay(1000);
ID[0] = 1; // Save the servo ID to be controlled to ID[].
ID[1] = 2; //Save the servo ID to be controlled to ID[].
Speed[0] = 3400; // Set the servo speed, Speed[0] corresponds to the servo with ID[0] above.
Speed[1] = 3400; // Set the servo speed, Speed[1] corresponds to the servo with ID[1] above.
ACC[0] = 50; // Set the start/stop acceleration, the lower the value the lower the acceleration, and the maximum can be set to 150.
ACC[1] = 50;
}
void loop()
{
Position[0] = 3000; // Set the target position of the servo with ID[0] (in this case ID 1) in the range 0-4095
Position[1] = 3000; // Set the target position of the servo with ID[1] (here with ID 2) in the range 0-4095
st.SyncWritePosEx(ID, 2, Position, Speed, ACC);//servo(ID1/ID2) speed=3400,acc=50,move to position=3000.
delay(2000);
Position[0] = 100;
Position[1] = 100;
st.SyncWritePosEx(ID, 2, Position, Speed, ACC);//servo(ID1/ID2) speed=3400,acc=50,move to position=100.
delay(2000);
}
#define S_RXD 18
#define S_TXD 19
#include <SCServo.h>
SMS_STS sms_sts;
void setup()
{
Serial1.begin(1000000, SERIAL_8N1, S_RXD, S_TXD);
Serial.begin(115200);
sms_sts.pSerial = &Serial1;
delay(1000);
}
void loop()
{
int Pos;
int Speed;
int Load;
int Voltage;
int Temper;
int Move;
int Current;
if(sms_sts.FeedBack(1)!=-1){
Pos = sms_sts.ReadPos(-1);
Speed = sms_sts.ReadSpeed(-1);
Load = sms_sts.ReadLoad(-1);
Voltage = sms_sts.ReadVoltage(-1);
Temper = sms_sts.ReadTemper(-1);
Move = sms_sts.ReadMove(-1);
Current = sms_sts.ReadCurrent(-1);
Serial.print("Position:");
Serial.println(Pos);
Serial.print("Speed:");
Serial.println(Speed);
Serial.print("Load:");
Serial.println(Load);
Serial.print("Voltage:");
Serial.println(Voltage);
Serial.print("Temper:");
Serial.println(Temper);
Serial.print("Move:");
Serial.println(Move);
Serial.print("Current:");
Serial.println(Current);
delay(10);
}else{
Serial.println("FeedBack err");
delay(500);
}
Pos = sms_sts.ReadPos(1); // Get position feedback
if(Pos!=-1){
Serial.print("Servo position:");
Serial.println(Pos, DEC);
delay(10);
}else{
Serial.println("read position err");
delay(500);
}
Voltage = sms_sts.ReadVoltage(1); //Get voltage feedback
if(Voltage!=-1){
Serial.print("Servo Voltage:");
Serial.println(Voltage, DEC);
delay(10);
}else{
Serial.println("read Voltage err");
delay(500);
}
Temper = sms_sts.ReadTemper(1); // Get temperature feedback
if(Temper!=-1){
Serial.print("Servo temperature:");
Serial.println(Temper, DEC);
delay(10);
}else{
Serial.println("read temperature err");
delay(500);
}
Speed = sms_sts.ReadSpeed(1); // Get speed feedback
if(Speed!=-1){
Serial.print("Servo Speed:");
Serial.println(Speed, DEC);
delay(10);
}else{
Serial.println("read Speed err");
delay(500);
}
Load = sms_sts.ReadLoad(1); // Get load feedback
if(Load!=-1){
Serial.print("Servo Load:");
Serial.println(Load, DEC);
delay(10);
}else{
Serial.println("read Load err");
delay(500);
}
Current = sms_sts.ReadCurrent(1); // Get current feedback
if(Current!=-1){
Serial.print("Servo Current:");
Serial.println(Current, DEC);
delay(10);
}else{
Serial.println("read Current err");
delay(500);
}
Move = sms_sts.ReadMove(1); // Getting movement feedback
if(Move!=-1){
Serial.print("Servo Move:");
Serial.println(Move, DEC);
delay(10);
}else{
Serial.println("read Move err");
delay(500);
}
Serial.println();
}
You can check the attached st3215 serial servo memory table.
memory table