ESP32 with RoboClaw motor controllers: No response from motors

I am working on a motor control system using the RoboClaw 2x30A motor controllers. I have successfully connected a single RoboClaw via the Motion Studio software and can control the motors through PWM without any issues.

However, I need to use multiple motor controllers for my setup. I am trying to interface with the RoboClaw through code using the library available on your website, but I am not receiving any response from the motor or the RoboClaw. When I send a direct PWM signal to the controller’s address, the lights on the RoboClaw blink, but the motors do not move.

I wrote a code to read the incoming data, and the output I observed is as follows:
(0 0 17 6D 0 0 17 6D BF F5)
Unfortunately, I have been unable to find a solution for this.

Here is a brief description of my setup:

  • I am coding either with the Arduino IDE .
  • The ESP32 is connected as follows:
    • Pin 17 → S1
    • Pin 16 → S2
    • GND → GND

The connection works perfectly with the Motion Studio software, but I encounter this issue when attempting to implement control via code.

Has anyone faced a similar issue, or can you offer any suggestions for resolving this?

Any assistance would be greatly appreciated.

code:

#include <HardwareSerial.h>

HardwareSerial roboclaw(1);  // Using UART1

#define ROBOCLAW_RX 16  // ESP32 RX (connected to RoboClaw's TX)
#define ROBOCLAW_TX 17  // ESP32 TX (connected to RoboClaw's RX)

void setup() {
    Serial.begin(115200);  // Serial monitor
    delay(2000);  // Wait for 2 seconds
    Serial.println("ESP32 started!");

    // Configure GPIO pins
    pinMode(ROBOCLAW_RX, INPUT);
    pinMode(ROBOCLAW_TX, OUTPUT);
    Serial.println("GPIO pins initialized!");

    // Start UART communication
    roboclaw.begin(38400, SERIAL_8N1, ROBOCLAW_RX, ROBOCLAW_TX);
    Serial.println("UART initialized!");

    // Continuously send command to Motor 1
    roboclaw.write(0x80);  // RoboClaw address
    roboclaw.write(0x88);  // Forward command for Motor 1
    roboclaw.write(100);   // Speed value (0-127)
    Serial.println("Motor 1 running!");

    delay(100);  // Wait for a short time

    // Read data from RoboClaw and print to serial monitor
    if (roboclaw.available()) {
        Serial.print("Response from RoboClaw: ");
        while (roboclaw.available()) {
            byte data = roboclaw.read();  // Read byte from RoboClaw
            Serial.print(data, HEX);  // Print data in hexadecimal format
            Serial.print(" ");  // Space between bytes
        }
        Serial.println("\nResponse received!");
    } else {
        Serial.println("No response from RoboClaw!");
    }
}

void loop() {
    // Continuously send drive command to motor
    roboclaw.write(0x80);  // RoboClaw address
    roboclaw.write(0x88);  // Forward command for Motor 1
    roboclaw.write(100);   // Speed value
    delay(100);  // Send commands at intervals
}

Please post a link to its datasheet.

What does that look like?

Please post schematics.

Datasheet: roboclaw_datasheet_2x30A.pdf

it is a driver interface developed by Basic Micro to control its own drivers, but it can only control one driver. After connecting to the driver via USB, the desired settings can be made via the interface. it looks like this

Never seen it before. I'm out on that.

What about the last line in reply #2?

Check that you have correct control mode and baud rate selected.

İts something like this

Thanks for your suggestion. I checked them many times but they are set correctly. If there was a problem I would not get any response from Roboclaw.

That's what I understood from O.P.