Hi,
I’ve been successfully controlling a ST3215 servo motor using an Arduino Leonardo. I’m able to move the motor and also read back data such as position and load. My wiring setup is fairly simple: I power the servo with 12V, share a common ground with the Arduino, connect the servo's data line to the TX pin on the Arduino, and use a resistor between TX and RX on a breadboard.
Now, I'm trying to achieve the same setup using an ESP32 WROOM-32D. I’m running the same code and wiring it similarly. While I can move the motor, I’m not able to read back any data like position or load from the servo.
Then I bought the Bus Servo Adapter (A) driver board and also tried running the code example to read data from
but it still didn't work, not even moving the motor this time.
I did the connection between esp32 and adapter:
tx adapter -> rx esp32
rx adapter -> tx esp32
GND adapter -> GND esp32
12V -> adapter
servo cable -> adapter
Any idea how to make this work with ESP32 WROOM 32D?
Which tx & rx pins are you using on the ESP32 ?
Please share the code and a link to the exact board you are using.
Serial (0) is most likely connected to the USB to TTL converter which is obstructing reception of the ESP32. Best option is usually to connect anything external to Serial2 and it's pins first to get it working. An ESP32 can use pretty much any pin for it's Serial port though, so if you want to connect multiple Serial devices you can.
Hi thanks for your response.
below is the code example from their website. I tried both (rx=18,tx=19) and (rx=16,tx=17) and also tried Serial1 and Serial2-no luck still!
#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 the 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 the 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 the 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 the 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 the 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 the 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); //Get the 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();
}
below is the connection between esp32 and the adapter
Is there a chance that the tx-rx should be not-crossed instead of crossed ? You have them the way i would, but the driver board does not seem very clear to me.
Ah ! looking through the documentation it states
For hardware devices without USB connectors, such as Raspberry Pi Zero, ESP32, Arduino, and STM32 development board, you can realize serial bus servo control and data feedback via the UART port with the hardware device, and the connection must be RX-RX, TX-TX. Note that the jumper cap of the bus servo adapter must be on the A as shown below.
So tx-tx & rx-rx so 'not-crossed'
I suppose you have the switch in the proper position.
Does it work on USB ? Oh that actually looks like quite a lot of work.
Do they really have the UART at 1Mbps ? seems pretty quick and suspicious. Can't find any information on the Baud-rate anywhere. First un-cross the lines and try again.
Hi Deva,
I tried connecting TX-TX and RX-RX (uncrossed) as follows:
- Adapter TX → ESP32 GPIO 17 (TX)
- Adapter RX → ESP32 GPIO 16 (RX)
- Shared GND and powered the adapter with 12V
I also tested other configurations, including crossed connections (TX-RX) on different GPIO pairs (18 & 19), but the adapter still doesn’t work—no motor movement or data reading.
For context:
- With direct wiring (ESP32 TX → Servo, shared GND, 12V power), I can move the motor (like with the Arduino), but cannot read data (position/load).
- Waveshare’s tech support recommended this adapter to resolve the data-reading issue, but so far, it hasn’t worked in any configuration.
And what do they say about that ?
There is of course a chance that having had them crossed damaged something.
Is the adapter actually a 3.3v device ? or is it 5v logic levels.
The USB remains untested ?
They didn't reply to me yet when I emailed them that the adapter is not solving the issue.
I didn't test the USB of the driver since my goal is to control it with esp32..
testing it with USB may give you an indication of where the issue may be though (or at least rule something out)